-
-
Notifications
You must be signed in to change notification settings - Fork 960
Description
Hi,
I'm trying GraphQL with success to replace REST calls inside a react-native app.
It seem's to reduce loading time a lot.
I have a critical problem
With REST, I can request a user by id or filter the collection by id. Not with GraphQL. It seems to be two differents problems.
Maybe it's somehow related to #2190. In that case, is this possible to backport the patch on the 2.2 branch ?
First problem : unable to get a single row by id
Using GraphQL, I obtain 400 HTTP response with incorrect route error I'm unable to get a stacktrace, nothing in var/log neither than nginx nor php logs. How can I find the stacktrace ?
REST query
curl -X GET "https://my.endpoint.com/users/1" -H "accept: application/json"
Response
{
"id": 1,
}
GraphQL query
{
user(id:1) {
id
}
}
Response
{
"errors": [
{
"debugMessage": "No route matches \"1\".",
"message": "Internal server error",
"category": "internal",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"user"
]
}
],
"data": {
"user": null
}
}
The second problem is on the filter side, it's functionnal on REST but not with GraphQL : I'm getting all the collection
REST query
curl -X GET "https://my.endpoint.com/users?id=1" -H "accept: application/json"
Response
[
{
"id": 1,
}
]
GraphQL query
{
users(id:1) {
edges {
node {
id
}
}
}
}
Response
{
"data": {
"users": {
"edges": [
{
"node": {
"id": "/users/1"
}
},
{
"node": {
"id": "/users/2"
}
},
{
"node": {
"id": "/users/3"
}
},
etc.
}