UserSearch resource (Data API 19.8)

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:

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

Url

POST https://hostname:port/dw/data/v19_8/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/v19_8/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": "19.8",
    "_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": "19.8",
    "fault": {
        "type": "ExternalIdNotAllowedException",
        "message": "Attribute 'external_id' is not allowed with the current server settings."
    }
}