Getting started with cURL

Company Data API querying example with cURL

Request

curl --request POST \
  --url 'https://api.craft.co/v1/query?=' \
  --header 'content-type: application/json' \
  --header 'x-craft-api-key: <REPLACE_WITH_YOUR_KEY>' \
  --data '{"query":"query getCompany($domain: String!) {\n\tcompany(domain: $domain) {\n\t\t locations {\n\t\t\tcity,\n\t\t\tcountry\n\t\t} \n\t}\n}","variables":{"domain":"meta.com"},"operationName":"getCompany"}'

Please make sure to replace <REPLACE_WITH_YOUR_KEY> with your unique API key.

Response

The above command returns JSON structured like this:

{
  "data": {
    "company": {
      "locations": [
        {
          "city": "Tokyo",
          "country": "JP"
        },
        {
          "city": "Ottawa",
          "country": "CA"
        },
        {
          "city": "Jakarta",
          "country": "ID"
        },
       ... 
      ]
    }
  }
}

Read more

Last updated