Getting started with cURL
Alerts API querying example with cURL

Request code

To query the API, you can use any HTTP client of choice or any specialized GraphQL API Clients.
Make sure to replace qfNfdijpFhbhPhA7j2ZxvtEGkfv8DftTtmTEbnWN with your unique API key.
1
curl --request POST \
2
--url 'https://api.craft.co/v1/query?=' \
3
--header 'content-type: application/json' \
4
--header 'x-craft-api-key: qfNfdijpFhbhPhA7j2ZxvtEGkfv8DftTtmTEbnWN' \
5
--data '{"query":"query getAlerts($first: Int!) { alerts(first: $first) { id dataset variable } }","variables":{"first":3},"operationName":"getAlerts"}'
Copied!

Response

The above command returns JSON structured like this:
1
{
2
"data": {
3
"alerts": [
4
{
5
"id": "8da58037-d0b9-8365-75b4-6754aed4e9b0",
6
"dataset": "news",
7
"variable": "news_article"
8
},
9
{
10
"id": "8489a57b-7be9-0364-a95d-65ad84ed430a",
11
"dataset": "news",
12
"variable": "news_article"
13
},
14
{
15
"id": "8489a57b-7be9-0364-a90d-65ad84ed430a",
16
"dataset": "news",
17
"variable": "news_article"
18
},
19
...
20
]
21
}
22
}
Copied!

Read more

Last modified 5mo ago
Copy link