Filters

Filtering allows you to limit API results to specific criteria.

The Contractors Cloud REST API supports adding various "filters" when making your requests. These filters come in handy when making a GET call that returns multiple resources. Filters can be applied as query parameters in your request.

Each entity / resource provided by this API has a defined list of allowed filters you can use. To determine what filters are available for a specific entity / resource, checkout the corresponding type documentation for it.

Syntax

To utilize filters correctly, filters must be included as query parameters in your requests. All filter names must be inclosed with filter[KEY].

Filter example

Here's an example scenario, you want to get a list of all projects that belong to a specific Company, Account, and that also match the search term "John". To achieve this, your API request would look like the following:

GET : /api/v1/projects?filter[company_id]=6&filter[account_id]=12&filter[search]=John

As you can see from above, multiple filters can be applied on the same request. Additionally, multiple values can also be applied to some but not all filters:

GET : /api/v1/projects?filter[company_id]=6,8,9

...would return a listing of projects that belong to any of the Companies with an id of 6, 8 or 9.

As mentioned earlier, consult the "Allowed filters" section for the resource you need for the list of available filters you can use for each entity / resource.