Including

Including related resources allows you to retrieve additional data in a single request, rather than making multiple requests to fetch related resources.

Both GET and POST requests to the Wunderite API support including related resources in the response.
Available includes are defined in the object model for each endpoint. They are denoted in the Relation section of the object model.

To include related resources in a request, you can provide a comma-separated list or parameter array of includes in the include query parameter.

# Include the premise and subjects of insurance
include=premise,subjects_of_insurance

# or
include[]=premise&include[]=subjects_of_insurance

Example

In this example, we are loading a list of all buildings in a risk profile, including the premise and subjects of insurance for each building.

curl -G https://app.wunderite.com/api/v1/risks/{risk}/data/buildings \
-H "Authorization: Bearer {token}" \
-H "Accept: application/json" \
-d include=premise,subjects_of_insurance
{
  "data": [
    {
      "object": "building",
      "uuid": "66edc9e0-a056-4f22-bc47-06e81c997458",
      "data": {...},
      "relations": {
        "premise": {
          {"object": "premise", "uuid": "65edc9e0-a056-4f22-bc47-06e81c997458", "data": {...}}
        },
        "subjects_of_insurance": [
          {"object": "subject_of_insurance", "uuid": "64edc9e0-a056-4f22-bc47-06e81c997458", "data": {...}}
        ],
      }
    }
  ]
}