Google Apps user primary Calendar API v3 timezone update not working? - timezone

I'm using Google APIs Explorer to set Google Apps user primary calendar timezone - tried both update ("Services > Calendar API v3 > calendar.calendars.update") and patch ("Services > Calendar API v3 > calendar.calendars.patch") but timezone is not changed.
Timezone is not updated in Calendar application and get ("Services > Calendar API v3 > calendar.calendars.get") returns old value that does not reflect update or patch...
Is it a bug in Calendar API v3 or am I missing something?
Example Calendar API v3 requests and responses:
Request:
PATCH https://www.googleapis.com/calendar/v3/calendars/user152%40bracnaagencija.com?key={YOUR_API_KEY}
Content-Type: application/json
Authorization: Bearer ya29.1.AADtN_UPBwkU29qf5Tg1rEOZAtBdjv0OArg_RcAaUGNd4K43Pnonf6vK5JcJqfT6ht2bh31n793sry9AIs3-_xk
X-JavaScript-User-Agent: Google APIs Explorer
{
"timeZone": "Europe/Zagreb"
}
Response:
200 OK
- Show headers -
{
"kind": "calendar#calendar",
"etag": "\"XxbwS1MD0Y8jfGZwMQdPS4xI8-w/G_gC5jDwlI70wsfMFOhGzUPev2U\"",
"id": "user152#bracnaagencija.com",
"summary": "Unknown Unknown",
"timeZone": "Europe/Zagreb"
}
Request:
GET https://www.googleapis.com/calendar/v3/calendars/user152%40bracnaagencija.com?key={YOUR_API_KEY}
Authorization: Bearer ya29.1.AADtN_UZRmbrmkJvNRyA9739wcpsKPRObitSAnfMeh1WcEan0Z6UML3ryFZaoy0OJELLYu6mgg
X-JavaScript-User-Agent: Google APIs Explorer
Response:
200 OK
- Show headers -
{
"kind": "calendar#calendar",
"etag": "\"XxbwS1MD0Y8jfGZwMQdPS4xI8-w/ykVLEmnFygm61gmsUBUa0zgsq0E\"",
"id": "user152#bracnaagencija.com",
"summary": "user152#bracnaagencija.com",
"timeZone": "America/New_York"
}

Europe/Zagreb is a valid IANA/Olson identifier, but it's just a link to Europe/Belgrade. It shares the exact same data. (For details, see this list, or the original source data.)
It's entirely possible (though I am not 100% certain) that Google Calendar does not support links in its list of time zones.
Try Europe/Belgrade and see if that works.

Related

Add cards to video with Youtube api

I have been learning about youtube api. In market some of the browser extensions can able to apply video cards template to existing youtube video. As per my knowledge to do this we need to have some cards api because I don't believe Youtube will allow to modify the web app DOM directly as this will be security risk.I have gone through YT data api, reports and analytics api but I could not exactly find a way to add video cards programatically.However we can add cards from YT studio which is normal way of doing it. is there any api available for cards/annotations?if not how other developers are able to achieve this indirectly?
Note:
1)I have also posted this on YT community help but did not get response so far and posting here so that I may get some help from others.
2)I have also referred an old stackover flow post YouTube Cards API but could not find exact answer as it was posted long ago and there are so many recent changes in YT api.
Youtube data api
https://developers.google.com/youtube/v3/guides/implementation/videos
I have tried video create and update api.But could not find a field/method to add info cards
Please find the sample code below
POST https://youtube.googleapis.com/youtube/v3/videos?part=snippet%2Cstatus&key=[YOUR_API_KEY] HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
Content-Type: application/json
{
"snippet": {
"categoryId": "1",
"description": "Video Description.",
"title": "Test video 123"
},
"status": {
"privacyStatus": "private"
}
}
PUT https://youtube.googleapis.com/youtube/v3/videos?part=snippet%2Cstatus%2Clocalizations&key=[YOUR_API_KEY] HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
Content-Type: application/json
{
"id": "YOUR_VIDEO_ID",
"snippet": {
"categoryId": 22,
"defaultLanguage": "en",
"description": "This is sample description",
"tags": [
"sample tag1"
],
"title": "Sample title"
},
"status": {
"privacyStatus": "private"
},
"localizations": {
"es": {
"title": "Hello data",
"description": "hello description"
}
}
}
We have adding cards feature in Youtube studio UI.But I want to implement same with api.
Reference:
https://support.google.com/youtube/answer/6140493?hl=en&co=GENIE.Platform%3DDesktop

Issue with getting user activity report through Microsoft Graph API (Graph Explorer)

