Weblink from groups calendarview MS Graph API doesn't work event after encoding item id - microsoft-graph-api

webLink form groups calendar view returned in MS Graph API doesn't work correctly.
Steps to reproduce:
Create an event in a calendar group
call Graph API https://graph.microsoft.com/v1.0/groups/{GroupId}/calendar/calendarview?$Top=10&$select=webLink,subject,id&startdatetime=2023-01-30T16:54:11.890Z&enddatetime=2023-07-30T15:54:11.891Z
returned weblink example "webLink": "https://outlook.office365.com/calendar/deeplink/read/group/tenant.onmicrosoft.com/AccountingO365_Cs162adfsFixCalendar/AAMkAGVkOGVlMDM4LWNlY2ItNDNkZS1hY2I1LTQ4YzJjZDNkMDVmZAFRAAgI2wPnQwhAAEYAAAAAbAkvu4LrVEiQM4b4wHlrSwcAjqRLsHAS6ECpPiwPJ4o/wAAAAAABDQAAjqRLsHAS6ECpPiwPJ4o/wAAAAAARFAAAEA==",
encode Item ID AAMkAGVkOGVlMDM4LWNlY2ItNDNkZS1hY2I1LTQ4YzJjZDNkMDVmZAFRAAgI2wPnQwhAAEYAAAAAbAkvu4LrVEiQM4b4wHlrSwcAjqRLsHAS6ECpPiwPJ4o/wAAAAAABDQAAjqRLsHAS6ECpPiwPJ4o/wAAAAAARFAAAEA==
open the URL in the browser https://outlook.office365.com/calendar/deeplink/read/group/tenant.onmicrosoft.com/AccountingO365_Cs162adfsFixCalendar/AAMkAGVkOGVlMDM4LWNlY2ItNDNkZS1hY2I1LTQ4YzJjZDNkMDVmZAFRAAgI2wPnQwhAAEYAAAAAbAkvu4LrVEiQM4b4wHlrSwcAjqRLsHAS6ECpPiwPJ4o%2FwAAAAAABDQAAjqRLsHAS6ECpPiwPJ4o%2FwAAAAAARFAAAEA%3D%3D
browser returned a blank screen with a loading icon
network tab shows 404 for the request URL: https://outlook.office365.com/search/api/v1/recommendations
with the following response
{"error":{"code":"ErrorItemNotFound","message":"The specified object was not found in the store.","target":"","httpCode":404,"recommendedAction":"Escalate to [3SRecAlerts#microsoft.com] if the issue persists."},"Instrumentation":{"TraceId":"d5522a1a-5f99-264e-bcc7-ca327b5a3e67"}}
expected to open the group calendar event details.

Related

Can the MS Graph meeting link be opened directly in the browser?

I have successfully created an onlineMeeting object by using MS Graph API
POST /users/{userId}/onlineMeetings
I can extract the joinWebUrl (or the joinUrl, both seem to be the same) and get it to open on a new tab, which gives a popup asking whether I should open the Teams App on my system to join the meeting. If I say yes, the Teams App opens up and I can join the meeting through it. If I say no, the Teams launcher page is opened, where I can
a. Download the app
b. Continue on the browser, or
c. Open Teams.
My question is, how can I get the meeting opened up directly on the browser, bypassing the popup and the launcher page? Everywhere I search, questions are on how to open the meeting directly in the app, but I need it the other way around, in the browser. Is this possible through code?
I'm including my graph API code below, even though it might not be relevant.
let data = {
"startDateTime": "2022-08-16T13:20:34.2444915-07:00",
"endDateTime": "2022-08-16T13:25:34.2444915-07:00",
"subject": "Teams Meeting"
}
let payload = await fetch("https://graph.microsoft.com/v1.0/users/{userId}/onlineMeetings", {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + tokenResponse.accessToken,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});
let json = await payload.json();
window.open(json.joinWebUrl);
The default behavior is: it open the Teams launcher page:
Here, you can click on checkbox to always open the links in associated app but we don't have any option to always open it in browser.

My rails app is mixing up api requests and responses from different threads when called at the same time

