Skip to main content

Using GraphQL

Heads up!

The remainder of this guide assumes that your team is familiar with the use of API Clients, and are able to set up a connection via a client of your choice.

All requests must be made to our GraphQL endpoint at https://api.ezcater.com/graphql via HTTP POST with an ‘Authorization’ header using the generated token as its value.

If you have never used GraphQL before, there is a lot of good information and examples to be found at https://graphql.org/learn

GraphQL leverages a pattern called introspection, which allows you to query the endpoint for information about the schema and structures you can request. Tools like GraphQL will handle this automatically, providing an easy-to-navigate documentation that you can use to see what queries are available, what fields you can ask for and what the return values will look like.

Building a Request

Make a POST request with your Query body to https:/api.ezcater.com/graphql, using the following headers:

  • Content-Type: application/json

  • Authorization: <Your API Token>

  • Apollographql-client-name: <Your Organization Name/Identifier>

  • Apollographql-client-version: <Your Software Version>

In order for ezCater to properly track and troubleshoot requests to our API, all requests must be named. A collection of our naming conventions for each query can be found at the bottom of this document.

We recommend using a tool like GraphiQL for viewing all the fields that can be queried from the API. This section will give a brief overview of our top-level queries.

Template Query

query <NAMEOFQUERY> {
menus {
Nodes {
Id
Name
startDate
endDate
}
}
}

Query Examples

menusByCaterer

query menusByCaterer {
menus {
nodes {
id
name
startDate
endDate
}
}
}

\_\_schema

query fullschema {
__schema {
types {
name
kind
description
fields {
name
}
}
}
}

\_\_type

query {
__type(name: "Menu" ) {
name
kind
description
fields {
name
}
}
}

Once you have your API Token and have connected to our endpoint via an API Client, you can begin setting up your integration with the API.

Did this answer your question?