> For the complete documentation index, see [llms.txt](https://docs.api.intratool.de/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.api.intratool.de/introduction/query-manipulation/result-control.md).

# Result Control

## Introduction

This section describes how you can control the quantity of information provided in responses of the intratool API.

## Includes

If an object has related content, you can request this data without firing additional requests.

The structure to apply includes is as follows:

* `{route}` - The endpoint you want to retrieve data of
* `?include` - To identify the incoming URL parameter
* `{relations}` - Relation identifiers are separated by `|`

<mark style="color:green;">`GET`</mark> `/api/{route}?include={relations}`

{% hint style="info" %}
You can combine includes with selects. Just add the fields to select separated by a `:`.

`relation:field1,field2`
{% endhint %}

{% hint style="warning" %}
If you include a relation and also pass **selects**, make sure to select the field that represents the relation - otherwise the included relation can not be resolved.
{% endhint %}

## Selects

Selects can be used to control which fields of an entity should be returned by our API.

The structure to apply select fields is as follows:

* `{route}` - The endpoint you want to retrieve data of
* `?select` - To identify the incoming URL parameter
* `{selects}` - Field keys to include are separated by `,`

<mark style="color:green;">`GET`</mark> `/api/{route}?select={selects}`

## Limiting

Limiting can be used to control how many records are returned by our API.

The structure to apply a limit is as follows:

* `{route}` - The endpoint you want to retrieve data of.
* `?limit` - To identify the incoming URL parameter
* `{value}` - The limit value.

<mark style="color:green;">`GET`</mark> `/api/{route}?limit={value}`

## Sorting

Sorting can be used to define the order of the records returned by our API.

The structure to apply an ordering is as follows:

* `{route}` - The endpoint you want to retrieve data of.
* `?sort` - To identify the incoming URL parameter
* `{fields}` - Field keys for sorting separated by `,`. To order descending, prefix field keys with `-`.

<mark style="color:green;">`GET`</mark> `/api/{route}?sort={fields}`

## WithCount

The withCount can be used to get the count of related objects for relation fields instead of object information.

The structure to apply a withCount is as follows:

* `{route}` - The endpoint you want to retrieve data of.
* `?withCount` - To identify the incoming URL parameter
* `{relations}` - The relation identifiers to get a count for separated by `|`

<mark style="color:green;">`GET`</mark> `/api/{route}?withCount={relations}`

## Appends

Appends can be used to include additional computed fields in API responses.

The structure to apply top-level appends is as follows:

* `{route}` - The endpoint you want to retrieve data of.
* `?appends` - To identify the incoming URL parameter
* `{fields}` - Append field keys separated by `,`

<mark style="color:green;">`GET`</mark> `/api/{route}?appends={fields}`

Example:

<mark style="color:green;">`GET`</mark> `/api/forms/1?appends=hash`

You can also apply appends to included relations using include-options:

* `{relation}:[appends=field1+field2]`

Example:

<mark style="color:green;">`GET`</mark> `/api/forms/1?include=formFields:[appends=field_validation_string]`

{% hint style="info" %}
For top-level `appends`, fields are separated by `,`.

For relation include-options (`[appends=...]`), fields are separated by `+`.
{% endhint %}

{% hint style="warning" %}
If appended fields depend on attributes that are excluded by `select`, appended output can be incomplete.
{% endhint %}
