我们正在尝试cloudflare的GraphQL Analytics API,我们正在尝试通过HttpClient 发布此查询
作为回应,我们得到错误
json:无法将字符串解组为graphql.httpPostBody 类型的Go值
这是我们在SerializeObject 之后得到的查询
"query{viewer {zones(filter: { zoneTag: "XYZ"}) {httpRequests1dGroups(orderBy: [date_ASC], limit: 1000, filter: { date_gt: "2021-06-09"}) {date: dimensions {date}sum {cachedBytes bytes}}}}}"
我们需要纠正的是什么,有什么想法吗?
直接JSON发布将不起作用。
您必须使用.NET GraphQL包来形成正确的查询并返回响应。
-
GraphQL.Clienthttps://www.nuget.org/packages/GraphQL.Client/3.2.4/
-
GraphQL.Client.Serizer.Newtonsofthttps://www.nuget.org/packages/GraphQL.Client.Serializer.Newtonsoft/3.2.4/