API basics¶
These conventions apply to the whole API. The current version is /v4, which this documentation describes. See
API versions for /v3 and /v3-beta.
Interactive documentation¶
Every running installation serves its own API documentation:
| What | Where |
|---|---|
| Swagger UI | /swagger-ui/index.html |
OpenAPI description of /v4 |
/v3/api-docs/v4 |
Authentication¶
MarmotGraph uses OpenID Connect. Log in at the identity provider of your installation, then pass the access token with every request:
To find out where to log in, call GET /v4/setup/authentication, which needs no token. It returns the URL of the
OpenID configuration and the client ID to use. The SDKs handle this for you, including
client credentials and device login.
Only a few endpoints work without a token: this one and the public tenant and theme reads.
| Endpoint | Returns |
|---|---|
GET /v4/users/me |
Your profile |
GET /v4/users/me/roles |
Your profile and permissions |
Response format¶
Most endpoints wrap their result in an envelope:
{
"data": { "...": "the actual result" },
"message": null,
"error": null,
"startTime": 1762682400000,
"durationInMs": 12.4,
"transactionId": null
}
Specification endpoints, such as GET /v4/types/specification, return the specification itself without an envelope.
Bulk reads return a result per requested ID, so one missing instance doesn't fail the whole request:
{
"data": {
"b1b6e3a2-6e2a-4a1a-9d57-1f4f0a3c2e10": { "data": { "@id": "..." } },
"f47ac10b-58cc-4372-a567-0e02b2c3d479": { "error": { "code": 404, "message": "..." } }
}
}
Pagination¶
Listings use markers rather than page numbers:
curl "$CORE/instances?stage=RELEASED&type=https://example.org/types/Book&size=50" -H "Authorization: Bearer $TOKEN"
{
"data": [ "..." ],
"total": 1234,
"size": 50,
"marker": null,
"nextMarker": "eyJuYW1lIjoiQWRhIn0"
}
Pass nextMarker back as marker to get the following page. Stop when the response has no nextMarker.
| Parameter | Default | Description |
|---|---|---|
size |
none, which returns all results | Maximum number of results on the page |
marker |
none | nextMarker of the previous page |
returnTotalResults |
true |
Set to false while paging, since counting costs time |
Tip
A page that is exactly full may be the last one. In that case the following page is empty and has no
nextMarker.
A marker is only valid for the listing it was issued for. With a different sorting, for example, it is rejected with
400.
Errors¶
| Status | Meaning |
|---|---|
400 |
The request or payload is invalid. |
401 |
There is no valid token, or you lack the permission for this action. |
404 |
The resource doesn't exist. Some reads answer this way for resources you can't access, so as not to reveal them. |
409 |
The action conflicts with the current state, such as deleting a released instance or starting a second background job. |
503 |
Core is temporarily not accepting changes: a graph reindex is running or too many writes are in progress. Retry later. |
Since a missing permission also results in 401, don't treat a 401 as an expired login without checking the token. Handle
403 the same way as 401.
Common parameter values¶
| Value | Used for |
|---|---|
stage=IN_PROGRESS or stage=RELEASED |
Choosing the draft or the published version |
space=myspace |
Your private space, usable wherever a space is expected |
Parameters that accept multiple values are repeated, for example ?type=A&type=B.