Skip to content

Commit

Permalink
apiGeneral: calls: clarify internal IDs
Browse files Browse the repository at this point in the history
Also add a header above the section detailing usage of internal IDs for
permalinking.

Change-type: patch
Signed-off-by: Joseph Kogut <[email protected]>
  • Loading branch information
jakogut committed Jul 2, 2021
1 parent 26ecd3e commit ca2a387
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions shared/apiGeneral/calls.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ curl -X GET "{{ $links.apiBase }}/v5/device(<ID>)" \
-H "Authorization: Bearer <AUTH_TOKEN>"
```

## Resource IDs

Many times, however, you won't know the internal ID used by the API, and you'll want to use some other piece of information to find the appropriate resource. In these cases, you can use the `$filter` method to select resources based on any field. For example, if you are looking for a specific device, it's more likely that you'll have the device UUID than the device ID:

```shell
Expand All @@ -57,6 +59,10 @@ curl -X GET \

Notice the construction here: `$filter=` is used to define the field, and then the value is specified after the `eq` keyword. This is the most straightforward example—there are many other ways to build filters, which you can find in the OData documentation.

The resource returned from this call contains the internal ID you can use to make subsequent calls, under the "id" key.

`{"d":[{"id":1234567, ...`

A final tip for constructing API calls: for some of the fields in the API response, a link to another resource is provided rather than the complete information about that resource. For example, if you make a call requesting information about a specific device, the `belongs_to__application` field will return a link to an application, but not all the information about that application. To get all the fields for the application resource, you can use the `$expand` method:

```shell
Expand Down

0 comments on commit ca2a387

Please sign in to comment.