Working with users

With the Admin API, authorized callers can create, update, and retrieve system user data through the /admin/v1/users endpoints.

Querying for users

Authorized callers can query for a user through the /admin/v1/users/{userId} endpoint. Calls to this endpoint return a User resource:

{
    "data": {
        "attributes": {
            "active": true,
            "displayName": "Paulette Benson",
            "externalUser": false,
            "firstName": "Paulette",
            "id": "pc:101",
            "lastName": "Benson",
            "organization": {
                "displayName": "Enigma Fire & Casualty",
                "id": "systemTables:1",
                "type": "Organization",
                "uri": "/admin/v1/organizations/systemTables:1"
            },
            "useOrgAddress": true,
            "useProducerCodeSecurity": false,
            "userType": {
                "code": "underwriter",
                "name": "Underwriter"
            },
            "username": "pbenson",
            "vacationStatus": {
                "code": "atwork",
                "name": "At work"
            },
            "workPhone": {
                "displayName": "213-555-8164",
                "number": "2135558164"
            }
        },
        . . .
    }
}

In order to expose the GET /admin/v1/users/{userId} endpoint, the GET /admin/v1/users collection must also be exposed. However, the latter endpoint is not filterable or sortable, and can possibly return many pages. In light of this limitation, querying the users collection for a specific user can require an unknown number of calls. Thus Guidewire recommends that callers do not use the /admin/v1/users collection to find a specific user.

Creating users

Authorized callers can create users. To create a user, callers can submit a POST request to the /admin/v1/users endpoint.

At minimum, the request body must contain a value for the username field:

{
  "data": {
    "attributes": {
      "firstName": "Alfred",
      "lastName": "Martin",
      "username": "amartin"
    }
  }
}

The call returns a User resource for the new user:

{
    "data": {
        "attributes": {
            "active": true,
            "displayName": "Alfred Martin",
            "externalUser": false,
            "firstName": "Alfred",
            "id": "pc:203",
            "lastName": "Martin",
            "organization": {
                "displayName": "Enigma Fire & Casualty",
                "id": "systemTables:1",
                "type": "Organization",
                "uri": "/admin/v1/organizations/systemTables:1"
            },
            "useOrgAddress": true,
            "useProducerCodeSecurity": false,
            "userType": {
                "code": "other",
                "name": "Other"
            },
            "username": "amartin",
            "vacationStatus": {
                "code": "atwork",
                "name": "At work"
            }
        },
        . . .
    }
}

Updating users

Authorized callers can update users. To update a user, callers can submit a PATCH request to the /admin/v1/users/{userId} endpoint.