Postman

Prerequisites:

Using Postman to Call the API

  1. Set Up a Request:

    • Create a new POST request in Postman.

    • Use the same endpoint as Apollo Sandbox.

  1. Add Authorization:

  • In the Authorization tab, select Bearer Token.

  • Paste your API key into the token field.

  1. Check the Headers:

  • The headers will show a predefined Authorisation.

  1. Define the Body:

  • Go to the Body tab. Select the "raw" option. In the input enter the "operationName" and "variables" as we have defined in the Apollo Sandbox.

  • Use the "query" in the "Operation" section of Apollo Sandbox and convert it into a single-line string. You can use this tool to convert the query from multi-line to single-line.

The single line query will look like this:

query Projects($organization: String!) {\n  projects(organization: $organization) {\n    data {\n      organizationId\n      name\n    }\n  }\n}
  • Provide necessary variables (e.g., organization ID) in the payload. The final query will look something like this:

{
    "operationName": "Projects",
    "variables": {
        "organization": "<Org-ID>"
    },
    "query": "query Projects($organization: String!) {\n  projects(organization: $organization) {\n    data {\n      organizationId\n      name\n    }\n  }\n}"
}
  1. Send the Request:

  • Execute the request by clicking on "Send" to receive JSON responses similar to the Apollo Sandbox.

Last updated