我正在尝试使用 Rest API,但当我查询时,我收到以下我不理解的错误,我试图在这里查看类似的问题,但它们是非常特殊的情况。这是我使用的代码
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 .
我收到以下错误,请帮忙
{
"data": null,
"errors": [
{
"message": "failed to recognize JSON request: 'EOF'",
"path": null,
"extensions": {
"timestamp": "2021-04-21T18:10:10.771545952Z"
}
}
]
}
答案1
您的 JSON 无效。请使用 linter 检查,例如JSONlint。