Get Holidays List of Australia from Google Calendar API - google-api

I am using
https://www.googleapis.com/calendar/v3/calendars/en.australian%23holiday%40group.v.calendar.google.com/events?key=YourApiKey
to get australian public holidays, but I am receiving empty items array
{
"kind": "calendar#events",
"etag": "\"p32kslj59m6eeu0g\"",
"summary": "Holidays in Australia",
"updated": "2021-03-05T08:30:05.375Z",
"timeZone": "UTC",
"accessRole": "reader",
"defaultReminders": [],
"nextPageToken": "CjASLgojMjAyMTA0MDVfNjBvMzBjaGk2b28zMGMxZzYwbzMwZHI1NmsYkN324_Pw7gIaDwgAEgAYmKz8oN6Y7wIgASIHCAIQzunfEQ==",
"items": []
}
any idea how to get australian holidays?

Google Calendar API is returning the correct results, but it is returning them across several pages. You can get the next page with:
https://www.googleapis.com/calendar/v3/calendars/en.australian%23holiday%40group.v.calendar.google.com/events?key=YourApiKey&pageToken=CjASLgojMjAyMTA0MDVfNjBvMzBjaGk2b28zMGMxZzYwbzMwZHI1NmsYkN324_Pw7gIaDwgAEgAYmKz8oN6Y7wIgASIHCAIQzunfEQ==
See more about pagination here: https://developers.google.com/calendar/v3/pagination
The client libraries make it easy to deal with these multi-paged responses.
The page size defaults to 250 events, but this also includes deleted events, which you are not requesting. The first 250 events on this particular calendar have been marked as deleted, so you see an empty page.
See details at: https://developers.google.com/calendar/v3/reference/events/list
maxResults (integer)
Maximum number of events returned on one result page. The number of events in the resulting page may be less than this value, or none at all, even if there are more events matching the query. Incomplete pages can be detected by a non-empty nextPageToken field in the response. By default the value is 250 events. The page size can never be larger than 2500 events. Optional.
I was able to force everything onto a single page using the following, but this really isn't a good answer. If total event count is larger than 2500, you still might end up with an incomplete list:
https://www.googleapis.com/calendar/v3/calendars/en.australian%23holiday%40group.v.calendar.google.com/events?maxResults=2500&key=[YOUR_API_KEY]'

