Wave's API is built using GraphQL. New to it? Learn more about GraphQL.
The GraphQL API is served over HTTP via a single endpoint (https://gql.waveapps.com/graphql/public) which expresses the full set of capabilities of Wave. This is in contrast to REST APIs which expose a suite of URLs each of which expose a single resource.
There are multiple GraphQL clients available to simplify the process of sending requests, but any tool that can send an HTTP request will work.
There are two common types of operations in GraphQL — a query to request some data and a mutation to submit or change data.
To send a request, POST a JSON-encoded body containing the GraphQL operation along with a Bearer token in the Authorization header (previous step). A valid request must contain the query key regardless of the operation, and may include the variables key (see Variables).
Operation
query {
businesses {
edges {
node {
id
name
}
}
}
}Response
{
"data": {
"businesses": {
"edges": [
{
"node": {
"id": "QnVzaW5lc3M6YWJjYWJjYWJjYWJj...",
"name": "Test Business"
}
}
]
}
}
}Example: Terminal using cURL
curl -L 'https://gql.waveapps.com/graphql/public' \
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
-H 'Content-Type: application/json' \
-d '{"query":"query { businesses { edges { node { id name } } } }","variables":{}}'Example: Javascript using fetch
const myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer <ACCESS_TOKEN>");
myHeaders.append("Content-Type", "application/json");
const graphql = JSON.stringify({
query: "query { businesses { edges { node { id name } } } }",
variables: {}
});
const requestOptions = {
method: "POST",
headers: myHeaders,
body: graphql,
redirect: "follow"
};
fetch("https://gql.waveapps.com/graphql/public", requestOptions)
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.error(error));All set!
You're now ready to start making API calls from your test business. Here are some more resources to help you hit the ground running.
- Learn more in Wave API basics
- Check out query and mutations examples
- Want to get started without leaving this portal? Test your request in our Playground