I'm trying to get a MS Teams report of User activity over the last 90 Days, however when I try to run the call: https://graph.microsoft.com/beta/reports/getTeamsUserActivityUserCounts(period='D90') on Graph Explorer, it respond with an error Failure - Status Code 0. When I added parameter ?$format=application/json at the end of the request, it responded successfully with data of the report in json format. However, I could not get anything from this response because it did not specify users' identities. Anyway to overcome this issue?
The getTeamsUserActivityUserCounts endpoint reports aggregated counts by Team, not by User. To report on activity by User, you need to run the getTeamsUserActivityUserDetail:
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 452
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.teamsUserActivityUserDetail)",
"value": [
{
"reportRefreshDate": "2017-09-01",
"userPrincipalName": "userPrincipalName-value",
"lastActivityDate": "2017-09-01",
"isDeleted": false,
"deletedDate": null,
"assignedProducts": [
"OFFICE 365 ENTERPRISE E5"
],
"teamChatMessageCount": 0,
"privateChatMessageCount": 49,
"callCount": 2,
"meetingCount": 0,
"hasOtherAction": true,
"reportPeriod": "7"
}
]
}

Microsoft Graph Calendar API - TargetIdShouldNotBeMeOrWhitespace error

We use Microsoft Graph API's to create a calendar in outlook
Following is the HTTP Request
POST https://graph.microsoft.com/v1.0/users/me/calendars
Content-type: application/json
{
"name": "My Calendar"
}
It was working for the last 2 years. Suddenly it is throwing an error as
{
"error": {
"code": "TargetIdShouldNotBeMeOrWhitespace",
"message": "Id is malformed.",
"innerError": {
"request-id": "78bce863-d6fb-4ea9-b0f8-e5097010cef6",
"date": "2019-03-23T11:54:34"
}
}
}
When we searched the documentation (https://learn.microsoft.com/en-us/graph/api/user-post-calendars?view=graph-rest-1.0).
We found the API URL has been changed
When was a critical update like this was rolled out which caused breakage in our flows?
Is there any official channel/group notifying these changes.
similar question for mail API's Microsoft Graph API - SendMail http 400 - API url from documentation not working
The correct URI is /me, not /users/me. Behind the scenes, /me is just an alias for /users/{id}. Asking for /users/me would be the equivalent of asking for /users/users/me.
It sounds like you were making use of an unintended behavior. It stopped working when that behavior was corrected.

Get a YouTube channel uploaded video list by publish date

I am aware of similar questions being asked before, but not this exact one, so please bear with me...
I want to reproduce a channel's uploaded videos list as they appear on YouTube's web page (broken into pages and sorted by publish date).
To do this, I am trying to get a list of VideoIDs from a YouTube channel that's sorted by publish date (by YouTube, not my code since there could be 1000's of videos in a playlist and YouTube limits to 50 results per query which can add up when I only want to show the user the first 25 entries).
Initially, I was using this YouTube Data API v3 Search query:
https://www.googleapis.com/youtube/v3/search?key=[APIKey]&channelId=[ChannelID]&part=snippet,id&order=date&type=video&maxResults=25
However, as some of the previous posts on stackoverflow mentioned (YouTube API v3 Search not returning all videos), this method does not guarantee to return all videos and indeed, some videos are missing from the result, making use of this query problematic.
I then saw this google video in some of the posts:
https://www.youtube.com/watch?v=RjUlmco7v2M
In the video, it is explained that you must first get the 'uploads' playlist for a channel (I'm also grabbing the channel's title and thumbnail in this query), which I do using:
https://www.googleapis.com/youtube/v3/channels?key=[APIKEY]&part=snippet,contentDetails&id=[ChannelID]
And once I have the 'uploads' playlist ID, I query:
https://www.googleapis.com/youtube/v3/playlistItems?key=[APIKey]&playlistId=[PlaylistID]&part=snippet,id&order=date&type=video&maxResults=25
However, the returned entries are not sorted by the publish date and according to the documentation (https://developers.google.com/youtube/v3/docs/playlistItems/list), there is no optional "order" parameter associated with this query.
With all these issues in mind, how do I get the first 25 entries of the 'uploads' playlist sorted by publish date without downloading the entire playlist so I can faithfully recreate how the YouTube website is listing videos.
After making some tests and thanks to this answer (and the next answers too) I was able to retrieve the information you need using the YouTube Data API v3 and here is how I made it:
First, in your question you're using the "search" API - since I don't know which criteria you're using in the search request, I omitted it for get direct to get the "upload" playlist id from a given channel_id.
Using the channel_id = UCT2rZIAL-zNqeK1OmLLUa6g (which belongs to "Microsoft HoloLens"), I use the "channels" API for retrieve the uploads playlist id.
Here is the URL request for retrieve the "upload" playlist id from the channel_id previously mentioned:
https://www.googleapis.com/youtube/v3/channels?part=id%2Csnippet%2CcontentDetails&fields=items(contentDetails%2FrelatedPlaylists%2Fuploads%2Csnippet%2Flocalized)&id=UCT2rZIAL-zNqeK1OmLLUa6g&key=<YOUR_API_KEY>
Explanation:
part: set the snippet and contentDetails parts for retrieve the following:
fields: from the snippet part: (localized, description and title) and from the contentDetails part: (relatedPlayLists and uploads).
id: channel_id used in this request.
Here are the results from this request:
{
"items": [
{
"snippet": {
"localized": {
"title": "Microsoft HoloLens",
"description": "The official YouTube channel of Microsoft HoloLens. Transform your world with holograms. Visit HoloLens.com for more info."
}
},
"contentDetails": {
"relatedPlaylists": {
"uploads": "UUT2rZIAL-zNqeK1OmLLUa6g"
}
}
}
]
}
Check the value of the uploads property in the
contentDetails section. This value will be used in the next API request.
You can also check these results in the Google API Explorer demo I prepared for make this request.
Once retrieved the uploads value (as specified in previous lines), now it's time to use the "playlistItems" API for build the following URL:
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet%2CcontentDetails&playlistId=UUT2rZIAL-zNqeK1OmLLUa6g&fields=items(contentDetails(videoId%2CvideoPublishedAt)%2Csnippet%2Ftitle%2Cstatus)&maxResults=25&key=<YOUR_API_KEY>
Explanation:
part: set the snippet and contentDetails parts for retrieve the following:
fields: from the snippet part: (title and status) and from the contentDetails part: (videoId and videoPublishedAt).
playlistId: is the playlistId used in this request - (that is, the uploads value).
maxResults: set to 25.
Here are the results from this request:
{
"items": [
{
"snippet": {
"title": "Microsoft Windows Mixed Reality update | October 2018"
},
"contentDetails": {
"videoId": "00vnln25HBg",
"videoPublishedAt": "2019-01-04T17:43:47.000Z"
}
},
{
"snippet": {
"title": "How to use Spectator View for mobile devices"
},
"contentDetails": {
"videoId": "3fXlPw_FGLg",
"videoPublishedAt": "2018-10-15T17:13:42.000Z"
}
},
{
"snippet": {
"title": "Microsoft HoloLens: Visualizing the next mission to Mars."
},
"contentDetails": {
"videoId": "XVBbJ4EtAQY",
"videoPublishedAt": "2018-07-02T16:30:26.000Z"
}
},
{
"snippet": {
"title": "Microsoft HoloLens: Making mixed reality plug and play."
},
"contentDetails": {
"videoId": "QwXcSekZKWE",
"videoPublishedAt": "2018-06-25T23:25:55.000Z"
}
},
{
"snippet": {
"title": "Microsoft HoloLens | Windows Mixed Reality HMD Exerciser"
},
"contentDetails": {
"videoId": "RU3OMjq_Yic",
"videoPublishedAt": "2018-05-14T16:58:43.000Z"
}
}
]
}
I check the order of the items and they are in sorted by videoPublishedAt value (new to old).
You can also check these results in the try-it funcionality found in the YouTube Data API v3 - official documentation.1
1 For this case, I was unable to use the Google API Explorer (as I used in the first request) because I always got a "backend Error".
{
"error": {
"errors": [
{
"domain": "global",
"reason": "backendError",
"message": "Backend Error"
}
],
"code": 500,
"message": "Backend Error"
}
}
I think this is because the Google API explorer is outdated.
If anyone want to check it out, here is the demo.
I'm also using the playlist ID to get a list of videos, however mine do seem to be sorted by date from newest to oldest. Note that Youtube returns a page token that you can use to get the next 25 (or in my case 50) videos. I'm querying the API this way:
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&pageToken= not_used_for_first_query&fields=nextPageToken,items(snippet(publishedAt,title,desc ription,thumbnails(default(url)),resourceId(videoId)))&playlistId=uploads_playlist_id&maxResults=50&order=date&key=your_api_key
This gets back in JSON response:
The video title
Publish date
Video description
Youtube URL for video
Video unique ID
Video thumbnail
You can see my working example at https://www.scriptbarrel.com

Profile details in outlook rest api

Starting from here: https://dev.outlook.com/restapi/tutorial/php
Scopes:
private static $scopes = array("openid"
,"profile"
,"offline_access"
,"https://outlook.office.com/calendars.read"
,"https://outlook.office.com/contacts.read"
);
When I authenticate I get in id_token only some basic info about the profile.
With:
https://outlook.office.com/api/v2.0/me/contacts
I get some very nice details about contacts, like phone numbers that I'm specially interested in my case.
Is possible to get the same level of details for the current user profile as you get for one of its contacts when is accessed through the api?
How about using the Microsoft Graph API:
GET https://graph.microsoft.com/v1.0/me
The response should like as following:
HTTP/1.1 200 OK
Content-type: application/json
Content-length: 491
{
"businessPhones": [
"businessPhones-value"
],
"displayName": "displayName-value",
"givenName": "givenName-value",
"jobTitle": "jobTitle-value",
"mail": "mail-value",
"mobilePhone": "mobilePhone-value",
"officeLocation": "officeLocation-value",
"preferredLanguage": "preferredLanguage-value",
"surname": "surname-value",
"userPrincipalName": "userPrincipalName-value",
"id": "id-value"
}
Graph API - Get user

Resources