There seems to be an error in that the initial response returns no events however there is a page token This is not how the system is intended to function. I have submitted an issue report
try me
Request;
curl \
'https://www.googleapis.com/calendar/v3/calendars/en.australian%23holiday%40group.v.calendar.google.com/events?key=[YOUR_API_KEY]' \
--header 'Accept: application/json' \
--compressed
Returns
{
"kind": "calendar#events",
"etag": "\"p33kpjmcjvaeuu0g\"",
"summary": "Holidays in Australia",
"updated": "2021-03-06T07:14:02.000Z",
"timeZone": "UTC",
"accessRole": "reader",
"defaultReminders": [],
"nextPageToken": "CjASLgojMjAyMTA0MDVfNjBvMzBjaGk2b28zMGMxZzYwbzMwZHI1NmsYkN324_Pw7gIaDwgAEgAYgMXbj4-b7wIgASIHCAIQ5I7jEQ==",
"items": []
}
Where it should return events
If i then add the next pagetoken
Request
curl 'https://www.googleapis.com/calendar/v3/calendars/en.australian%23holiday%40group.v.calendar.google.com/events?pageToken=CjASLgojMjAyMTA0MDVfNjBvMzBjaGk2b28zMGMxZzYwbzMwZHI1NmsYkN324_Pw7gIaDwgAEgAYgMXbj4-b7wIgASIHCAIQ5I7jEQ%3D%3D&key=[YOUR_API_KEY]'
--header 'Accept: application/json'
--compressed
response
{
"kind": "calendar#events",
"etag": "\"p32e9tk5uvaeuu0g\"",
"summary": "Holidays in Australia",
"updated": "2021-03-06T07:14:02.000Z",
"timeZone": "UTC",
"accessRole": "reader",
"defaultReminders": [],
"nextPageToken": "CjASLgojMjAyMjEyMjZfNjBvMzBjaGk2NG8zNGMxZzYwbzMwZHI1Nm8YsM-liJbz7gIaDwgAEgAYgMXbj4-b7wIgASIHCAIQvo_jEQ==",
"items": [
{
"kind": "calendar#event",
"etag": "\"3227284619238000\"",
"id": "20200425_60o30chi6so3gc1g60o30dr56g",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=MjAyMDA0MjVfNjBvMzBjaGk2c28zZ2MxZzYwbzMwZHI1NmcgZW4uYXVzdHJhbGlhbiNob2xpZGF5QHY",
"created": "2021-02-18T09:58:29.000Z",
"updated": "2021-02-18T09:58:29.619Z",
"summary": "ANZAC Day Observed (Victoria)",
"description": "Holiday or observance in: Victoria",
The response is returned corectly.

Related

Youtube Data API - /channels Endpoint not Returning Smaller Users

I am creating a networking app for musicians. I was wanting to use the Youtube Data API to let users connect their Youtube channel to their profile within my app. I got everything in place and working via making requests to URLs similar to https://www.googleapis.com/youtube/v3/channels?part=snippet,statistics&forUsername=PewDiePie&key=[YOUR_API_KEY]. This works great and returns this JSON:
{ "kind": "youtube#channelListResponse", "etag": "\"p4VTdlkQv3HQeTEaXgvLePAydmU/bj_rirVFbrVoTIOa6lCGdaXaG5M\"", "pageInfo": { "totalResults": 1, "resultsPerPage": 5 }, "items": [ { "kind": "youtube#channel", "etag": "\"p4VTdlkQv3HQeTEaXgvLePAydmU/Blp06js4r7j93y1EfKve84oXWpo\"", "id": "UC-lHJZR3Gqxm24_Vd_AJ5Yw", "snippet": { "title": "PewDiePie", "description": "I make videos.", "publishedAt": "2010-04-29T10:54:00.000Z", "thumbnails": { "default": { "url": "https://yt3.ggpht.com/a/AGF-l79FVckie4j9WT-4cEW6iu3gPd4GivQf_XNSWg=s88-c-k-c0xffffffff-no-rj-mo", "width": 88, "height": 88 }, "medium": { "url": "https://yt3.ggpht.com/a/AGF-l79FVckie4j9WT-4cEW6iu3gPd4GivQf_XNSWg=s240-c-k-c0xffffffff-no-rj-mo", "width": 240, "height": 240 }, "high": { "url": "https://yt3.ggpht.com/a/AGF-l79FVckie4j9WT-4cEW6iu3gPd4GivQf_XNSWg=s800-c-k-c0xffffffff-no-rj-mo", "width": 800, "height": 800 } }, "localized": { "title": "PewDiePie", "description": "I make videos." }, "country": "US" }, "statistics": { "viewCount": "24334379402", "commentCount": "0", "subscriberCount": "102000000", "hiddenSubscriberCount": false, "videoCount": "4054" } } ] }
Most of my app's users will be smaller musicians, likely with less than 10k youtube subscribers. Take my sister for example, this is a link to her youtube channel: https://www.youtube.com/channel/UCe4Eogv2uGaKUe4x3VNrwsg.
Whenever trying to search for her Youtube channel with the API via https://www.googleapis.com/youtube/v3/channels?part=snippet,statistics&forUsername=Audrey_Chopin&key=[YOUR_API_KEY] (and variations such as replacing Audrey_Chopin with Audrey%20Chopin or Audrey+Chopin) yield no results: { "kind": "youtube#channelListResponse", "etag": "\"p4VTdlkQv3HQeTEaXgvLePAydmU/zJL80hJ0IwMo5wddECFapC8I6Q4\"", "pageInfo": { "totalResults": 0, "resultsPerPage": 5 }, "items": [] }.
Are smaller users not supposed to be returned from this endpoint? If so, is there any way I can implement users to search for their profile without forcing the user to do the OAuth process, i.e. signing into their Youtube account?
It seems that using the /search endpoint works better for smaller channels, though there is less information available in this endpoint (I am unable to get subscriber count and video count, which was included in the "statistics" part of the /channel endpoint).
So updating
https://www.googleapis.com/youtube/v3/channels?part=snippet,statistics&forUsername=Audrey_Chopin&key=[YOUR_API_KEY]
to
https://www.googleapis.com/youtube/v3/search?part=snippet&channelType=any&maxResults=50&order=relevance&q=Audrey%20Chopin&type=channel&key=[YOUR_API_KEY]
yielded smaller channels, though without as much data as when using the /channel endpoint.
Still curious, if anybody knows, why the /channel endpoint does not return smaller channels.
Since you know the user's channel id, simply issue a query to the Channels endpoint on the URL:
https://www.googleapis.com/youtube/v3/channels?part=...&id=$CHANNEL_ID&key=$APP_KEY,
and you'll obtain all public (i.e. non-private) info attached to the referenced channel -- without needing any further authentication. Of course you can specify the part parameter as you see fit.
On the other hand, please note that querying the Search.List endpoint for snippet part is much more costly than querying the Channels.List endpoint for both snippet and statistics parts: 100 vs. 5 quota points.

Trustpilot invitation api weird result

Trying to create invitations using their API, I get a proper result back, however the status is "notsent". There is zero debug information to go by, so I'm wondering if anyone else has seen this and might have ideas for fixing the issue.
Here's an example of a response I got from their api:
{
"businessUnitId": "<business unit id here>",
"businessUserId": "<business user id here>",
"createdTime": "2018-10-02T09:58:35.135569Z",
"id": "<invitation id here>",
"locale": "da-DK",
"preferredSendTime": "2018-10-09T09:58:34Z",
"recipient": {
"email": "<email goes here>",
"name": "<name goes here>"
},
"redirectUri": "http://trustpilot.com",
"referenceId": "<our ref id>",
"replyTo": "trustpilot#boozt.com",
"sender": {
"email": "noreply.invitations#trustpilotmail.com",
"name": "Booztlet.com"
},
"sentTime": null,
"source": "InvitationApi",
"status": "notsent",
"tags": [],
"templateId": "57cfc1a660e1cc0620b53a38"
}
So, the NotSent status code is expected for new invitations. This is because invitations are sent asynchronously - at around the time you put in as your "preferredSendTime".
If you login to your account at https://businessapp.b2b.trustpilot.com/#/invitations/invitation-history, you should be able to see the invitation you created, and whether it was sent or not (since you specified October 9th as your preferredSendTime, the invitation will still be queued until that point)

POST google Places API - INVALID_REQUEST

{
"location": {
"lat": -33.8669710,
"lng": 151.1958750
},
"accuracy": 50,
"name": "Google Shoes!",
"phone_number": "(02) 9374 4000",
"address": "48 Pirrama Road, Pyrmont, NSW 2009, Australia",
"types": ["shoe_store"],
"website": "http://www.google.com.au/",
"language": "en-AU"
}
This one I tried and as well as other places without modifying the request structure with Indian places. I'm getting the following response:
{
"html_attributions": [],
"results": [],
"status": "INVALID_REQUEST"
}
I'm not getting exactly what is the Issue, please revert back for the solution.
Since you didn't specify, I'm assuming that you are trying to use the add places endpoint on the Places API described here in the documentation.
The most likely problem is that you neglected to include your API key in the request URL, which should look like this:
https://maps.googleapis.com/maps/api/place/add/json?key=YOUR_API_KEY
Note that this endpoint is deprecated and that Google may remove it altogether at some point in the future.

Bug: Google+ People Search API always returns 0 results

Requests to
https://www.googleapis.com/plus/v1/people?query=john+doe&key=[key]&maxResults=50
for whatever ?query always returns zero items[]
{
"kind": "plus#peopleFeed",
"etag": "\"ucaTEV-ZanNH5M3SCxYRM0QRw2Y/Zbzi1ZPF4WuKo3Uhmc0kd8tdybA\"",
"selfLink": "https://www.googleapis.com/plus/v1/people?query=john+doe&key=[key]&maxResults=50",
"title": "Google+ People Search Results",
"nextPageToken": "",
"items": []
}
This is also the case in the "Try this API" form located at https://developers.google.com/+/web/api/rest/latest/people/search

googleplus api giving nextPageToken even when there is not data

Why is Googleplus api giving nextPageToken when there is no results ?
{
"kind": "plus#activityFeed",
"etag": "\"gLJf7LwN3wOpLHXk4IeQ9ES9mEc/E_vEAk7R5aEXkBfh8ZRN5jeozRI\"",
"nextPageToken": "ChAQt73bzsytxwIYACCTASgHEg4IABAAGP__________fxgCIAAo0Z7qjYvxrPfUAQ==",
"selfLink": "https://www.googleapis.com/plus/v1/activities?orderBy=recent&pageToken=Cg8Qt73bzsytxwIYACB-KAYSDggAEAAY__________9_GAIgACjRnuqNi_Gs99QB==&key=AIzaSyDf3ejxhljBJ31CIRqx3-g7zXVTvq08HA0&query=%2B971-800-7669&alt=json&maxResults=20",
"title": "Google+ Activities Search Results",
"items": []
}

Resources