Destination API consumption
A destination comprises one or more endpoints for data retrieval. Each endpoint supports both GET and POST methods. These request methods offer various filtering options, allowing users to customize the response according to their needs. Several query parameters are available, all of which are optional. If no parameters are specified, the API fetches the first 50 results by default.OpenAPI documentation
All destinations provide an OpenAPI URL. This URL allows users to view and test the various endpoints exposed by the destination. The OpenAPI specification URL is formed by combining the destination’s base URL with the suffix ‘/openapi’.Unprotected and protected destinations
A destination can be either unprotected or protected. An unprotected destination is public, meaning it is available to anyone with access to the URL and does not require authentication. Protected destinations, on the other hand, restrict access to authorized users only, ensuring that sensitive data and functionalities are secure. Authentication for protected destinations is done using an access token.Token endpoint
The token endpoint is bundled with the destination and is accessed via a POST request. Upon passing valid credentials, a token is returned. This token remains valid for 24 hours from its creation and can be reused an unlimited number of times within that timeframe.Request payload
The tokens endpoint accepts a JSON payload in the body, consisting of the propertiesclientId and clientSecret. These properties correspond to the identifiers provided by the application used to access the destination.
Response payload
Upon successful authentication of the passed credentials, an access token is returned from the API using the format below.Accessing a protected destination
To access a protected destination API, users must use the obtained access token as a bearer token. The bearer token must be included in the authorization header of every API request, formatted as “Authorization: Beareraccess token”. The API validates this token to verify the application’s identity and permissions, granting access only if the token is valid and unexpired.
Request response compression
Gzip compression is a widely used method for reducing the size of data transmitted over networks, resulting in faster loading times and reduced bandwidth usage. In the context of Occtoo destinations, gzip compression is enabled to further optimize data retrieval processes. However, it is an opt-in feature, meaning callers can enable it by defining the ‘Accept-Encoding’ property in the HTTP header and setting its value to ‘gzip’. This instructs the server to compress the response data before sending it to the caller, enhancing performance and efficiency in data retrieval tasks.Facets
Facets aid in building navigation features by marking certain fields as facets. This allows retrieval of all values for those fields given a filter, along with the total count for each value. When adding a facet, you need to specify the property and the maximum number of facet values to retrieve for that property. Additionally, you can set a localized label for the facet header, which is useful when presenting the values in a UI.Filtering
All properties can be filtered, though the syntax varies depending on the type of property. To see the different types for a specific endpoint, an OpenAPI URL is generated as described in the Documentation section.GET filtering
When using the GET method, all comparisons are performed using the EQUAL operator. It is possible to filter on different properties in a single query, utilizing the AND comparison. Additionally, filtering on multiple values for one property is achieved using an OR comparison.- Filter on two different properties
- Filter on two different values for one property (OR)
POST filtering
Within the POST body, a ‘filter’ can be supplied to reduce the number of returned results. The filter may be empty. However, nested content (object arrays) within each result cannot be filtered. The filter contains a list of queries, any one of which must be fulfilled. Each query may include criteria for inclusion (must), exclusion (must_not), or both. Criteria are expressed as properties of the criteria, where the ID matches the ID of the property in the result. All criteria within the same query must be met.Example
- Must filter on two values
- Must and must not filters combined
Include only results for market “DE” OR “FI”.
- String: Regular string value.
- Datetime: Format yyyy-MM-dd’T’HH:mm:ss.SSSSSSSZ. No UTC conversion is done on the data.
- Integer: Regular integer value.
- Double: Uses ’.’ as a decimal separator.
- Bool: Possible values are true/false.
Example
Alternate query syntax. These queries are the same.Example
Include only results that include tags “A” AND “B”.- GreaterThan
- GreaterThanOrEqual
- LessThan
- LessThanOrEqual
- Between
- BetweenInclusive
Example
- Greater than operator
- Greater than or equal to operator
- Less than operator
- Less than or equal to operator
- Between operator
- Between inclusive operator
Include only results whose price is greater than 15.0.
API query parameters
id
Type: string (array) Get one or multiple entries by ID.- GET
- POST
For the GET request the ID parameter can be repeated to get multiple entries at once.
select
Type: string (array) Return only the specified properties for each entry instead of the full result object. This reduces the response size and is useful when a client only needs a few properties from an endpoint that exposes many. The property names are the ones exposed by the endpoint, meaning the alias if one is configured. If ‘select’ is omitted, all properties configured on the endpoint are returned. For the GET request, the ‘select’ parameter can be repeated to return multiple properties at once. For the POST request, an array of one or more property names is required.- GET
- POST
listIds
Type: boolean This allows for an efficient way to retrieve the IDs of the entries. No additional properties are returned. By default, 50 IDs are returned. If more results are needed, it can be used together with top.- GET
- POST
includeTotals
Type: boolean Includes the total number of results for the query in the response. However, it has a negative impact on request performance that increases with the number of entries.- GET
- POST
includeMeta
Type: boolean Include a ‘meta’ section for each entry in the response. This section contains information about when the entry was last updated, its type, language, and ID. The timestamp is in UTC datetime format.- GET
- POST
top
Type: int32 Retrieve the top x number of entries from the endpoint. This can be used together with skip for implementing pagination. The maximum number of entries to retrieve with ‘top’ and ‘skip’ is 10 000.- GET
- POST
skip
Type: int32 Skip x number of entries in the request. This can be used together with top for implementing pagination. The maximum number of entries to retrieve with ‘top’ and ‘skip’ is 10 000.- GET
- POST
after
Type: string (array) ‘After’ is used together with sorting and allows for getting the entries after the provided value for the specified sorting property. It can be used together with either sortAsc or sortDesc. By default, 50 entries are returned. If more results are needed, it can be used together with top. A maximum of 10 000 entries can be returned from ‘top’.- GET
- POST
sortAsc
Type: string (array) To sort a property in ascending order, use the ‘sortAsc’ parameter. For the GET request, the ‘sortAsc’ parameter can be repeated to sort on multiple properties at once. For the POST request, an array of one or more sort properties is required.- GET
- POST
sortDesc
Type: string (array) To sort a property in descending order, use the ‘sortDesc’ parameter. For the GET request, the ‘sortDesc’ parameter can be repeated to sort on multiple properties at once. For the POST request, an array of one or more sort properties is required.- GET
- POST
language
Type: string Specify requested language.- GET
- POST
search
Type: string (array) To search property values matching the specified phrase, use the ‘search’ parameter. This is used together with ‘searchOn’ to specify which properties to search on. It matches the entire search phrase, but the character ’*’ can be used for wildcard search. For instance, ‘*value’ is equivalent to ‘ends with value’, ‘value*’ is equivalent to ‘begins with value’, and ‘*value*’ is equivalent to ‘contains value’. For the GET request, the ‘search’ parameter can be repeated to search on multiple phrases at once. For the POST request, an array of one or more search properties is required. If multiple phrases are provided, they will be combined using AND logic.- GET
- POST
searchOn
Type: string (array) To specify the properties to search on, use the ‘searchOn’ parameter. For the GET request, the ‘searchOn’ parameter can be repeated to search on multiple properties at once. For the POST request, an array of one or more search properties is required.- GET
- POST
caseInsensitiveSearch
Type: boolean By default, the search is case sensitive. To perform a case insensitive search, set the flag ‘caseInsensitiveSearch’ to true.- GET
- POST
periodSince
Type: datetime Retrieve all entries modified after the provided timestamp. All times are compared using UTC in the format yyyy-MM-dd’T’HH:mm:ss.SSSSSSSZ.- GET
- POST
periodBefore
Type: datetime Retrieve all entries modified before the provided timestamp. All times are compared using UTC in the format yyyy-MM-dd’T’HH:mm:ss.SSSSSSSZ.- GET
- POST
API response
The structure of the response object remains consistent whether it’s a POST or a GET request. It always includes the language being retrieved and an array of result objects. If there are no results, an empty array is returned. The result objects vary between endpoints and destinations, as they are configured individually. To view the structure of a specific endpoint, an OpenAPI URL is generated, as described in the OpenAPI documentation section. If the API parameterselect is used, each result object contains only the requested properties.
If the endpoint contains facets, they are included as an array. The structure of the facet response is described under facets. If facets are not configured, the “facets” property is omitted from the response.
The “total” property indicates the total number of results and is only included in the response if the API parameter includeTotals is present and set to true. If the parameter is not present, the “total” property is omitted from the response.