What values are expected in the returnFields array of the /api/v2/users/search

What or how should returnFields values be formatted to return only id and name?

{
"sortOrder": "ASC",
"sortBy": "name",
"returnFields": "id"
}

Per POST /api/v2/users/search, the returnFields property is an array of strings. Try "returnFields": [ "id" ]

Hi Tim,

I just tested with the below body and it still returned all of the fields. I am correct to assume it should only return ID's correct?

{
"sortOrder": "ASC",
"sortBy": "name",
"returnFields": [ "id" ]
}

There's actually an open issue (SRCH-1051) to address this. The issue is that the documentation for the search request is incorrect; the returnFields property isn't supported on this resource. The only search you can use it with is POST /api/v2/search. The typed searches (like /api/v2/users/search) will return the full entities that match the query.

edit: This body for POST /api/v2/search will yield the results you're looking for:

{
  "sortOrder": "ASC",
  "sortBy": "name",
  "returnFields": [
    "id",
    "name"
  ],
  "types": [
    "users"
  ]
}

Note that in this request, the field name id is actually an alias for guid, which you will see in the response.

Is /api/v2/search exposed in the Developer Tools API explorer?

I found it and that works Thanks! Is there a different place for usage that I should reference to get a better understanding of what key words etc to use?

The possible values for returnFields are "self-documenting". Make a request to POST /api/v2/search with the body below to get a full object back. You can use any property name on the entity and can drill down by specifying a field like contactInfo.chat, though you can't drill down into arrays (contactInfo.chat[0]._id isn't valid).

{
  "types": ["users"],
  "returnFields":["ALL_FIELDS"],
  "pageSize": 1
}

edit: SRCH-1121 has been created to add ALL_FIELDS to the documentation for the returnFields property on POST /api/v2/search.