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: 
iamabhishek
Creator III
Creator III

tRestClient response received is not in correct format

We are trying to use tRestClient to get corresponding responses from a REST webservice and extract the data and bring to our use. 

But the response when received is a bit off as 'body' is received as null where-else we have the complete content of response from the server end in 'string'.

'HTTP Method' is 'GET'

'Accept Type' is 'Any'

 

The response received when printed using tLogRow -

|statusCode|body|string |
|=---------+----+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------=| |200 |null|{ "items" : [ { "Salutation" : null, "FirstName" : "Jessica", "MiddleName" : null, "LastName" : "Ashley" ], "count" : 10, "hasMore" : true, "limit" : 10, "offset" : 0, "links" : [ { "rel" : "self", "href" : "https://///emps", "name" : "emps", "kind" : "collection" } ] }

Let me know if any more information is required on this, thanks in advance for any help.

Platform: Talend Open Studio for Data Integration Version: 6.5.1

Labels (3)
15 Replies
iamabhishek
Creator III
Creator III
Author

I have already tried using $.items[*], which resulted in this -

0683p000009LxbG.jpg0683p000009LxFn.jpg

This is the working one where I referred to the json file and did the extract - 

0683p000009LxbL.jpg0683p000009Lwwv.jpg

 

iamabhishek
Creator III
Creator III
Author


@rhall wrote:

JSON as text -


{
	"items": [{
		"Salutation": null,
		"FirstName": "Jessica",
		"MiddleName": null,
		"LastName": "Ashley",
		"PreviousLastName": null,
		"NameSuffix": null,
		"DisplayName": "Jessica Ashley",
		"SalutationLOV": [{
			"LookupCode": "DR.",
			"Meaning": "Doctor"
		}],
		"photo": [],
		"assignments": [{
			"AssignmentName": "Junior Designer",
			"PersonTypeId": 300000000180948,
			"GradeLadderId": null
		}]
	},
	{
		"Salutation" : null,
		"FirstName" : "Emily",
		"MiddleName" : null,
		"LastName" : "Merced Melendez",
		"PreviousLastName" : null,
		"NameSuffix" : null,
		"DisplayName" : "Emily Merced Melendez",
		"SalutationLOV": [{
			"LookupCode": "DR.",
			"Meaning": "Doctor"
		}],
		"photo": [],
		"assignments": [{
			"AssignmentName" : "Hand Assembler",
			"PersonTypeId" : 300000000180948,
			"GradeLadderId": null
		}]
	}],
  "count" : 2,
  "hasMore" : true,
  "limit" : 2,
  "offset" : 0,
  "links" : [ {
    "rel" : "self",
    "href" : "https://xxxx-xxxx.xx.xxx.xxxxxxxxxxx.com:443/xxxxXxxx/resources/11.12.1.0/emps",
    "name" : "emps",
    "kind" : "collection"
  } ]
}
Anonymous
Not applicable

Can you attach the tLogRow to your tRestClient component and send me the output? I have just tested this using a tJavaFlex (to emulate the response of the service) and the same config (exactly) as your setup (where you use the tRestClient). I got the following response....

 

.---------------------+---------+-------------------.
|                     tLogRow_1                     |
|=--------------------+---------+------------------=|
|Fullname             |Firstname|Description        |
|=--------------------+---------+------------------=|
|Jessica Ashley       |Jessica  |["Junior Designer"]|
|Emily Merced Melendez|Emily    |["Hand Assembler"] |
'---------------------+---------+-------------------'

I suspect that the output from your service might be slightly different from what is in your file. It is easy as a developer to inadvertently modify your dataset when trying out things like this. But your JSONPaths work perfectly as you've shown in your previous post.

iamabhishek
Creator III
Creator III
Author

Here you go -

0683p000009LxTO.jpg

 

The output - attached (due to character limitations)



 

response.txt
Anonymous
Not applicable

I have tested that data and it works perfectly for me. The only thing left for me to test would be the actual web service, but I am assuming that you cannot give that to me to try. I am beginning to think that there may be something corrupt in your job. It is only a small job, can you rebuild it from scratch and test that? This certainly isn't normal for Talend, but can happen under some circumstances.

iamabhishek
Creator III
Creator III
Author

Thank you @rhall for your patience thus far.

Yes indeed the web service is authentication based and I am afraid that I couldn't share 0683p000009MPcz.png

I am puzzled and out of ideas on exactly what has been happening that the response from tRestClient couldn't be extracted using tExtractJsonFields. 

Let me try to rebuild the job, maybe a new job else would try in some other system too. Will keep posted for any break-through.