GraphQL uses the same HTTP requests to a server to retrieve data. However, there are some key differences in how you structure those requests when working with GraphQL:
GraphQL exposes a single endpoint (e.g./graphql
) for all API operations.
In REST, you use different HTTP methods to perform CRUD operations (GET, POST, PUT, DELETE). In GraphQL, you use the POST method and send a query or mutation as the request body.
Instead of specifying different endpoints and parameters as you do in REST, in GraphQL you send a structured query that defines the data you want. The query is written using the GraphQL Query Language.
GraphQL Query Language allows you to make queries with a lot more flexibility than traditional REST API servers. You can specify the fields you want, access nested data, get many resources in a single request, and more.
In order to start making requests to the GraphQL API Endpoint, you will need to first authenticate.
Authenticate
https://data-feeds-graphql-appserver-production.azurewebsites.net/auth/token
{
"client_id": "YOUR CLIENT ID",
"client_secret": "YOUR CLIENT SECRET",
"grant_type": "client_credentials"
}
Use your client_id
and client_secret
to make a request to the auth/token
endpoint, this will return a accessToken
that you can use to access the GraphQL API.
sample response: