1

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":{
"query ipFlowTimeseries(
    $zoneTag: string
  ) {
   viewer {
    zones(filter: { zoneTag: $zoneTag }) {
      httpRequests1dGroups(
        orderBy: [date_ASC]
        limit: 1000
        filter: { date_gt: \"2021-04-15\" }
      ) {
        date: dimensions {
          date
        }
        sum {
          cachedBytes
          bytes
        }
      }
    }
  }
 }
}",
"variables":{
 "zoneTag": "xxxxxxxxx"
}}'

curl -k \
  -X POST \
  -H "Content-Type: application/json" \
  -H "X-Auth-Email: xxxxxx.com" \
  -H "X-Auth-key: xxxxxxxxxxx" \
  --data "$(echo $PAYLOAD)" \
  https://api.cloudflare.com/client/v4/graphql/ | jq .

i am getting following error please help

{
  "data": null,
  "errors": [
    {
      "message": "failed to recognize JSON request: 'EOF'",
      "path": null,
      "extensions": {
        "timestamp": "2021-04-21T18:10:10.771545952Z"
      }
    }
  ]
}
minu
  • 11
  • 3

1 Answers1

1

Your JSON isn't valid. Please check it with a linter, such as JSONlint.

Ackack
  • 989
  • 5
  • 11