Using the Graph API Communicating
February 14, 2023 at 10:38 AMThe GraphQL API has a single endpoint:
https://api.paynup.com
Because GraphQL operations consist of multiline JSON, Pay’nUp recommends using the Explorer to make GraphQL calls. You can also use cURL or any other HTTP-speaking library.
In REST, HTTP verbs determine the operation performed.
In GraphQL, you’ll provide a JSON-encoded body whether you’re performing a query or a mutation,
so the HTTP verb is POST
.
The exception is an introspection query, which is a simple GET
to the endpoint.
To query GraphQL using cURL, make a POST
request with a JSON payload.
The payload must contain a string called query
:
POST https://api.paynup.com
Content-Type: application/json
Authorization: Bearer {valid-access-token-goes-here}
{
"query": "query { {your-query-goes-here} }"
}
The string value of “query” must escape newline characters or the schema will not parse it correctly. For the
POST
body, use outer double quotes and escaped inner double quotes.