1
votes

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

1
What do domain details refer to?Tony Ju
User assign to particular domain . I may get details from entity. But how to claim entity using api callArif
Is onPremisesDomainName value what you need?Tony Ju
You can find all the properties of the user by using beta version api. graph.microsoft.com/beta/me. If you need some specific properties, you can use $select like this https://graph.microsoft.com/v1.0/me?$select=displayName,onPremisesDomainName Tony Ju
Ok , I can get all details at ` graph.microsoft.com/v1.0/me` . Is It possible ??Arif

1 Answers

1
votes

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.