Optix and GraphQL

GraphQL is a query language and runtime that helps us fulfill the exact information requested by external apps. It allows you to describe what information you want into a JSON like format and we will reply with the exact set of data.

GraphQL for many developers can be a replacement for REST, but we believe it’s only a flexible approach for requesting data. Also, it allows us to include more information and details to our APIs without affecting your app. We can mark fields as deprecated to inform you about something that we are considering remove, and you also provide us information of what kind of field are you currently using, this can help us drive the evolution of the platform.

On this page

Benefits over REST

  • Fewer requests: GraphQL accepts batch requests so that you can ask for all information required with only one real HTTP request to our server, faster for you and more effective.
  • Clear relationships: You can follow relationships between objects, so it doesn’t matter if your query starts from the booking or check-in, you can follow the relationships and fetch the data regarding the location, resource and other internal objects without multiple round trips to the server.
  • Less useless data: Quite often, you will require only a small portion of the all data node requested. GraphQL requires you to inform which fields you will effectively use, reducing the useless data transferred between Optix and your Application.
  • Strong typing: GraphQL is strongly typed, so you will know what kind of data you will receive.
  • Auto Documentation: GraphQL provides introspection capabilities, so you can use useful tools to help your development, like autocomplete on query editors and also API explorers.
  • Less work: You can use class/code generators/libraries like “Apollo” to create a set of mapping classes in your language that will inform all the data structure in your IDE.

What GraphQL does not offer

  • Caching on network level: You cannot rely on HTTP caching since the URL of the endpoint is always the same unless you hash your cache key based on all request data. Make sure to use the proper caching strategy when using GraphQL endpoints.
  • The endpoint is not verbose: The endpoint is always the same, and the query can return anything that you want. So make sure to use the tools we provide when creating a new query.

Related information

  • https://www.howtographql.com/
  • https://www.graphql.org/
  • GraphQL Voyager: A tool used to present the full relationship and objects available on the Optix API. Use the menu option provided on the ‘Develop’ page in Optix to use this tool with your organization or user token.
  • GraphQL Playground: A tool used to create/prototype queries/mutations using our API. Use the menu option provided on the ‘Develop’ page in the Optix admin dashboard to use this tool with your organization or user token.

Got questions?

We are here to help. Ask us a question and we’ll do our best to answer as soon as possible.

Contact Us