Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
SreejithSL
Contributor III
Contributor III

Query data from App using GraphQL

Hi All,

There is a requirement to pull data from one of our applications which support GraphQL. Can anybody provides the idea of how we can implement through talend components. I tried with tRest ->tExtractJSON->tlogRow but the output resulted in error code.

This is how I designed tRest I put a POST request , in header tab provided the content type and authorization then in http body has provided the GraphQL .

Thanks

Labels (3)
5 Replies
Anonymous
Not applicable

@Sreejith Sreedharan Leela​ Take a look at the below topics which show how to write the query.

https://community.talend.com/s/question/0D53p00007vCpE8CAK/graphql-in-talend

https://community.talend.com/s/question/0D53p00007vCn6MCAS/how-to-use-graphql-query-with-talend

 

Please try and let me know if you have any errors.

 

Regards

Shong

SreejithSL
Contributor III
Contributor III
Author

Thanks for the reply. These links I already tried and no result. My question is ,can I pass the graphql query in the http body of the tRest client,

SreejithSL
Contributor III
Contributor III
Author

Can anybody provides a solution to how the graphQL can be pass to tRestClient . The reference for this particular use case is less in the support channels, so your support would be appreciable.

Anonymous
Not applicable

can you confirm that you are using tRestClient or tRest Component?

 

with tRestClient:

 

...tMap-->tRestClient

 

You should see a body and a string column in your tMap output table. In your tMap output table's string column value expression, write your query string.

 

You may want to test the JSON being produce by replacing the tRestClient with a tLogRow.

 

with tRest:

write the query string in the body field.

 

Regards

Shong

 

SreejithSL
Contributor III
Contributor III
Author

I tried tRest first, in http body part I provided the json graphql query similar like below. But it throws error.

"

{

 online_users {

  id

 }

 todos {

  user {

   id

   name

  }

 }

}

"

output

==============

----------------+----------.

|     tLogRow_7     |

|=---------------+---------=|

|Body      |ERROR_CODE|

|=---------------+---------=|

|error code: 1010|403    |

'----------------+----------'