Reputation: 195
I want to get domain details from “Entity” calling Azure API.
I used :
https://login.microsoftonline.com/<--tid-->/oauth2/v2.0/authorize --> For authorization https://login.microsoftonline.com/<--tid-->/oauth2/v2.0/token --> For Token
https://graph.microsoft.com/v1.0/me/ --> Using token and api I got userdata.
Now I need domain details of perticular user, Please help me.
Here I use curl call to get userdata. My code :
$ch1 = curl_init();
curl_setopt($ch1 , CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch1, CURLOPT_HTTPHEADER, array('Authorization: Bearer '.$access_token));
curl_setopt($ch1, CURLOPT_URL, 'https://graph.microsoft.com/v1.0/me/');
$result1 = curl_exec($ch1);
I go Json response :
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
"businessPhones": [],
"displayName": "<displayName>",
"givenName": "<givenName>",
"jobTitle": "<jobTitle>",
"mail": "<mail_id>",
"mobilePhone": "<mobilePhone>",
"preferredLanguage": null,
"surname": "<surname>",
"userPrincipalName": "<userPrincipalName>",
"id": "<some_id>"
}
Is there Any way to get domain details inside this response or I have to call another API for it
Upvotes: 1
Views: 184
Reputation: 15619
You can use $select to get onPremisesDomainName
property like this
https://graph.microsoft.com/v1.0/me?$select=displayName,onPremisesDomainName
Refer to this document for more details.
Upvotes: 1