BaseCMS GraphQL API
Documentation Home
  • Getting Started
  • Connecting to the API
  • Modifying Data
    • Introduction
    • Creating a redirect
    • Creating content
    • Modifying content
    • Scheduling content
  • Querying Data
    • Introduction
    • Retrieving a Company
    • Retrieving multiple Companies
    • Retrieving published content
Powered by GitBook
On this page
  1. Querying Data

Retrieving a Company

The following example looks up a fictional company (Acme, Inc.) from an example BaseCMS API. This query outlines how to make a request to retrieve company fields.

Retrieve a company by ID

POST https://<instance>.base-staging.parameter1.com/graphql

This Query allows you to return company data after looking it up by its identifier.

Headers

Name
Type
Description

X-Tenant-Key

string

The Tenant Key used to access your data.

Authentication

string

If specified, the user that should be attributed with this request.

Request Body

Name
Type
Description

operationName

string

The name of the GraphQL query

variables

object

The GraphQL variables to inject into the query.

query

string

The GraphQL query text to execute

{
  "data": {
    "contentCompany": {
      "id": 21112606,
      "name": "Acme, Inc."
    }
  }
}
{
  "error": {
    "errors": [
      {
        "message": "Variable \"$input\" got invalid value {}; Field id of required type Int! was not provided.",
        "extensions": {
          "code": "INTERNAL_SERVER_ERROR"
        }
      }
    ]
  }
}

Query

Query

query RetrieveCompanyByID($input: ContentCompanyQueryInput!) {
  contentCompany(input: $input) {
    id
    name
  }
}

Variables

{
  "input": {
    "id": 21112606
  }
}

cURL Request

curl 'https://instance.graphql.base-cms.io' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Connection: keep-alive' -H 'DNT: 1' -H 'Origin: file://' -H 'x-tenant-key: my_tenant_key' --data-binary '{"query":"query RetrieveCompanyByID($input: ContentCompanyQueryInput!) {\n  contentCompany(input: $input) {\n    id\n    name\n  }\n}","variables":{"input":{"id":21112606}}}' --compressed

PreviousIntroductionNextRetrieving multiple Companies

Last updated 4 years ago

The query as run within the GraphQL Playground client