我一直在阅读和尝试很多东西,但只使用cURL作为工具。还有其他方法对GraphQL端点运行测试吗?
所以我的问题是带有多个变量的变异查询。这是我的Shema的一部分:
type mutation {
oneComponentTypeCollected(userID: String!, password: String!, pageID: Int!,
Components: ComponentsInput!): Page
}
type Components {
ComponentType: ComponentType!
required: Int!
collected: Int!
}
type ComponentsInput {
id: String!
collected: Int!
}
type Page {
id: Int!
}
如何调用查询oneComponentCollected变异? 预期的是将收集的值设置为Component" inkpad_blue"
的1我尝试了以下内容:
可变语法:
{"query":"mutation($input:ComponentsInput!) {oneComponentTypeCollected(userID: \"asd\", password: \"asd\", pageID: 1, input:$input){id}}","variables":{"input":{"id":"Inkpad_blue","collected":1}}}
纯粹的字符串:
mutation($input:ComponentsInput!) {oneComponentTypeCollected(userID: "asd", password: "asd", pageID: 1, input:$input){id}}
两者都会导致500个HTTP错误。
答案 0 :(得分:1)
我认为你的突变应该是这样的
mutation{oneComponentTypeCollected(userID: "asd", password: "asd", pageID: 1, Components:{"id": "Inkpad_blue","collected": 1}){id}}
在graphiql中试试这个