Comment on page
Getting started with cURL
Alerts API querying example with cURL
To query the API, you can use any HTTP client of choice or any specialized GraphQL API Clients.
Make sure to replace
<REPLACE_WITH_YOUR_KEY>
with your unique API key.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 getAlerts($first: Int!) { alerts(first: $first) { id dataset variable } }","variables":{"first":3},"operationName":"getAlerts"}'
The above command returns JSON structured like this:
{
"data": {
"alerts": [
{
"id": "8da58037-d0b9-8365-75b4-6754aed4e9b0",
"dataset": "news",
"variable": "news_article"
},
{
"id": "8489a57b-7be9-0364-a95d-65ad84ed430a",
"dataset": "news",
"variable": "news_article"
},
{
"id": "8489a57b-7be9-0364-a90d-65ad84ed430a",
"dataset": "news",
"variable": "news_article"
},
...
]
}
}
Last modified 1yr ago