GraphQL uses REST query which has an array as JSON response does not work

GraphQL uses REST query which has an array as JSON response does not work


0

I’m trying to query another system with a GraphQL query. Due to the system only takes REST queries I use the @rest operator to convert the query. But the REST query has an array as response which leads to the following error:

{"name":"ApolloError","graphQLErrors":[],"clientErrors":[],"networkError":{},"message":"typename is undefined"}

GraphQL query:

const QueueStatusQuery = gql`
query checkQueueStatus_HLS{
  robot(input:{}) @rest( method: "GET", path: "queue") { 
    patientID
    medicationID
  }
}
`;

Response regarding to firefox inspector (JSON format):

[{"medicationID":"4","patientID":"4"},{"medicationID":"5","patientID":"5"}

All other rest query responses don’t have the [] bracket so GraphQL accepts then but I don’t know how to solve this.
I’m using useQuery by @apollo/client an a RestLink to connect to the other system.


Load 6 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *