Most Wristband APIs allow you to specify which fields you want returned in the API response.
If you don't need the full representation of a Wristband resource or entity, you can leverage the fields
query parameter to filter the response body fields accordingly. This minimizes network traffic and latency, potentially improving your application's performance.
Fields Query Parameter
The fields
query parameter takes a comma-separated list of fields to include. Only the specified fields will be returned in the API response.
Default Fields
By default, if you omit thefields
query parameter, all possible fields for a resource are returned in the API response.
For example, making a request to the Get User API:
GET https://yourapp-yourcompany.us.wristband.dev/api/v1/users/123?fields=id,givenName,lastName HTTP/2.0
Accept: application/json
You would see a response like:
{
"id": "x63nnomvwrgqhgd2ofpdt3uk5e",
"givenName": "Bob",
"familyName": "Smith"
}
Nested Fields
Certain Wristband resources exhibit multiple levels of JSON nesting within their object structure. You can selectively include specific fields within these nested objects to tailor the response.
For example, making a request to the Get Identity Provider API:
GET https://yourapp-yourcompany.us.wristband.dev/api/v1/identity-providers/123?fields=id,name,protocol.type,protocol.clientId HTTP/2.0
Accept: application/json
You would see a response like:
{
"id": "tdl4upi3tvbdji7nmtjuad4wym",
"name": "ent:okta:employees",
"protocol": {
"type": "OAUTH2",
"clientId": "0oaee7yko4TDgzGY85d7"
}
}