Author Message
SimonBrown
Joined: Feb 21, 2014
Messages: 58
Offline
I have a REST service which returns a simple JSON format response.
I can see the response in a variable if I create an output variable using the (ALL)

However, when I try to create output variables for the response I don't get the, the log shows storing nothing [] to my destination variables.

Example JSON response is;
{
"market": "cz",
"langCd": "cs",
"operatorVDN": "100111",
"messageCount": 2,
"orderPlaceDate": true,
"creditForNegative": true,
"messagePin": 3456,
"playTemp1": true,
"playTemp2": true
}
I understand it is case sensitive so checked that.
I have tried specifying variable as (taking second item as example);
langCd
$langCd
.langCd
$.langCd
/langCd
//langCd

These are various json path syntax options from what I can see online.

The sample REST application (which no longer works) has output variables looking like //name/variable

Can anyone explain what the syntax should be, or point me to some valid documentation, so I can directly output REST response to my complex variable
Thanks


Unless otherwise stated. EP 7.2.0.0.1117 Dev: JVM: 1.8.0_171 OD 7.2.1.0502 tomcat-8.5.23
SimonBrown
Joined: Feb 21, 2014
Messages: 58
Offline
To add;

I can see my (ALL) response in trace
Storing [{"mrktCd":"gb","defaultLangCd":"en","operatorVDN":"100101","messageCount":1,"orderPlaceDate":true,"creditForNegative":true,"messagePin":6543,"playTemp1":true,"pupDigitNumber":0,"pinForPersonal":true,"personalMenu":"1111111","hasAlternativeLanguages":true,"playTemp2":true}] to: RESTVars:Response

Just tried the "????" button below the "Delete" button in the REST editor UI, not sure what button says as using higher DPI in windows and eclipse is not rendering button correctly, I only get top few pixels of button.

faked values to get response from Web service inside Eclipse and the returned view ONLY shows the first entry in the JSON screen, in above that's "mrktCd". The rest of the fields are not shown.
This makes be think the REST parser is not collecting the other fields? (or eclipse button to query REST is buggy)
The JSON is a valid format, checked that with JSON Editor online
Quite confused on this, is the REST object fussy on JSON format?

Any tips appreciated, wasted far too much time on this already but need to get structure right for rest of script REST calls


Unless otherwise stated. EP 7.2.0.0.1117 Dev: JVM: 1.8.0_171 OD 7.2.1.0502 tomcat-8.5.23
SimonBrown
Joined: Feb 21, 2014
Messages: 58
Offline
in case anyway from Avaya reads, or other gets similar issue, this is what I found...

OD REST connector does not seem to handle flat JSON structure as depicted in opening post.
I had to add a parent object to the response (I can mock this but customer REST service does not have this...)
so, changing to;
{
"response" : {
"market": "cz",
"langCd": "cs",
"operatorVDN": "100111",
"messageCount": 2,
"orderPlaceDate": true,
"creditForNegative": true,
"messagePin": 3456,
"playTemp1": true,
"playTemp2": true
}
}
and changing output params to;
response/langCd
yielded correct responses and placed JSON values into my OD variables.

This feels like a bug in the REST object, my flat JSON is perfectly valid JSON response in any other, or online JSON interpreter.


Unless otherwise stated. EP 7.2.0.0.1117 Dev: JVM: 1.8.0_171 OD 7.2.1.0502 tomcat-8.5.23
MaheshKumar123
Joined: Sep 24, 2018
Messages: 19
Offline
Did we get any resolution on this other than adding a parent object to response. i am also facing similar problem in OD.
SimonBrown
Joined: Feb 21, 2014
Messages: 58
Offline
If I recall I got a "working by design" type statement even though to me, its clearly not correctly handling valid json format.
We had to Java this which was a pain.

Unless otherwise stated. EP 7.2.0.0.1117 Dev: JVM: 1.8.0_171 OD 7.2.1.0502 tomcat-8.5.23
MaheshKumar123
Joined: Sep 24, 2018
Messages: 19
Offline
Hope next OD release will handle these kinds of issues as REST has now become so famous and everybody is moving towards REST based service.

We also ended up with a java servlet change to handle this.
Go to:   
Mobile view