Logo

Services & Tools

  • Phone Numbers
  • Voice
  • SMS
  • Cloud Phone System
  • Logs & Analytics
  • Identities & Addresses
  • Billing
  • Account Settings
  • Network Infrastructure
  • Glossary

Development Tools

  • API Documentation
    • Getting Started
    • Use Case Examples
    • Specification
      • Sorting
      • Pagination
      • Filters
      • Inclusion of Related Resources
      • Headers
      • Assigning Related Resources
        • Updating to-one relationships
        • Updating to-many relationships
      • Error Objects
    • API Versioning
    • Version (Latest) 2022-05-10
    • Version 2021-12-15
    • Version 2021-04-19
    • Version 2017-09-18
  • Call Events

Integrations

  • Microsoft Teams Direct Routing
  • Amazon Chime SDK
  • Asterisk
  • Twilio
  • Avaya
  • Ribbon
  • Telinta
  • Zapier
  • Pabbly
  • Genesys Cloud CX
  • FreePBX
  • DIDWW Prometheus Exporter
DIDWW
  • API Documentation
  • Specification
  • Assigning Related Resources

Assigning Related Resources

You can manage relationships between resources using the PATCH methods. Relationships can be either to-one (a single related resource) or to-many (multiple related resources).

Important

  • Use PATCH to replace or remove relationships.

  • Servers may return 403 Forbidden if complete replacement is not allowed.



Updating to-one relationships

Use a PATCH request to update a to-one relationship.

This request updates the trunk assigned to a DID:

http

PATCH /v3/dids/f10d40c7-fd0b-4d63-bb9b-27810a1a8f5c HTTP/1.1
Host: api.didww.com
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
  "data": {
    "type": "dids",
    "id": "f10d40c7-fd0b-4d63-bb9b-27810a1a8f5c",
    "relationships": {
      "trunk": {
        "data": { "type": "trunks", "id": "d9b6ec47-0b72-452b-b4b4-23dd9d5be7e6" }
      }
    }
  }
}

curl

curl -i -X PATCH https://api.didww.com/v3/dids/f10d40c7-fd0b-4d63-bb9b-27810a1a8f5c -H "Accept: application/vnd.api+json" -H "Content-Type: application/vnd.api+json" --data-raw '{"data": {"id": "f10d40c7-fd0b-4d63-bb9b-27810a1a8f5c", "relationships": {"trunk": {"data": {"id": "d9b6ec47-0b72-452b-b4b4-23dd9d5be7e6", "type": "trunks"}}}, "type": "dids"}}'

This request clears the trunk relationship by setting it to null:

http

PATCH /v3/dids/f10d40c7-fd0b-4d63-bb9b-27810a1a8f5c HTTP/1.1
Host: api.didww.com
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
  "data": {
    "type": "dids",
    "id": "1e0c45b1-1fea-4552-b41b-ffa9f5eb44c5",
    "relationships": {
      "trunk": {
        "data": null
      }
    }
  }
}

curl

curl -i -X PATCH https://api.didww.com/v3/dids/f10d40c7-fd0b-4d63-bb9b-27810a1a8f5c -H "Accept: application/vnd.api+json" -H "Content-Type: application/vnd.api+json" --data-raw '{"data": {"id": "1e0c45b1-1fea-4552-b41b-ffa9f5eb44c5", "relationships": {"trunk": {"data": null}}, "type": "dids"}}'

Updating to-many relationships

Use PATCH to replace all members of a to-many relationship or clear them.

http

PATCH /v3/dids/f10d40c7-fd0b-4d63-bb9b-27810a1a8f5c HTTP/1.1
Host: api.didww.com
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
  "data": {
    "id": "714e8148-0aea-4cb6-8680-bd1d06453418",
    "type": "trunk_groups",
    "relationships": {
      "trunks": {
        "data": [
          { "type": "trunks", "id": "ca7da6d0-aa0b-447d-8fc0-1bc58b51298c"},
          { "type": "trunks", "id": "e9c1b7e9-253b-46c8-b7e9-5a930ab594c5" }
        ]
      }
    }
  }
}

curl

curl -i -X PATCH https://api.didww.com/v3/dids/f10d40c7-fd0b-4d63-bb9b-27810a1a8f5c -H "Accept: application/vnd.api+json" -H "Content-Type: application/vnd.api+json" --data-raw '{"data": {"id": "714e8148-0aea-4cb6-8680-bd1d06453418", "relationships": {"trunks": {"data": [{"type": "trunks", "id": "ca7da6d0-aa0b-447d-8fc0-1bc58b51298c"}, {"type": "trunks", "id": "e9c1b7e9-253b-46c8-b7e9-5a930ab594c5"}]}}, "type": "trunk_groups"}}'

http

PATCH /v3/dids/f10d40c7-fd0b-4d63-bb9b-27810a1a8f5c HTTP/1.1
Host: api.didww.com
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
  "data": {
    "id": "c07815fc-bf9e-4cbf-a3fc-9c99b8de14d8",
    "type": "trunk_groups",
    "relationships": {
      "trunks": {
        "data": []
      }
    }
  }
}

curl

curl -i -X PATCH https://api.didww.com/v3/dids/f10d40c7-fd0b-4d63-bb9b-27810a1a8f5c -H "Accept: application/vnd.api+json" -H "Content-Type: application/vnd.api+json" --data-raw '{"data": {"id": "c07815fc-bf9e-4cbf-a3fc-9c99b8de14d8", "relationships": {"trunks": {"data": []}}, "type": "trunk_groups"}}'
Previous Next

© Copyright DIDWW Ireland Limited. Last updated on Aug 12, 2025.