API address, filters and status codes

Look up how the Odigos API works: the address, methods, filters, response format and status codes. If you are new to the API, start with Fetch your first records through the API.

One API per data structure

All data in Odigos is stored in data structures. An administrator sets up an API on a data structure in Orchestra. That API sets:

  • the path you call it on
  • which operations are allowed: read, create, update and delete
  • whether it returns a list or only single records by id
  • which fields you see, and under which name

A data structure can have more than one API. That way you give each system only what it needs.

The address

https://<api-adres>/api/v1.0.0/<pad-van-je-api>

The API address belongs to your organisation and to the environment: acceptance or production. The id of a record is never part of the path. You pass it as ?id=.

The full address is in the OpenAPI description of the API. Open it in Orchestra on the data structure: in the APIs section, click OpenAPI. Use Download YAML to import it into an API tool.

The APIs section of a data structure in Orchestra, with the Add API link and, for the API Duinzicht: offertes lezen, the Edit item, OpenAPI and Remove item buttons.

Methods

MethodWhat it does
GETA list of records
GET with ?id=One record
POSTCreate a record
PUT with ?id=, or with the id in the bodyUpdate a record
DELETE with ?id=Delete a record

If an operation isn't enabled on the API, you get a 404. The API doesn't support PATCH. The id is a number or a uuid, depending on the data structure.

Authenticate with a token

Every call sends a token in the header:

Authorization: Bearer odg_<id>_<geheim>

You issue a token in Sentinel. It can do exactly what its roles allow, per API and per operation. If the token isn't allowed to do something, you get a 403 and the message names the missing permission. To learn how to issue a token, see Issue a token for another system.

An administrator can turn on two exceptions per API:

SettingWhat it does
Public readThe list can be requested without a token, with at most 100 records at a time. Requesting a single record is then not possible. Only available on an API that returns a list and only shows mapped fields.
Public startA POST without a token that only starts a process and stores nothing, optionally with a captcha. For example for a form on a website. Read, update and delete stay closed.

Reading: pages, sorting and counting

ParameterWhat it does
limitHow many records you get. Default 1000, maximum 5000.
offsetHow many records to skip, to page through the list.
sortThe field the list is sorted on. Put a minus in front to sort in descending order, such as sort=-id.
count=1The total of the filtered list is included in totalCount.
count=onlyOnly the total, without records.
resolveLabels=trueFor a reference to another record, the readable name is included too, if the API allows it.
GET /api/v1.0.0/<pad-van-je-api>?limit=100&offset=200&sort=-id

Filters

To filter, use the name of the field as a parameter.

FilterMeaning
veld=waardeEqual to. Repeat the parameter to match one of several values.
veld[neq]=waardeNot equal to
veld[in][]=a&veld[in][]=bOne of these values
veld[nin][]=a&veld[nin][]=bNone of these values
veld[isnull]=1Empty
veld[isnotnull]=1Filled in
veld[gt]=, veld[gte]=Greater than, greater than or equal to. Only on a number or a date.
veld[lt]=, veld[lte]=Less than, less than or equal to. Only on a number or a date.

On a date field, the value can also be a relative date: @vandaag, @begin-week, @begin-maand, @einde-dag, @einde-week, @einde-maand, @laatste-dagen:N, @laatste-weken:N or @laatste-maanden:N.

An unknown filter or sort field returns a 400. Odigos doesn't silently ignore such a parameter.

Which field names do you use?
Use the names from the OpenAPI description of your API. An API can show fields under its own name and hide other fields. A field that isn't listed there returns a 400.

Response format

Every response has the same format. On success, the content is in data: a list for a list, a single object for ?id=.

{
  "status": "success",
  "data": [ ... ],
  "requestid": "...",
  "errors": [],
  "version": "1.0.0"
}

On an error, data is empty and errors says what is wrong. Each error has a fixed code and a message in plain language.

{
  "status": "error",
  "requestid": "...",
  "errors": [
    { "code": "api.unknownfilter", "message": "...", "level": "warn" }
  ],
  "data": null,
  "version": "1.0.0"
}

Keep the requestid. With it, a call can be traced when you ask for help.

Status codes

CodeMeaning
200Success: read, update, delete, or a notification that only starts a process.
201The record was created. The id is in data.id.
400The request isn't valid. For example an unknown field, a wrong type, a missing required field or an unknown filter.
401No token, or the token is invalid, expired or revoked.
403The token isn't allowed to perform this operation on this API.
404There is no API on this path, the operation is turned off, or the record doesn't exist.
409The value conflicts with a unique value or with a reference.
422The content doesn't meet the rules of the data structure. errors lists, for each finding, which field it is and what is wrong.
503A notification that only starts a process couldn't start that process. Nothing was stored, so try again later.

Start processes

A POST on an API can also start a process. The response lists the processes that started in startedProcesses. To learn how to set this up, see Exchange events between Odigos and your system.

See also