UserSearch resource (Data API 23.2)

Summary

Http Method Resource Description
POST /user_search Searches for users.

The query attribute specifies a complex query that can be used to narrow down the search. These are the list of searchable attributes:

  • login - String
  • email - String
  • first_name - String
  • last_name - String
  • external_id - String
  • last_login_date - Date
  • is_locked - Boolean
  • is_disabled - Boolean

The output of the query can also be sorted. These are the list of sortable attributes:

  • login - String
  • email - String
  • first_name - String
  • last_name - String
  • external_id - String
  • last_login_date - Date

Search users

Searches for users.

The query attribute specifies a complex query that can be used to narrow down the search. These are the list of searchable attributes:

  • login - String
  • email - String
  • first_name - String
  • last_name - String
  • external_id - String
  • last_login_date - Date
  • is_locked - Boolean
  • is_disabled - Boolean

The output of the query can also be sorted. These are the list of sortable attributes:

  • login - String
  • email - String
  • first_name - String
  • last_name - String
  • external_id - String
  • last_login_date - Date

Url

POST https://hostname:port/dw/data/v23_2/user_search

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Request Document

SearchRequest

Response Document

UserSearchResult

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 MalformedSearchParameterException   Thrown if the query is ill-formed.

Sample

REQUEST:
POST /s/-/dw/data/v23_2/user_search HTTP/1.1
Host: example.com
Authorization: Bearer b6104653-d53c-4175-a23d-52f118732ed5
Accept: application/json

{
    "query": {
        "text_query": {
            "fields": [
                "login"
            ],
            "search_phrase": "Dude"
        }
    },
    "select": "(**)"
}

# in case of success:

RESPONSE:
HTTP/1.1 200 OK
Content-Length: 432
Content-Type: application/json; charset=UTF-8

{
    "_v" : "23.2",
    "_type": "user_search_result",
    "count": 1,
    "hits": [
        {
            "_type": "user",
            "disabled": false,
            "email": "[email protected]",
            "external_id": "e2b07841-1db0-a5c1-9a1f-f6a02b6fa25c",
            "first_name": "Ocapi",
            "last_login_date": "2017-01-11",
            "last_name": "SiteGenesisDude",
            "locked": false,
            "login": "SiteGenesisDude",
            "preferred_data_locale": "default",
            "preferred_uilocale": "default"
        }
    ],
    "query": {
        "text_query": {
            "_type": "text_query",
            "fields": [
                "login"
            ],
            "search_phrase": "Dude"
        }
    },
    "select": "(**)",
    "start": 0,
    "total": 1
}

# in case of failure:

RESPONSE:
HTTP/1.1 400 Bad Request
{
    "_v" : "23.2",
    "fault": {
        "type": "ExternalIdNotAllowedException",
        "message": "Attribute 'external_id' is not allowed with the current server settings."
    }
}
X OCAPI versions 15.x and 16.x will be retired on March 31, 2021. For dates and more information, see the OCAPI versioning and deprecation policy and this Knowledge Article.
Notifications pending to read 9