You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Rishi Agr <ri...@gmail.com> on 2022/03/02 07:13:56 UTC

Re: Rest API versioning and redirection

Can someone provide some information on this?

On Mon, Feb 28, 2022 at 4:47 PM Rishi Agr <ri...@gmail.com> wrote:

> Hi,
> I am trying to add API versioning and I found that there is mount-point
> */rest* in *rest-api/ofbiz-component.xml* which is added as a part of the
> path to the API. This is also the case in *swagger-ui.html*. In my
> understanding, there needs to be a configurable property that can be used
> in both the places and the versioning can be configured as some kind of
> property. I tried to do so but was unable to. Please provide a small
> snippet that can help me here. Also, I wanted to add a redirection url
> where if the old version API is called then it can redirect to the new
> version API. Let me know this is possible and a small code snippet would be
> very helpful. Thank you.
>

Re: Rest API versioning and redirection

Posted by Michael Brohl <mi...@ecomify.de>.
Hi Rishi,

the /rest/ endpoint is fixed in the current implementation but you can 
change it bei changing the webapp path on ofbiz-component.xml.

Versioning can be achieved by multiple rest api configurations where you 
set the resource base path to e.g.  path="/v1/parties" or 
path="/v2/parties".

Redirection is not configurable inside OFBiz currently but you can 
easily achieve what you want with an Apache Web Server (which is 
recommended for productive systems anyway) and rewrite rules.

Best regards,

Michael Brohl

ecomify GmbH - www.ecomify.de

Am 02.03.22 um 08:13 schrieb Rishi Agr:
> Can someone provide some information on this?
>
> On Mon, Feb 28, 2022 at 4:47 PM Rishi Agr <ri...@gmail.com> wrote:
>
>> Hi,
>> I am trying to add API versioning and I found that there is mount-point
>> */rest* in *rest-api/ofbiz-component.xml* which is added as a part of the
>> path to the API. This is also the case in *swagger-ui.html*. In my
>> understanding, there needs to be a configurable property that can be used
>> in both the places and the versioning can be configured as some kind of
>> property. I tried to do so but was unable to. Please provide a small
>> snippet that can help me here. Also, I wanted to add a redirection url
>> where if the old version API is called then it can redirect to the new
>> version API. Let me know this is possible and a small code snippet would be
>> very helpful. Thank you.
>>