I am working on a Rails app that has a form that makes 1st party API requests to Odoo v12, where I have all of my data stored. When a user submits 2 forms simultaneously, if there's any delay in the API response (as few as .2 seconds), the server begins work on the other request, which is expected.
However, when the responses come back in the order they were made, rails assign the response to the request with an open connection. (For e.g. response 1 is being assigned to request 2, and response 2 is being assigned to request 1.)
Inspecting the request_ids confirms that this is what is happening.
Example of created record IDs returning to the wrong request
res.partner create
Starting api call for res.partner on request
63f02dd4-8242-4043-9926-1e34133be2e1 at 1576616788523
[{:odoo_po=>"7643153000",
:quickbooks_invoice_url=>"", :deal_name=>"Delete ME PLEASE",
:deal_id=>"427759097", :reorder=>0, :company=>333, :sale_contact=>337,
:submitted_by=>98, :approver=>119, :hubspot_id=>"427759097",
:shipping_deadline=>"2020-01-07", :delivery_deadline=>"2020-01-13",
:knitting_deadline=>"2020-01-03", :internal_notes=>"",
"distributor_po"=>"14215",
"kit_arrays"=>"1,85996,15578;2,15578,85996;"}]
sale_form.sale_form create
Starting api call for sale_form.sale_form on request
673fa655-907a-416f-8ed9-7c97d220fc0b at 1576616788650
18805 _
673fa655-907a-416f-8ed9-7c97d220fc0b
51 ms api call for
sale_form.sale_form on request 673fa655-907a-416f-8ed9-7c97d220fc0b
9067 _ 63f02dd4-8242-4043-9926-1e34133be2e1
680 ms api call for res.partner
on request 63f02dd4-8242-4043-9926-1e34133be2e1
In the code above, the '9067' should be record_id associated with the sale_form.sale_form request(request_id 673fa655-907a-416f-8ed9-7c97d220fc0b), while the '18805' should be the record_id associated with the res.partner request(request_id 63f02dd4-8242-4043-9926-1e34133be2e1)
The code runs fine when forms are submitted more than a few seconds apart so I don't think it is an issue with the code I've written. Is this an issue with Rails/Puma/some other Gem? Or should I shift my focus towards how Odoo is handling the requests/responses?

How to get chart from Excel in onedrive using graph API

