...
Welcome to the "Getting Started" section of Originate's GraphQL API Documentation. This section will guide you through the initial steps required to access and interact with Originate's GraphQL API, ensuring a smooth integration process and successful utilisation of its features.
We will be covering:
Accessing Originate's GraphQL API
Authentication and Authorization
Let's get started:
#### **1. Accessing Originate's GraphQL API:**
To begin using Originate's GraphQL API, follow these steps:
##### a. Obtain API Endpoint:
All API requests, whether queries or mutations, are sent to a single HTTP endpoint.
**Sandbox Environment**
For development and testing purposes, you can use the sandbox environment URL:
HTTP
Code Block | ||
---|---|---|
| ||
https://staging-ignite.originate.ng/graphql |
**Production Environment**
When your application is ready for production, use the URL below for the production environment:
HTTP
Code Block | ||
---|---|---|
| ||
https://ignite.originate.ng/graphql |
##### b. Choose Your Tool:
Decide on the tool you'll use to make GraphQL requests. You can use tools like cURL, Postman, or popular GraphQL client libraries.
You SHOULD use the POST method for all requests.
##### c. The Content-Type Header
The content type of a query MUST be `application/JSON
`.
`Content-Type: application/json
`
##### d. The Message Body
The message body MUST be a JSON object. It MUST contain a query key and MAY include a variables key.
The query value MUST be a single [JSON string](🔗) containing a well-formed GraphQL document (query or mutation).
If you reference variables in your GraphQL document, the value for variables MUST be a JSON object containing the key/value pairs for each variable as can be seen below.
JSON
Code Block | ||
---|---|---|
| ||
{
"query": "a GraphQL document goes here that references $var1, $var2, and $var3",
"variables": {
"var1": 10,
"var2": { "some": "data", "for": "var2" },
"var3": ["a","list","of","values"]
}
} |
To send that to our API, it has to be wrapped in a JSON object with a query key:
Text
Code Block | ||
---|---|---|
| ||
{ "query": "query { hello }" } |
Below is how you can make a request using cURL:
cURL
Code Block | ||
---|---|---|
| ||
curl -H 'Content-Type: application/json' -X POST https://staging-ignite.originate.ng/graphql -d '{"query": "query { hello }"}' |
To learn more about GraphQL API’s You can check out <https://www.howtographql.com>.