# Includables

For endpoints with List requests, the API supports including additional objects that are attached to the selected object

Includables are added to requests as a parameter include=object1,object2

For example, if you want to list all customers but in the same time you want to include customers addresses, this can be done in a single call by including addresses in your request

No need to call /customers then /addresses separately

List of includable objects for each API endpoint is available in the endpoint details in the Attributes table

Sample

  • Without any includable

GET URL/api/customers

API Response

{
  "data": [
    {
      "id": "8d831d65",
      "name": "Hasan Ali",
      "dial_code": 966,
      "phone": "542325489"
    },
    {
      "id": "8d831e26",
      "name": "Ali Hamad",
      "dial_code": 966,
      "phone": "542125489"
    }
  ]
}

  • With including addresses and tags

GET URL/api/customers?include=tags,addresses

API Response

{
  "data": [
    {
      "id": "8d831d65",
      "name": "Hasan Ali",
      "dial_code": 966,
      "phone": "542325489",
      "addresses": [
        {
          "id": "8d92cc27",
          "customer_id": "8d831d65",
          "delivery_zone_id": "8d86ac81-",
          "name": "Work",
          "description": "15688 Kohler Ceceliaville, RI 90603"
        }
      ],
      "tags": [
        {
          "id": "8d830512",
          "type": 1,
          "name": "B2B Customers",
          "pivot": {
            "customer_id": "8d831d65",
            "tag_id": "8d830512"
          }
        }
      ]
    },
    {
      "id": "8d831e26",
      "name": "Ali Hamad",
      "dial_code": 966,
      "phone": "542125489",
      "addresses": [
        {
          "id": "8d92cc27",
          "customer_id": "8d831e26",
          "delivery_zone_id": "8d86ac81-",
          "name": "Home",
          "description": "15688 Kohler Ceceliaville, RI 90603"
        }
      ],
      "tags": [
        {
          "id": "8d830512",
          "type": 1,
          "name": "B2B Customers",
          "pivot": {
            "customer_id": "8d830512",
            "tag_id": "8d830512"
          }
        }
      ]
    }
  ]
}
Last Updated: 14/9/2023, 8:43:17 AM