While trying to get Charts from a Worksheet, I am getting an "Internal Error" response.
I am issuing a GET request where demo.xlsx is my excel file and CHART2 is the name of the sheet:
/v1.0/me/drive/root:/demo.xlsx:/workbook/worksheets/CHART2/charts
Furthermore, if I have no charts in the sheet, I don't receive an error response, only an empty array (as expected).
Interestingly enough I can get a Chart if I know it's name using either of these two paterns:
('Chart-Name')/Image(width=400, height=200, fittingMode='
/charts/Chart-Name/name

How can I get a channel ID from YouTube?

I'm trying to retrive the data from my channel using the YouTube Data API V3.
For that I need my channel ID.
I've tried to find my channel ID from my YouTube account, and I failed in every single way.
If anyone have a single tip for me, I would be incredible glad.
This is the URL that I'm using to retrieve the data:
https://www.googleapis.com/youtube/v3/channels?id=fjTOrCPnAblTngWAzpnlMA&key={YOUR_API_KEY}&part=snippet,contentDetails,statistics
The ID is for the channel ID, and the key, I'm replacing the {YOUR_API_KEY} with my API KEY generated at my Google API console.
My channel ID is not:
- klauskkpm
- klausmachado
- klausmachado#gmail.com
- fjTOrCPnAblTngWAzpnlMA
My channel is: http://www.youtube.com/user/klauskkpm
To obtain the channel id you can view the source code of the channel page and find either data-channel-external-id="UCjXfkj5iapKHJrhYfAF9ZGg" or "externalId":"UCjXfkj5iapKHJrhYfAF9ZGg".
UCjXfkj5iapKHJrhYfAF9ZGg will be the channel ID you are looking for.
An easy answer is, your YouTube Channel ID is UC + {YOUR_ACCOUNT_ID}.
To be sure of your YouTube Channel ID or your YouTube account ID, access the advanced settings at your settings page
And if you want to know the YouTube Channel ID for any channel, you could use the solution #mjlescano gave.
https://www.googleapis.com/youtube/v3/channels?key={YOUR_API_KEY}&forUsername={USER_NAME}&part=id
If this could be of any help, some user marked it was solved in another topic right here.
You can get the channel ID with the username (in your case "klauskkpm") using the filter "forUsername", like this:
https://www.googleapis.com/youtube/v3/channels?key={YOUR_API_KEY}&forUsername=klauskkpm&part=id
More info here: https://developers.google.com/youtube/v3/docs/channels/list
At any channel page with "user" url for example http://www.youtube.com/user/klauskkpm, without API call, from YouTube UI, click a video of the channel (in its "VIDEOS" tab) and click the channel name on the video. Then you can get to the page with its "channel" url for example https://www.youtube.com/channel/UCfjTOrCPnAblTngWAzpnlMA.
I just found the simplest way to find the channel ID of any YouTube channel !!
Step 1: Play a video of that channel.
Step 2: Click the channel name under that video.
Step 3: Look at the browser address bar.
June 2021 edition.
Right click and view page source.
Search for "externalId", the value follows.
Source: comment by Daniel 2017.
Alternative: run this JavaScript in console:
ytInitialData.metadata.channelMetadataRenderer.externalId
An alternative to get youtube channel ID by channel url without API:
function get_youtube_channel_ID($url){
$html = file_get_contents($url);
preg_match("'<meta itemprop=\"channelId\" content=\"(.*?)\"'si", $html, $match);
if($match && $match[1])
return $match[1];
}
As of 2022-06-23:
Open Chrome Dev Tools (F12), and in the "Elements" tab, within the source code pane, depending on URL type:
A. For channel URLs of type: www.youtube.com/c/<channel_name>:
Search for either:
"externalId" - next to it there will be the channel_ID
"channelUrl" - next to it there will be: https://www.youtube.com/channel/<channel_ID>
or run in the console:
ytInitialData.metadata.channelMetadataRenderer.externalId
(credit: https://stackoverflow.com/a/68063136/624597)
B. For video URLs of type: www.youtube.com/watch?v=<video_ID>:
Search for either:
"externalId" - next to it there will be the channel_ID
"externalChannelId" - next to it there will be the channel_ID
"ownerProfileUrl" - next to it there will be: https://www.youtube.com/channel/<channel_ID>
or run in the console:
ytInitialPlayerResponse.microformat.playerMicroformatRenderer.externalChannelId
Channel id with the current youtube version is obtained very easily if you login to YouYube website and select 'My channel'
Your channel ID will be displayed on the address bar of your browser
https://www.youtube.com/account_advanced now provides both channel and user ids. See also https://developers.google.com/youtube/v3/guides/working_with_channel_ids .
2017 Update: Henry's answer may be a little off the mark here. If you look for data-channel-external-id in the source code you may find more than one ID, and only the first occurrence is actually correct. Get the channel_id used in <link rel="alternate" type="application/rss+xml" title="RSS" href="https://www.youtube.com/feeds/videos.xml?channel_id=<VALUE_HERE"> instead.
To obtain the channel id you can do the following request which gives you the channel id and playlist id.
https://www.googleapis.com/youtube/v3/channels?part=contentDetails%2C+statistics%2Csnippet&mine=true&key={YOUR_API_KEY}
mine parameter means the current authorized user
as u said channel id is prefixed with UC+{your account id} which you get while login, you can use this one also without requesting the above url you can directly call the channel api with your google id and just prefix with UC
https://www.googleapis.com/youtube/v3/channels?part=contentDetails%2C+statistics%2Csnippet&id=UC{your account id}&key={YOUR_API_KEY}
Apparently there is a channelId attribute in video page's source code;
To get Channel id
Ex: Apple channel ID
Select any of the video in that channel
Select iPhone - Share photos (video)
Now click on channel name Apple bottom of the video.
Now you will get channel id in browser url
Here this is Apple channel id : UCE_M8A5yxnLfW0KghEeajjw
Try to search for regular expression UC[-_0-9A-Za-z]{21}[AQgw] in source code. This ID is presented even if channel has non-ASCII characters in URL:
Here is screenshot of internal viewer/editor of Midnight Commander, it has regexp search:
Alternatives to get the channel URL with its ID.
With a CSS selector by searching the channel homepage source code:
body > link[rel="canonical"]
or with JS via the console:
document.querySelector('body > link[rel="canonical"]').href
Another method to find the ID of a channel that is not yours is to go to the channel page and press the red "Subscribe" button.
Then use the Chrome's Inspector tools Network tab and look for the POST request issued by the subscribe action. In the payload of this request you will find the channel id:
You can unsubscribe immediately after subscribing.
Now in 2023, typing this in console should work:
document.querySelectorAll('[itemprop="channelId"]')[0].content

How do I fetch orgusers beyond the 1st 100 using the Google Apps OrgUser provisioning API feed

I am using Zend's gdata library for the Google Apps provisioning API. Since Zend doesn't yet support fetching org users (no retrieve function provided by the library for this feed), I am making a custom gdata query to the url (as suggested in the documentation developers.google.com/google-apps/provisioning/#retrieving_organization_users_experimental):
apps-apis.google.com/a/feeds/orguser/2.0/'.$customerId.'?get=all
This works well for <= 100 users.
Now, I have created a domain with 125 users across 5 OUs. When I fetch the above URI, I get the 1st 100 users (as documented and expected). However, I could not find the pagination link mentioned here: developers.google.com/google-apps/provisioning/reference#Results_Pagination
Here's the start of my orguser feed:
<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:apps='http://schemas.google.com/apps/2006'><id>https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx</id><updated>2013-01-06T08:17:43.520Z</updated><**link rel='next' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx?get=all&startKey=RASS03jtnz0s2orxmbn.**'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxx'/>
I tried the https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx?get=all&startKey=RASS03jtnz0s2orxmbn. link but it gives me the exact same 100 users that the https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx?get=all link gives. This is the only occurrence of the word "next" in my feed and so there is not other URI I can try to fetch the next 25 users.
So I have only been able to get 100 users from this API call. How do I go about fetching the next 25 users? Examples/code would be really appreciated. Or what am I doing wrong?
Please help - this is blocking an urgent delivery.
Thanks!,
Vinay.
Your 2nd request should look like:
https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxx?startKey=RASS03jtnz0s2orxmbn&get=all
startKey should be set to the value of the next parameter and get should continue to be all for each page request.
Also, make sure the URL is decoded, if & is encoded as & in the request, then Google's servers will see all of all&startKey=RASS03jtnz0s2orxmbn as the value of get and it won't see a startKey parameter at all.

Resources