How to resolve graphql “failed to recognize JSON request: 'EOF' ” error

I’m trying to use a Rest API, but when I query, I receive the following error that I don’t understand, I’ve tried to look at similar questions here but they are very particular cases. This is the code I use
payload = {"query":"{ viewer { zones(filter: { zoneTag: " + zoneTag + " }) { httpRequests1dGroups( orderBy: [date_ASC] limit: 1000 filter: { date_gt: \"2019-07-15\" } ) { date: dimensions { date } sum { cachedBytes bytes } } } } }","variables":{}}
it is giving me error like this
{ "data": null, "errors": [ { "message": "failed to recognize JSON request: 'EOF'", "path": null, "extensions": { "timestamp": "2021-04-21T13:17:21.939789333Z" } } ] }
However this is my curl command
`

curl \
  -X POST \
  -H "Content-Type: application/json" \
  -H "X-Auth-Email: CLOUDFLARE_EMAIL" \
  -H "X-Auth-key: CLOUDFLARE_API_KEY" \
  --data "$(echo $payload)" \
  https://api.cloudflare.com/client/v4/graphql/

`

You should ask your question on the CloudFlare forum instead of Asana!!

1 Like