Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Talend Team,
I want to use graphQL query with talend.
I use tRest component. at first, it works.
This is the body:
"{ \"query\": \"query { hotelX { hotels(criteria: { access: \\\"21962\\\", maxSize: 500, hotelCodes: [\\\"\\\"] }, token: \\\"\\\", relay: {}) { token edges { node { code hotelData { hotelCode hotelCodeSupplier hotelName categoryCode rank location { address city zipCode country coordinates { latitude longitude } } medias { code order type updatedAt url texts { text language } } } } } } } }\" }"
The problem is that the token should be dynamic.
it tries this :
"{ \"query\": \"query { hotelX { hotels(criteria: { access: \\\"21962\\\", maxSize: 500, hotelCodes: [\\\"\\\"] }, token: \\\"\\\", relay: {}) { token edges { node { code hotelData { hotelCode hotelCodeSupplier hotelName categoryCode rank location { address city zipCode country coordinates { latitude longitude } } medias { code order type updatedAt url texts { text language } } } } } } } }\" }"
But it returns | Body | {"data":null,"errors":[{"message":"Expected ',' or '}' after property value in JSON at position 138"}]} |
| ERROR_CODE | 400
Any help please on this .
Thanks in advance
Hi
I don't see the difference between the first body string and second body string? You want to pass a dynamic token value to the body string?
Regards
Shong
Hi @Shicong Hong ,
You want to pass a dynamic token value to the body string? ==> Yes
I try this one but I got an error:
"{ \"query\": \"query { hotelX { hotels(criteria: { access: \\\"21962\\\", maxSize: 500, hotelCodes: [\\\"\\\"] }, token: \\\"\" + (String)globalMap.get(\"token\") + \"\\\", relay: {}) { token edges { node { code hotelData { hotelCode hotelCodeSupplier hotelName categoryCode rank location { address city zipCode country coordinates { latitude longitude } } medias { code order type updatedAt url texts { text language } } } } } } }\" }"
Hi @hiba chaieb
It seems this json is malformed. Here's some things I've noticed: