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
Related
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
I have done OAuth2.0 using PKCE flow in .NET Framework (C# Winforms).
Now I have tokens_response in my hand.
But I'm wondering is it possible to fetch all of the organisation (not only one)?
You can check the organisations (tenants) that you can access with a given token using the /connections endpoint, like this:
GET https://api.xero.com/connections
Authorization: "Bearer " + access_token
Content-Type: application/json
Response:
[
{
"id": "e1eede29-f875-4a5d-8470-17f6a29a88b1",
"authEventId": "d99ecdfe-391d-43d2-b834-17636ba90e8d",
"tenantId": "70784a63-d24b-46a9-a4db-0e70a274b056",
"tenantType": "ORGANISATION",
"tenantName": "Maple Florist",
"createdDateUtc": "2019-07-09T23:40:30.1833130",
"updatedDateUtc": "2020-05-15T01:35:13.8491980"
},
{
"id": "32587c85-a9b3-4306-ac30-b416e8f2c841",
"authEventId": "d0ddcf81-f942-4f4d-b3c7-f98045204db4",
"tenantId": "e0da6937-de07-4a14-adee-37abfac298ce",
"tenantType": "ORGANISATION",
"tenantName": "Adam Demo Company (NZ)",
"createdDateUtc": "2020-03-23T02:24:22.2328510",
"updatedDateUtc": "2020-05-13T09:43:40.7689720"
}
]
If you need more information than the organisations' id and name, you'll need to call the /organisation endpoint individually for each.
The connections endpoint is described more in section 5 on this page of the docs: https://developer.xero.com/documentation/oauth2/auth-flow
I am quite new in using Google APIs. So, the problem is that I am administrator of the YouTube channel (not the owner). And I would like to get the straffic sources that were embedded on external websites. So, I've created new project and formed a request through Google APIs Explorer. Here it is:
https://youtubeanalytics.googleapis.com/v2/reports?dimensions=insightTrafficSourceDetail&endDate=2018-12-12&filters=insightTrafficSourceType%3D%3DEXT_URL&ids=channel%3D%3D{MY_CHANNEL}&maxResults=25&metrics=views&sort=-views&startDate=2014-05-01&key={MY_API_KEY}
Here is the result:
200
- Show headers -
{
"kind": "youtubeAnalytics#resultTable",
"columnHeaders": [
{
"name": "insightTrafficSourceDetail",
"columnType": "DIMENSION",
"dataType": "STRING"
},
{
"name": "views",
"columnType": "METRIC",
"dataType": "INTEGER"
}
],
"rows": [
[
"vk.com",
2399
],
[
"unknown",
872
],
[
"yandex.ru",
23
]
But when I try to write the request into the browser address bar directly, it says:
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"errors": [
{
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"domain": "global",
"reason": "unauthorized"
}
],
"status": "UNAUTHENTICATED"
}
}
I pushed into the {API_KEY} field from here
But, unfortunately, the result is such as provided above. What am I doing wrong? Can you provide the step-by-step instruction to get the right HTTP-request for my aim, as I counld'nt find it? Thank you!
In my application, the user signs in using their Office365 credentials and then
I want to import the data of the users (id, mail, displayName) in the same
organization into my database.
When another person from the same organization logs in into my app, that other
person should see the same list of users as the first one.
I tried several queries in the Graph Explorer, but none
of them has a response, which would allow to determine that two people belong
to the same organization.
"My profile" (/v1.0/me/) response contains a lot
of data, but no tenant ID (or something similar):
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
"id": "16f5a7b6-5a15-4568-aa5a-31bb117e9967",
"businessPhones": [],
"displayName": "Anne Weiler",
"givenName": "Anne",
"jobTitle": "Manufacturing Lead",
"mail": "annew#CIE493742.onmicrosoft.com",
"mobilePhone": "+1 3528700812",
"officeLocation": null,
"preferredLanguage": "en-US",
"surname": "Weiler",
"userPrincipalName": "annew#CIE493742.onmicrosoft.com"
}
Same applies to the "all users in the organization" (/v1.0/users) response.
How can I extract the information from Microsoft Graph that would allow me to
detect that two different users work in the same organization?
You could use the id returned by the /organiozation endpoint:
https://graph.microsoft.com/v1.0/organization?$select=id,displayName
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#organization(id,displayName)",
"value": [
{
"id": "c07ab59f-ce09-49f8-b4c4-9c6dd4f0d8bb",
"displayName": "Microsoft API Sandbox"
}
]
}
I am unable to provision users to a federated domain, say example.org, with Microsoft Graph API.
The url I am sending the POST to is:
https://graph.microsoft.com/v1.0/users
json payload is:
{
"accountEnabled": true,
"city": "Seattle",
"country": "United States",
"department": "Sales & Marketing",
"displayName": "Melissa Darrow",
"givenName": "Melissa",
"jobTitle": "Marketing Director",
"mailNickname": "MelissaD",
"passwordPolicies": "DisablePasswordExpiration",
"passwordProfile": {
"password": "Test1234",
"forceChangePasswordNextSignIn": false
},
"officeLocation": "131/1105",
"postalCode": "98052",
"preferredLanguage": "en-US",
"state": "WA",
"streetAddress": "9256 Towne Center Dr., Suite 400",
"surname": "Darrow",
"mobilePhone": "+1 206 555 0110",
"usageLocation": "US",
"immutableID": "melissab",
"userPrincipalName": "melissab#example.org"
}
What I receive is:
{
"error": {
"code": "Request_BadRequest",
"message": "One or more properties contains invalid values.",
"innerError": {
"request-id": "9e8af7a6-fba2-4a66-8421-19dbfd2c36f1",
"date": "2017-05-12T12:13:22"
}
}
}
please note immutableId can be found in the payload.
Is it possibile to provision such users with the given REST framework?
immutableID must be Base64 encoded (byte[])
Ex:
String immutableId = new String(Base64.encodeBase64("someText".getBytes()));
This is expected behavior. The Graph API does not handle the user sync part. User can be synced using Microsoft Azure Active Directory Sync Tool.
Using graph api you can sync the user from azure to our application.
ex : USER_SYNC_QUERY = "https://graph.microsoft.com/v1.0/users?$top=100&$count=true";
1) On each request graph api will send you a #odata.nextLink parameter i.e the skip token for getting next users if more than requested user is present in your azure.
2) By passing the skip token with each request you can sync all the users form azure to your application