Rest API versioning and redirection
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
Can someone provide some information on this? On Mon, Feb 28, 2022 at 4:47 PM Rishi Agr 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
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 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.