Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

GraphQl in Talend

Hi everyone,

 

I have to use a GraphQL API in talend but I can't do it.

The goal is to get data from another API with a tjava, then i link the tjava with a tmap and to finish i use the tmap to do a request like : '{"query": "mutation { saveForm(formInput: {wasteDetails{name : ' + row1.wdName + '}) {id,wasteDetails{name}} }" }'

I try 3 differents way.
The first way was with tRest but we can't link a tmap to a tRest

The second way was with a tRestClient but I don't know what put in parameters in my url so I've had a http 500 errors 

And the third way was with thttprequest but i don't know how to use the row of my tmap in my file for the post of the thttprequest

 

I hope I'm clear enough

Thank you in advance

Labels (2)
19 Replies
Anonymous
Not applicable
Author

Hello rhall,

 

sorry for my bad JSON , actually that is my GraphQL mutation statement.

Could you please let me know how to pass it to graphql server through trestclient.

or if there is any alternative way.

 

Thanks in advance

Anonymous
Not applicable
Author

Your tRestClient has a string and a body input schema. The body column is for XML (document) and the string is for JSON. Send the JSON to the string column using the component before to set it. When formatting the JSON you will need to make sure you handle all of the formatting. Therefore you will need to build it using Java escape characters to escape the quotes.

Anonymous
Not applicable
Author

I have taken your advice and quoted all the strings as shown in the attached pictures,

still getting "post body missing error".

Request you to help us out as it is priority issue to us and we are able to find very less posts on GraphQL - Talend combination.

 

0683p000009M7x5.png0683p000009M7xA.png0683p000009M7xF.png0683p000009M7t0.png0683p000009M7Vs.png

Anonymous
Not applicable
Author

How is your tFixedFlowOutput configured? Your JSON is still not correct. You are missing a few colons.

Anonymous
Not applicable
Author

the below is mutation statement and i am storing it in a context variable jsonString which is passed to fixedflow

context.jsonString = "\"mutation\"{ \"upsertEntity\"(\"entity\" : { \"name\" : \"ABC1 entity \" }) {\"id\",\"name\"}}";

 

please let me know how to correct the JSON format.I have minimum knowledge on JSON formation.

0683p000009M7rw.png

Anonymous
Not applicable
Author

Hi rhall,

please help as I stuck here still.

 

Thanks in advance,

archanalg

Anonymous
Not applicable
Author

Before creating it as a Java String, take the JSON you have created and test it here. This will tell you where it is incorrect. I can see from glancing at it that you are missing semicolons (0683p000009MACn.png. For example, your current code is this...

"\"mutation\"{ \"upsertEntity\"(\"entity\" : { \"name\" : \"ABC1 entity \" }) {\"id\",\"name\"}}"

It looks like ":" is missing after "mutation" and "upsertEntry". I'm also not sure that what you are trying to do with the "(" and ")" characters. Can you give a bit more detail on what needs to be provided to the service? Is there any API documentation?

kakooo16
Creator
Creator

Hello rhall , 

 

Im stuck with passing a query to my tRESTClient   using GraphQl.  

It is working on Postman and im getting the right informations but using talend i couldn't pass the query .

 

Thanks in advance .

 

 

 

 


ql.PNG
ql1.PNG
ql2.PNG
kakooo16
Creator
Creator

Hello ,

 

Is there anybody who can help .

 

Anonymous
Not applicable
Author

Sorry @kakooo16, I have not been on the Community for a while. From what you have said, it looks like you are not sending your JSON query to the string column of the input schema. You will also need to set the tRestClient http method to POST