Business Entity - Data Object - custom HTTP status code for

Posted by tomas.kucera on 13-Jun-2016 15:47

Hi there,

I am trying to work out the following.

I would like to distinguish between UPDATE and CREATE on PUT. When there is a PUT coming in, then if the ID exists, it updates the record and if not, it creates a new one.

What I would like is to return custom HTTP status for the create (201 - Created), announcing that the record has been created instead of updated.

I searched KBase, forums, docs but failed to find any hints.

I found how to do it when having manually mapped REST services.

But I cannot find it for the generated Business Entity and the Data Object service.

Any idea? Thanks in advance!

tom.+

All Replies

Posted by egarcia on 13-Jun-2016 16:47

Hello,

The Data Object Service uses a prescriptive approach and PDSOE generates the corresponding REST interface.

This approach does not allow you to customize the mapping to the HTTP request in the way that a REST service does.

What are you using on the client?

Perhaps, a possible approach is to build a REST Service or a WebSpeed Service that works as a proxy of your actual Business Entity and in it then have the code to return the 201 - Created status code.

Links:

- community.progress.com/.../2190

- community.progress.com/.../2677

I hope this helps.

Posted by Mike Fechner on 13-Jun-2016 23:54

I consider it a general best practice not to expose a Business Entity directly to any (external) consumer. The OERA has always been proposing the use of a Service Interface and the Common Component Specification (CCS-ARCH01) does also recommend so.

A REST Service method or a Webspeed handler can be used to build parts of the Service Interface and manipulate the http responses as needed.

Posted by Peter Judge on 14-Jun-2016 08:15

Which version are you using? If 11.6+ then the best approach is to use the PASOE/Web handlers which give you full access to the request and responses.

Posted by tomas.kucera on 14-Jun-2016 09:06

Yes, I am on 11.6. Thanks all for your replies. I will explore all the options.

Posted by Peter Judge on 14-Jun-2016 09:11

You may also be interested in looking at the next 11.7 ESAP ( community.progress.com/.../ ) which is likely to have something like what you're after.

Posted by tomas.kucera on 14-Jun-2016 09:37

Peter, I cannot see the page ... it give Page Not Found. :(

Posted by Peter Judge on 14-Jun-2016 09:40

Sorry, you need to go here first, and follow the instructions on joining the ESAP community.progress.com/.../23826

This thread is closed