Skip to main content

GraphQL

GrapQL is a standardised way of making API requests where the requester can specify the shape of responses. If you are unfamiliar with GraphQL, we recommend checking out the documentation here.

Requests​

GraphQL requests are transmitted over a REST POST request with standardised shape:

POST
Content-Type: application/json
{
"query": "...",
"operationName": "...",
"variables": { "myVariable": "someValue", ... }
}

Here operationName and variables are optional fields.

Queries define the shape of the response that is expected by the requester, for example:

person(userId: "USER_ID", personId: "PERSON_ID") {
id
title
firstName
lastName
dateOfBirth
phoneNumber
joinDate
}

Responses​

Responses from a GraphQL API follow a standardised shape, where the fields returned match those requested

{
"data": { ... },
"errors": [...]
}

Here errors is an optional field that will include any GraphQL error messages raised in the query.

Batching​

Multiply's API supports batched requests, allowing you to make multiple requests with a single call to the API:

[
{
"query": "...",
"operationName": "...",
"variables": { "myVariable": "someValue", ... }
},

{
"query": "...",
"operationName": "...",
"variables": { "myVariable": "someValue", ... }
},
...
]

These queries will be executed sequentially.