Get User Based on His Unique Identificator

Last modified 13 Mar 2024 13:32 +01:00
Table of Contents

Description

Example of retrieving identity data from a web resource object representing a user.

For the purpose of the sample we are using the CURL tool as it is a well maintained, well tested, and it’s widely accessible.

Authentication methods used to work with the REST api

Authentication methods

Example

In our examples we are authenticating with the credentials, name "administrator" and password "y0uR_P455woR*d" on a localhost instance running on port 8080.

For some help regarding the REST examples please see this link:

Get default administrator object
# Authenticating with the credentials "administrator" and password "5ecr3t" on a localhost instance running on port 8080
curl --user administrator:5ecr3t -X GET http://localhost:8080/midpoint/ws/rest/users/00000000-0000-0000-0000-000000000002
Get Object in JSON format
# Authenticating with the credentials "administrator" and password "5ecr3t" on a localhost instance running on port 8080
curl --user administrator:5ecr3t -H "Accept: application/json" -X GET http://localhost:8080/midpoint/ws/rest/users/00000000-0000-0000-0000-000000000002
Get Object in JSON format with the Raw option set to true
curl --user administrator:y0uR_P455woR*d \
-H "Accept: application/json" \
-X GET http://localhost:8080/midpoint/ws/rest/users/00000000-0000-0000-0000-000000000002?options=raw \
-v
Show JSON Example

The example is simplified, some properties were removed to keep the example output "short". This example does not contain all possible properties of this object type.

{
  "user" : {
    "oid" : "00000000-0000-0000-0000-000000000002",
    "name" : "administrator",
    "indestructible" : true,
    "assignment" : [ {
      "@id" : 1,
      "identifier" : "superuserRole",
      "targetRef" : {
        "oid" : "00000000-0000-0000-0000-000000000004",
        "relation" : "org:default",
        "type" : "c:RoleType"
      },
      "activation" : {
        "effectiveStatus" : "enabled"
      }
    }, {
      "@id" : 2,
      "identifier" : "archetype",
      "targetRef" : {
        "oid" : "00000000-0000-0000-0000-000000000300",
        "relation" : "org:default",
        "type" : "c:ArchetypeType"
      },
      "activation" : {
        "effectiveStatus" : "enabled"
      }
    } ],
    "iteration" : 0,
    "iterationToken" : "",
    "archetypeRef" : {
      "oid" : "00000000-0000-0000-0000-000000000300",
      "relation" : "org:default",
      "type" : "c:ArchetypeType"
    },
    "roleMembershipRef" : [ {
      "oid" : "00000000-0000-0000-0000-000000000300",
      "relation" : "org:default",
      "type" : "c:ArchetypeType"
    }, {
      "oid" : "00000000-0000-0000-0000-000000000004",
      "relation" : "org:default",
      "type" : "c:RoleType"
    } ],
    "credentials" : {
      "password" : {
        "value" : {
          "clearValue" : "5ecr3t"
      }
    },
    "fullName" : "midPoint Administrator",
    "givenName" : "midPoint",
    "familyName" : "Administrator"
  }
}
}
Was this page helpful?
YES NO
Thanks for your feedback