[英]GraphQL with Api-Platform returning null in GraphiQL
I have setup api-platform without docker in a Symfony 4 skeleton and have added GraphQL support as mentioned here - https://api-platform.com/docs/core/graphql 我已经安装API的平台,而无需码头工人在Symfony的4骨架和这里提到增加了GraphQL支持- https://api-platform.com/docs/core/graphql
When using GraphiQL I seem to only get null responses, I have tried a lot of different GraphQL syntax, all returning null. 当使用GraphiQL时,我似乎只得到null响应,我尝试了很多不同的GraphQL语法,所有语法都返回null。
Null response in GraphiQL GraphiQL中的空响应
Ive tried: 我试过了:
{
user{
id
}
}
- -
{
user(id: 1){
id
}
}
- -
{
users(id: 1){
id
}
}
All with no luck 一切都没有运气
I can request the api normally and I get a response. 我可以正常请求api,并且得到响应。
Successful request in API tester API测试器中的成功请求
Also, the requests in GraphiQL seem to all be post, this might be unrelated though. 此外,在GraphiQL中的请求似乎都已发布,但这可能是无关的。
Ive been trying to fix this for a while now and haven't managed to find any help online. 我已经尝试修复此问题已有一段时间了,但一直没有在线上找到任何帮助。
Thank you 谢谢
Well I found the answer for those having the same issues. 好吧,我找到了同样问题的答案。
api-platform uses uuids and you have to search with this in graphql api平台使用uuid,您必须在graphql中进行搜索
query {
user(id: "users/1"){
firstName
lastName
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.