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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

PUT with a tRestClient not working

Hi all,

I have a problem with a tRestClient and the PUT method. It seems working but nothing is done.

0683p000009M9BK.jpg

 

As you can see, my job tRestClient is sending a "correct" response.

But when i look the result, nothing is changed.

 

Here is what i send (it's a Document type data):

+------+----------------------------------------------------------------------------------------+
| key | value |
+------+----------------------------------------------------------------------------------------+
| body | <?xml version="1.0" encoding="UTF-8"?>
<brand code="ELLE"><label>ELLES</label></brand> |

 

And there is what the tRestClient send me as a response:

200|<?xml version="1.0" encoding="UTF-8"?>
<root><id>B001A9D9-7EA7-4850-857C-401BF2A9B4A8</id><code>ELLE</code><label>EL</label><description>ELLE</description></root>

 

As you can see, the parameter <label> is not changed and i don't understand why!

Labels (3)
1 Solution

Accepted Solutions
uzix
Creator
Creator

hello,

 

you could try and use a tXMLMap and have several outputs depending on the field has value or not.

if you connect the tXMLMap  to a trestclient :

trestclient input schema:

column -> body

type > Document

basic settings

contenttype > json

acceptype> json

advanced settings:

log messages

drop json request root

wrap json response

 

 

it will send a json request.

 

i make a call with txmlmap -> trestclient to make json request


xml_json.jpg

View solution in original post

6 Replies
Anonymous
Not applicable
Author

Hi
I don't know what you API do, I see the calling is working fine and returns a response. From the result, I see the value of element <label> changes to EL.
What should be the correct response? Can you show us more details about your API definition?

Regards
Shong
Anonymous
Not applicable
Author

Hi Shong,

My API is here to cancel & replace the data.

I send new datas to the API, it should return me the new datas. 

 

When i do it manually, it works just fine.

So the response should be this :
200|<?xml version="1.0" encoding="UTF-8"?>
<root><id>B001A9D9-7EA7-4850-857C-401BF2A9B4A8</id><brand code="ELLE"><label>ELLES</label></brand></root>
and not
200|<?xml version="1.0" encoding="UTF-8"?>
<root><id>B001A9D9-7EA7-4850-857C-401BF2A9B4A8</id><code>ELLE</code><label>EL</label><description>ELLE</description></root>

Anonymous
Not applicable
Author

How do you do it manually? call it by other tool?
Does the API provided by other provider or you build it with Talend studio?

Regards
Shong
Anonymous
Not applicable
Author

My API is on a webpage, when i do it manually it looks like this :

{ "code"="ELLE", "label"="ELLES"}

 

My problem is, to construct this, i'll depend on the schema of the datas and i'm working on a job that will sometimes doesn't have all columns (based on xsd).

So sending a Document type allowed me to not send empty data.

 

exemple: if i have this in the "body" column 

             <brand code="ELLE"><label>ELLES</label></description></brand> ==> it should be { "code"="ELLE", "label"="ELLES"}

but if i use a tWriteJSON to generate this i'll have  { "code"="ELLE", "label"="ELLES", "description":[]}

 

My goal is to avoid using a tWriteJSON and depend on the schema

 

Has you can see, in the API when i do it manually, the answer send me the corrected data, not like in Talend

0683p000009M95r.jpg0683p000009M987.jpg

 

The previous label was "EL" and as you can see, manually it changes to "ELLE"

uzix
Creator
Creator

hello,

 

you could try and use a tXMLMap and have several outputs depending on the field has value or not.

if you connect the tXMLMap  to a trestclient :

trestclient input schema:

column -> body

type > Document

basic settings

contenttype > json

acceptype> json

advanced settings:

log messages

drop json request root

wrap json response

 

 

it will send a json request.

 

i make a call with txmlmap -> trestclient to make json request


xml_json.jpg
Anonymous
Not applicable
Author

It's working! Thanks a lot!

 

My mistake was that the option "Drop JSON Request Root" was uncheked