Path parameters

This section explains:

  • What path parameters are
  • How to structure API calls that use path parameters



What are path parameters?

Path parameters are variable elements of a URL that you use to identify a specific resource in a collection. This allows you to send an API call that refers to a specific resource, rather than a collection of resources. For example, if you want to retrieve information about a specific user, rather than every user on the account, a path parameter allows you to do this. 

Where an endpoint accepts a path parameter, it is denoted in its URL between a pair of braces {}. For example, /users/{userId} indicates that the endpoint accepts a path parameter called userId. When you make an API call, you replace the braces and the placeholder inside the braces with the value you want to refer to.

A path parameter normally refers to a resource by its unique identifier. For example, if you want to refer to a user with a userId of "20", the request URL would be /users/20. It is also possible for a URL to contain multiple path parameters, for example: /client/{clientId}/department/{departmentId}/employees.



Call structure

API URLs use placeholders to help you structure your calls. To structure your call, you need to replace the resource identifiers with values from your account.

For example: 

Example of a Path Parameter URL
https://api.iot-x.com/subscriber-groups/{subscriberGroupId}

This example includes one primary resource (subscriber-groups) and one resource identifier (subscriberGroupId).

When you replace the resource identifier with a real value from your account, the URL will look like this:

Example of a Structured Path Parameter URL
https://api.iot-x.com/subscriber-groups/99