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: 
himanshup
Contributor III
Contributor III

tWriteJSONField to tRESTClient

Hello,
I have an output from tWriteJSONField component such as:
|{"username":"A.Apple","email":"Andres.Apple@test.edu"}
|{"username":"desri_tst","email":"desri@test.edu"}

I have to use that in calling API with tRESTClient component where the url should be:

context.RestAPI_URL + "community/users/" + <username from the JSON list above> + "/disable/"

 

I also have "token" in the Query parameters.

I am not familiar as to how to 'plug' the username from the JSON into the URL string

himanshup_0-1732648935397.png

himanshup_0-1732649627501.png

 

Thank you

 

PS: I have tested this in postman, and the API call works

https://<targetURL>/community/users/desri_tst/disable?token=Lrlj78tt9vrEY3cuVSCGKhpPDag_6HEoJb5pCe8q_x3UnFtzpMKHXr-uLM3zeo6n9RxSOLo8GOigPXQqBZOk5CZJIBUDa9YjRc-egn6Qu42kcOS-ZkJtNFe8u5FY5lx4srkgQcT53aGSfeh6u..

(I have edited the token value above for security)

 

 

Labels (3)
1 Solution

Accepted Solutions
Shicong_Hong
Employee
Employee

Based on the example you provided in Postman, it appears that you only need the username value ("desri_tst") and not the entire JSON string. If that's the case, why did you use a tWriteJsonField to write a JSON string? Can you please explain this?

If you only need the username in tRestClient component, you can use tFlowToIiterate to iterate and call the API for each username, eg:

...tlogRow3--main(row9)--tFlowToIterate--iterate--tRestClient. 

on tRestClient, set the URL as:

context.RestAPI_URL + "community/users/" + (String)globalMap.get("row9.username“)+ "/disable/"

Regards

Shong

View solution in original post

2 Replies
Shicong_Hong
Employee
Employee

Based on the example you provided in Postman, it appears that you only need the username value ("desri_tst") and not the entire JSON string. If that's the case, why did you use a tWriteJsonField to write a JSON string? Can you please explain this?

If you only need the username in tRestClient component, you can use tFlowToIiterate to iterate and call the API for each username, eg:

...tlogRow3--main(row9)--tFlowToIterate--iterate--tRestClient. 

on tRestClient, set the URL as:

context.RestAPI_URL + "community/users/" + (String)globalMap.get("row9.username“)+ "/disable/"

Regards

Shong

himanshup
Contributor III
Contributor III
Author

Hi,

Yes I did that route and have been able to make it work as intended.

Thank you.

himanshup_0-1733846432870.png