GraphQL API Endpoints
Introduction
GraphQL APIs are usually documented through the documentation facilities provided by the GraphQL server itself: the type system and the descriptions on the types and fields.
There are a lot of GraphQL playground tools(e.g. https://eat.bananacakepop.com/), which let you explore the API documentation through clicking/searching in a visual document tree or through IDE like features (autocomplete, tooltips and field descriptions).
cobra GraphQL endpoints to retrieve Data on DEV server
API Description | Endpoint |
---|---|
CRM - Todos / Tickets | https://api.cobra.de/v1/tickets/graphql |
CRM - Companies | https://api.cobra.de/v1/crm/companies/graphql |
CRM - People | https://api.cobra.de/v1/crm/people/graphql |
CRM - Touchpoints | https://api.cobra.de/v1/crm/touchpoints/graphql |
Events | https://api.cobra.de/v1/events/graphql |
Events - Bookings | https://api.cobra.de/v1/events/bookings/graphql |
Event Websites | https://api.cobra.de/v1/events/websites/graphql |
Event Websites Public | https://api.cobra.de/v1/events/websites/public/graphql |
Users | https://api.cobra.de:443/v1/users/graphql |
EAP - E-Mail Autopilot | https://api.cobra.de:443/v1/eap/runs/graphql |
How to work with our GraphQL APIs and Postman
Postman is very popular tool for using APIs and of course it supports GraphQL as well. You can use Postman's GraphQL client to create GraphQL requests or HTTP request interface, which is for REST API.
How to access cobra GraphQL API with Postman
In Postman, select New > GraphQL to open a request in a new tab. (In the Postman desktop app, you can also select ⌘+N or Ctrl+N, then select GraphQL.)
HTTP Headers
Every request requires the following HTTP headers: X-Integration-Name, X-Integration-Provider and X-Cobra-TenantId. You can use "postman" for X-Integration-Name, as X-Integration-Provider your company or project name, X-Cobra-TenantId is the Tenant GUID. More details about TenantId see Tenant Context page.
Authentication
First of all we do authentication request to receive a bearer token, which is valid 60 minutes. PLease check out the API endpoint here: Meldet sich mit den Anmeldedaten an cobra an und gibt bei Erfolg einen Bearer Token zurück. and our article about Authentication
Select "Bearer token" as authorization type and insert the bearer token received in previous step:
GraphQL Query Example
Use one of the available GraphQL endpoints, see list above, e.g. https://api.cobra.de/v1/events/bookings/graphql and do not forget to set HTTP headers.
After fetching the schema from the server, you are able to use the query explorer. Here you can see all avaliable components and fields (with descriptions). Enable fields you want to include in your query and postman will build a query for you on the right.
When you finished building your query you can hit "Query" in the top right corner.
GraphQL Query recommendations
- Previous point describes how to use GraphQL queries for the cobra API with Postman. In the example we used: GraphQL client. You can also use HTTP request interface. This is not recommended because it wont show field descriptions (by missing the query explorer);
- Use Postman variables & scripting to save bearer token after authentication request to be able to reuse it for your queries without copy-paste;