Query parameters

Search requests

Search requests are GET requests where multiple documents of a resource are returned in an array. e.g. the get companies endpoint. These endpoints have the ability to add offset and filters to the query parameters. The maximum number of documents that will be returned is 100. To gather more than 100 documents, use the offset request.

By default, the results are sorted by the _meta.created field, which is the timestamp of when a document was created.

For a faster response, use a GET request with the guid in the endpoint's path, like the get company endpoint. In most cases, this will return the document from cache.

Parameters

The following query parameters can be used while performing a search request.

Property

Type

Contract

Description

offset

integer

optional

Search offset, which skips the entered number of documents.

sort

string

optional

Defines the field that is used for sorting the returned results, including an optional asc / desc. By default desc is used.

filter

any

optional

Filter results based on field, type and value.

format

string

optional

Response format can be changed to datatable, which provides a response with more information.

Sort parameter

The sort parameter has the following pattern:

sort=<field>|<order>
  • Field Defines the field that will be used to sort.

  • Order Defines the way it should be ordered. By default desc is used. Supported values are:

    • asc = ascending

    • desc = descending

Filter parameter

The filter parameter has the following pattern:

filter[<field>|<type>]=<value>
  • Field Defines the field that will be user to filter.

  • Type Defines the type of filter that will be used, By default eq is used. See below for supported filter types.

  • Value The value of the filter itself.

The following filter types are supported:

Filter type

Type

Description

eq

any

Returned results are equal to value. Multiple values can be separated by a comma (,)

neq

any

Returned results are not equal to value.

Multiple values can be separated by a comma (,).

lt

number

Returned results are lower than value.

lte

number

Returned resulsts are lower than -or equal to- value.

gt

number

Returned resulsts are greater than value.

gte

number

Returned results are greater than - or equal to- value.

Datatable format

The format=datatable query parameter will change the response to a datatable format.

Example of the datatable format:

{
  "total": 250,
  "per_page": 100,
  "current_page": 1,
  "last_page": 3,
  "from": 1,
  "to": 100,
  "data": [
    // Documents
  ]
}

The datatable format requires extra query parameters, as described below.

Property

Type

Contract

Description

page

integer

required

The requested page of the datatable, which will set the offset based on the per_page property.

per_page

integer

required

Number of results per page, with a maximum of 100.

Last updated

Was this helpful?