Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
I have already tried using $.items[*], which resulted in this -
This is the working one where I referred to the json file and did the extract -
@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"
} ]
}
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.
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.
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
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.