You need to provide exact matches in the body of the request for the attributes of the units you are looking for.
You can provide either a list of group ids through the group_ids parameter or a list of group external references through the groups_external_refs attribute to filter the list of retrieved units down.
Do not provide both, as this will result in the request failing.
If no group_ids or group_external_refs are specified in the request body, the authenticated user will retrieve unit records for all groups they have access to.
Listed below are common errors that may be returned by the endpoint, along with their corresponding status code.
Status Code - 400
Missing Authorization header
{"error":{"type":"missing_authorization","message":"Your request does not include an 'Authorization' header with a bearer token for your account."}}
Status Code - 401
Expired Authorization header bearer token value
{"error":{"type":"expired_token","message":"The bearer token you have provided in the 'Authorization' header has expired. Please obtain a new one."}}
Status Code - 401
Invalid Authorization header bearer token value
{"error":{"type":"invalid_authorization","message":"The bearer token you have provided in the 'Authorization' header is invalid."}}
Status Code - 400
Returned if both of the group_ids and groups_external_refs attributes are provided
Both group ids and external refs provided for the unit find operation
{"error":{"type":"both_group_identifiers_provided","message":"You have provided both group ids and group external references for the find units operation. Please only provide one of the two."}}
Status Code - 404
Returned if no unit records can be found matching the provided information.
No unit records found for the provided parameters
{"error":{"type":"not_found","message":"There are no unit records matching the information provided."}}
curl--location--request POST 'https://api.travtus.com/units/find/'\--header'Content-Type: application/json'\--header'Authorization: bearer <token>'\--data-raw '{"address":{"country":"United States"},"group_ids":["group-1"],"after-id":1}'