Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Jmiles1658991691
Contributor III
Contributor III

How we can upload .jpg with trestclient component

Hi Team,

I am able to upload .jpg with postman

0695b00000StM9qAAF.png

but in talend I am confused how I can pass my .jpg path in trestclient

0695b00000StMAFAA3.png

1 Solution

Accepted Solutions
ann-gaelle
Partner - Contributor III
Partner - Contributor III

Hi in fact you can transfer the schema of your tfixedflowInput on the tRestclient. That should solve this error normally. (by propagating changes, or by looking to the schema of the entrance in the tRestClient)

 

Hope it helps,

 

Good luck

View solution in original post

11 Replies
Jmiles1658991691
Contributor III
Contributor III
Author

Hi any suggestion team 

 

Appreciate your help.

 

Thanks

ann-gaelle
Partner - Contributor III
Partner - Contributor III

Hi,

If you only need to pass the path of the jpg try to put before the tRestClient a tWriteJsonField with the adequat structure here I think it's { "photo" : "C:/PATHOFPICTURES" } and then a main row from the writeJsonField to tRestClient. It's the main row which gives body to tRestClient.

 

However if it's an image, it would be helpful to know what does it means ? Is it a matrix of the images wich is needed ? Or something else ?

Jmiles1658991691
Contributor III
Contributor III
Author

Hi @Ann-Gaëlle Gouerec​ thanks for reply , It is a image which I want to upload

Jmiles1658991691
Contributor III
Contributor III
Author

I'm trying with below parameters & headers but getting below error

 

0695b00000StMSZAA3.png 

 

0695b00000StMVwAAN.png 

 

0695b00000StMWQAA3.png

ann-gaelle
Partner - Contributor III
Partner - Contributor III

Photo is not a query parameter. In postman it appears as body. To pass it as body you will need to pass the information by the row and adding other component to structure it the way your api wants it. If it wants JSON you need to read a json file per exemple (or write a json field) with the adequate strucutre 🙂 An easy solution to test it rappidely is to put a a tfixedflow before your tRestclient and then you add one variable "body" at your schema with the type string. Then you give it the value "{ \"photo\" : \"Path_of_your_photo\" }". Then you put a main row between tfixedflow and trestclient. This is an exemple if the body must be JSON and that's the path that you want to send.

 

Hmmm however you said that wasn't the path that you wanted to send but the pictures itself ? So, for that I would say try to see I you can retrieve an exemple of the body wich is really sent in postman and not just a postman vizualisation maybe it could help you to debug ?

 

Sorry I can't help more, but maybe those ideas would help 🙂

Jmiles1658991691
Contributor III
Contributor III
Author

@Ann-Gaëlle Gouerec​ I have tried with JSON structure but its throwing me error because tRestClient component body data type is document

 

0695b00000StSuYAAV.png

ann-gaelle
Partner - Contributor III
Partner - Contributor III

Hi @Juanita miles​ ,

 

Did you name the column that contains your json string, "string" too ?

 

If it's still not working with this name you can delete "body" of your schema of trestclient for the entry. Like that it will know that the entry only have the string and nothing else.

Jmiles1658991691
Contributor III
Contributor III
Author

@Ann-Gaëlle Gouerec​ 

0695b00000StTQjAAN.pngI have created one context variable as ImagePath & in which I am give value "{ \"photo\" : \"Path_of_my_photo\" }" & then in tfixedflow I created one column , in which I'm giving context variable value

 

0695b00000StTQFAA3.png0695b00000StTRNAA3.pngtFixedFlow column data type is string & tRestClient "body" data type is document so I can't put this value in tRestClient & if I'm putting row6.body value in out13.string then I'm getting error.

Error: {"message":"An error occurred.","trackingNumber":"75f52e..........78e8c8f"}

 

0695b00000StTRrAAN.png

Jmiles1658991691
Contributor III
Contributor III
Author

Hi team any suggestions