REST service for JSON payload - OE 11.3.1

Posted by Tony on 29-May-2014 00:42

The default behaviour of the created REST service expects the JSON payload to be encapsulated within

{"request":

......

......

}

 

The thrid partyies that want to use our REST service can not make changes to produce the format I need.

I created the service using OE 11.3 devloper studio. Is there a way to have my service do the encapsulation?

 

Thanks, Tony.

All Replies

Posted by Srinivas Munigala on 29-May-2014 02:27

Hi Tony,
 
OpenEdge REST application supports only JSON format.
 
Thanks,
Srinivas Munigala.
 
[collapse]
From: tonyj [mailto:bounce-tonyj@community.progress.com]
Sent: Thursday, May 29, 2014 11:14 AM
To: TU.OE.Development@community.progress.com
Subject: REST service for JSON payload - OE 11.3.1
 
Thread created by tonyj

The default behaviour of the created REST service expects the JSON payload to be encapsulated within

{"request":

......

......

}

 

The thrid partyies that want to use our REST service can not make changes to produce the format I need.

I created the service using OE 11.3 devloper studio. Is there a way to have my service do the encapsulation?

 

Thanks, Tony.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by Tony on 29-May-2014 03:29

Hi Srinivas,

Is the opening tag {"request": ..... } a JSON standard or is it something that the OpenEdge REST application does.

Either way, the third party can not send the JSON payload with the {"request": ... } tag.

I just need to know if it's possible to 'Insert' the tag on incomming POST's.

Thanks, Tony.

Posted by Srinivas Munigala on 29-May-2014 03:41

That is JSON standard.
 
You can use any third party tool to convert other formats data to JSON format.
 
[collapse]
From: Tony [mailto:bounce-tonyj@community.progress.com]
Sent: Thursday, May 29, 2014 2:00 PM
To: TU.OE.Development@community.progress.com
Subject: RE: REST service for JSON payload - OE 11.3.1
 
Reply by Tony

Hi Srinivas,

Is the opening tag {"request": ..... } a JSON standard or is it something that the OpenEdge REST application does.

Either way, the third party can not send the JSON payload with the {"request": ... } tag.

I just need to know if it's possible to 'Insert' the tag on incomming POST's.

Thanks, Tony.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by Tony on 29-May-2014 03:54

I could not find any reference on the web that states the JSON payload for a REST service POST must have the opening {"request": .. } tag.

I'm thinking this is an OE requirement when you want to map objects in the payload to input parameters of a procedure. This is something that I discovered when I created my REST service. I tested it by POSTing a payload with and without the {"request": .. } tags.

The payload without the tag failed to map the objects.

The payload with the tag mapped the objects to the input parameters and my procedure was able to read the value.

So back to my original question, can the REST service 'Insert' the {"request": .. } to an incomming POST?

Thanks, Tony.

Posted by Srinivas Munigala on 29-May-2014 05:25

I was not very keen about the “request” tag, that is my mistake, my apologies.
 
Yes, it is specific to OpenEdge. If you do not want to have that in the payload, you just map the objects directly to the body instead of the node (i.e. [Drop a parameter here…]).
 
[collapse]
From: Tony [mailto:bounce-tonyj@community.progress.com]
Sent: Thursday, May 29, 2014 2:25 PM
To: TU.OE.Development@community.progress.com
Subject: RE: REST service for JSON payload - OE 11.3.1
 
Reply by Tony

I could not find any reference on the web that states the JSON payload for a REST service POST must have the opening {"request": .. } tag.

I'm thinking this is an OE requirement when you want to map objects in the payload to input parameters of a procedure. This is something that I discovered when I created my REST service. I tested it by POSTing a payload with and without the {"request": .. } tags.

The payload without the tag failed to map the objects.

The payload with the tag mapped the objects to the input parameters and my procedure was able to read the value.

So back to my original question, can the REST service 'Insert' the {"request": .. } to an incomming POST?

Thanks, Tony.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by Michael Jacobs on 29-May-2014 07:14

To add a bit of additional information: the {"request":...}, {"response":...}, and {"error":...} JSON payloads are proprietary formats implemented by OpenEdge to enable tunneling RPC like request parameters to an AppServer.   They are the primary payload formats used by the OpenEdge Mobile JSDO support.  

However, a developer does not have to use those formats at all if you are creating your own custom REST service to service any type of http client.   The OpenEdge REST adapter [service] allows you the option of not using the restrictive REST mapping found in Mobile services, and to manually map different types of ABL data types to a http body (plus a lot more) in a wider variety of AppServer procedures and classes.  

The choice is up to the developer, but the manual do-anything-for-anybody approach is much more work than what the Mobile JSDO requires for doing simple CRUD and invoke operations.  

Posted by Tony on 29-May-2014 19:16

Hi Michael,

Thanks for the clarification. That was the info I was after.

I have experience with the Sonic workbench, so I was trying to find the equivalent method in the REST resource editor of developer studio.

This is where I'm at. As per the screen shot, I am not able to change the Expression value which always prefixes the 'request' tag.

With the sonic workbench I had to add a parameter to a properties file that allowed me to make those changes.

 

This thread is closed