Getting Organization Users

In this article

    You can get a resource representation of organization users.

    Request

    GET https://<hostname>:4443/v5/Organizations/{organizationId}/Users?displayName=<display_name/name>&username=<user_name>

    Request Headers

    The request header must contain an authorization token of the current session.

    Request Parameters

    The following parameters must be specified in the URL of the request:

    Parameter

    Type

    Description

    organizationId

    string

    Specifies the identification number of the Office 365 organization. For more information on how to get this parameter, see Getting Organizations.

    displayName

    string

    A user name.

    username

    string

    An email address of the user.

    Request Body

    None.

    Response

    The server returns the following response to the client.

    Response Codes

    A successfully completed operation returns a response code 200 OK.

    Response Headers

    The response to this request contains the following headers. The response may also include additional standard HTTPS headers.

    Header

    Description

    Content-length

    The length of the response body.

    Content-type

    The media type and syntax of the response body message: application/json; charset=utf-8

    Response Body

    In the response body, the server returns a resource representation of the /Organizations/{organizationId}/Users resource.

    Examples

    Example 1

    The following example shows how to get a list of users by the organization ID.

    Request:

    GET https://abc.tech.local:4443/v5/Organizations/92460656-7a85-4a04-b1af-1ea903c0bc2e/Users

     

    Request Header:

    Authorization: Bearer <Access-Token>

     

    Response:

    200 OK

     

    Response Body:

    [

      [

         {

            "id":"221fecc1-95f3-4da8-8ed2-101143dc117a00000000-0000-0000-0000-000000000000",

            "displayName":"Mailbox Test",

            "name":"mailboxtest@backup.onmicrosoft.com",

            "type":"User",

            "_links":{

               "self":{

                  "href":"https://abc.tech.local:4443/v5/organizations/92460656-7a85-4a04-b1af-1ea903c0bc2e/users/221fecc1-95f3-4da8-8ed2-101143dc117a00000000-0000-0000-0000-000000000000"

               },

               "organization":{

                  "href":"https://abc.tech.local:4443/v5/organizations/92460656-7a85-4a04-b1af-1ea903c0bc2e"

               },

               "onedrives":{

                  "href":"https://abc.tech.local:4443/v5/organizations/92460656-7a85-4a04-b1af-1ea903c0bc2e/users/221fecc1-95f3-4da8-8ed2-101143dc117a00000000-0000-0000-0000-000000000000/onedrives"

               }

            }

         }

      ]

    ]

    Example 2

    The following example shows how to get information about a user by the organization ID and the username filter parameter.

    Request:

    GET https://abc.tech.local:4443/v5/Organizations/4111916c-3a82-4b0b-8d92-13cc1c797bc7/Users?username=administrator@abc.onmicrosoft.com

     

    Request Header:

    Authorization: Bearer <Access-Token>

     

    Response:

    200 OK

     

    Response Body:

    {

      "offset": 0,

      "limit": 30,

      "results": [   {

         "id": "221fecc1-95f3-4da8-8ed2-101143dc117a00000000-0000-0000-0000-000000000000",

         "displayName": "Administrator",

         "name": "administrator@abc.onmicrosoft.com",

         "type": "User",

         "_links":       {

            "self": {"href": "https://abc.tech.local:4443/v5/organizations/4111916c-3a82-4b0b-8d92-13cc1c797bc7/users/221fecc1-95f3-4da8-8ed2-101143dc117a00000000-0000-0000-0000-000000000000"},

            "organization": {"href": "https://abc.tech.local:4443/v5/organizations/4111916c-3a82-4b0b-8d92-13cc1c797bc7"},

            "onedrives": {"href": "https://abc.tech.local:4443/v5/organizations/4111916c-3a82-4b0b-8d92-13cc1c797bc7/users/221fecc1-95f3-4da8-8ed2-101143dc117a00000000-0000-0000-0000-000000000000/onedrives"}

         }

      }],

      "_links": {"self": {"href": "https://abc.tech.local:4443/v5/Organizations/4111916c-3a82-4b0b-8d92-13cc1c797bc7/users?username=administrator@abc.onmicrosoft.com&offset=0&limit=30&setid=fc69a726-fe38-4744-a24d-e3be3eabefe3"}}

    }

    Example 3

    The following example shows how to get information about a user by the organization ID and the displayName (or name) filter parameter.

    Request:

    GET https://abc.tech.local:4443/v5/Organizations/4111916c-3a82-4b0b-8d92-13cc1c797bc7/Users?displayName=Administrator

     

    Request Header:

    Authorization: Bearer <Access-Token>

     

    Response:

    200 OK

     

    Response Body:

    {

      "offset": 0,

      "limit": 30,

      "results": [   {

         "id": "a87bf604-be11-46ed-b1c6-ce351acda26c00000000-0000-0000-0000-000000000000",

         "displayName": "Administrator",

         "name": "administrator@abc.onmicrosoft.com",

         "type": "User",

         "_links":       {

            "self": {"href": "https://abc.tech.local:4443/v5/organizations/4111916c-3a82-4b0b-8d92-13cc1c797bc7/users/a87bf604-be11-46ed-b1c6-ce351acda26c00000000-0000-0000-0000-000000000000"},

            "organization": {"href": "https://abc.tech.local:4443/v5/organizations/4111916c-3a82-4b0b-8d92-13cc1c797bc7"},

            "onedrives": {"href": "https://abc.tech.local:4443/v5/organizations/4111916c-3a82-4b0b-8d92-13cc1c797bc7/users/a87bf604-be11-46ed-b1c6-ce351acda26c00000000-0000-0000-0000-000000000000/onedrives"}

         }

      }],

      "_links": {"self": {"href": "https://abc.tech.local:4443/v5/Organizations/4111916c-3a82-4b0b-8d92-13cc1c797bc7/users?displayname=Administrator&offset=0&limit=30&setid=3554bdf5-1f9d-491b-91cf-0b8c215713a3"}}

    }