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: 
krrohit1256
Contributor
Contributor

trestRequest POST method with JSON parameter and use the parameter to create a query

Hi All, 

i have a rest service with POST method. For the payload (JSON), I am considering schema as  'body' String type.

i need to extract the parameters passed in the payload and create a query and fetch data from database.

i am using 'trestRequset' component followed by 'tExtractJsonFields' component.

Could you plz help me with configuring the components to extract the Json fields.

payload:

{"ID":"5","FIRST_NAME":"kumar","LAST_NAME":"rohit"}

payload example:0683p000009LsZM.png

 

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Your JSON is pretty simple, this will make it easy using the tExtractJSONFields component. 

{
"ID":"5",
"FIRST_NAME":"kumar",
"LAST_NAME":"rohit"
}

Make the following changes in your tExtractJSONFields component.....

1) If you set the "Read By" to "JsonPath"

2) "JSON field" to "body"

3) Create a new schema with a column for "ID", "First_Name" and "Last_Name".

4) In the "Loop jsonpath query" put "$"

5) In the Mapping table add the following JSONPaths next to the relevant column....
"ID"

"First_Name"
"Last_Name"

 

This should do it.

 

View solution in original post

2 Replies
Anonymous
Not applicable

Your JSON is pretty simple, this will make it easy using the tExtractJSONFields component. 

{
"ID":"5",
"FIRST_NAME":"kumar",
"LAST_NAME":"rohit"
}

Make the following changes in your tExtractJSONFields component.....

1) If you set the "Read By" to "JsonPath"

2) "JSON field" to "body"

3) Create a new schema with a column for "ID", "First_Name" and "Last_Name".

4) In the "Loop jsonpath query" put "$"

5) In the Mapping table add the following JSONPaths next to the relevant column....
"ID"

"First_Name"
"Last_Name"

 

This should do it.

 

Niki1
Contributor
Contributor

Thanks for details, was helpful.