Inclusion of Related Resources
The include
parameter allows you to retrieve related resources in a single request.
This is also known as side-loading and reduces the need for multiple API calls by returning related objects alongside the primary resource.
The response includes a top-level relationships
object containing the related data.
Note
Using include
reduces the number of requests needed to fetch related data and improves performance when working with linked resources.
Include a single related resource
You can include a single related resource by specifying it in the include
parameter.
In this example, each DID record includes its associated voice_in_trunk
resource.
This allows you to retrieve additional details about related resources without sending a separate request:
http
GET /v3/dids?include=voice_in_trunk HTTP/1.1
Host: api.didww.com
Accept: application/vnd.api+json
curl
curl -i -X GET 'https://api.didww.com/v3/dids?include=voice_in_trunk' -H "Accept: application/vnd.api+json"
Include multiple related resources
You can include multiple related resources by separating them with commas.
In this example, both voice_in_trunk
and did_group
are included in the same request.
The response returns each DID along with its trunk and DID group details in a single request:
http
GET /v3/dids?include=voice_in_trunk%2Cdid_group HTTP/1.1
Host: api.didww.com
Accept: application/vnd.api+json
curl
curl -i -X GET 'https://api.didww.com/v3/dids?include=voice_in_trunk%2Cdid_group' -H "Accept: application/vnd.api+json"
Include nested related resources
You can also include relationships of already-included objects.
In this example, the request includes voice_in_trunk
and its related voice_in_trunk_group
:
http
GET /v3/dids?include=voice_in_trunk%2Cvoice_in_trunk_group HTTP/1.1
Host: api.didww.com
Accept: application/vnd.api+json
curl
curl -i -X GET 'https://api.didww.com/v3/dids?include=voice_in_trunk%2Cvoice_in_trunk_group' -H "Accept: application/vnd.api+json"