在quartz scheduler中发送json负载时出错
我正在尝试在quartz scheduler中发送json负载。我将标题设置为Content-type:application/json,但由于某种原因,我的json字符串抛出了一个错误:uncaughterror,json中的意外标记 我发送给graphql服务的原始json如下所示:在quartz scheduler中发送json负载时出错,json,postman,quartz-scheduler,Json,Postman,Quartz Scheduler,我正在尝试在quartz scheduler中发送json负载。我将标题设置为Content-type:application/json,但由于某种原因,我的json字符串抛出了一个错误:uncaughterror,json中的意外标记 我发送给graphql服务的原始json如下所示: { GetAllAuthors{ id name } } { "GetAllAuthors": { "id": 123,
{
GetAllAuthors{
id
name
}
}
{
"GetAllAuthors": {
"id": 123,
"name": "James Brown"
}
}
但要使其在quartz中工作,我需要模拟rest API调用,这就是我尝试使用以下方法的原因:
{ "query":{{""{\nGetAllAuthors {\nid\nname\n}\n\n}""}} }
上面也给出了未捕获错误,json错误中的意外标记。有什么是我遗漏或忽略的吗
PS:我尝试使用在线json格式化程序,当我尝试验证上述json时,出现以下错误:
Error: Parse error on line 2:
{ "query": { { "" {\ nGetA
--------------^
Expecting 'STRING', '}', got '{'
这不是有效的Json。如果它是:
{
"GetAllAuthors": [
"id",
"name"
]
}
但我怀疑你在尝试这样的事情:
{
GetAllAuthors{
id
name
}
}
{
"GetAllAuthors": {
"id": 123,
"name": "James Brown"
}
}
在这里玩,直到你做对为止:
编辑:我没有使用GraphQL,但本页显示了如何通过发布JSON或使用QueryString获取来通过Http传输非JSON GraphQL查询:我通过Mozilla的“网络”选项卡进行测试发现了这一点-正确的格式是:
{query:{\n GetAllAuthors{\n id\n name\n}\n}\n,变量:null,operationName:null}我的应用程序是启用graphiql的graphql应用程序;当我从浏览器中调用graphql服务时,我使用的格式是,因为我的查询实际上是更新数据库的变体;换句话说,我只有查询名和字段名,没有任何值。