This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
{ "error":{ "messages":[ "Web alias has been used in multiple configurations." ] } }
The error itself is not very surprising.
I guess I can fix it by changing the paths from /getStock to /dev/getStock and /acc/getStock, but that would mean I have to change the API Definition manually every time I promote something.
So my question is: Is there a more elegant solution to handling REST Api's on multiple partitions?
I don't know if this will help at all but, when you compile a Server Module with an API definition a "map" entry gets written into a conf file that is used at the SYSTEM level and not at the PARTITION level.
In the LANSA Install/run/conf folder should be the webmodules.conf file.
It's a JSON file that maps HTTP requests to Server Module Routines.
This file defines a default partition and I think you can define the partition in the map; however I don't think there is a way to map a single request to multiple partitions.
Be aware that any manual changes to this file will be lost when a Server Module with an API definition is compiled.
The only other "elegant" way that I am aware is to deploy to multiple SYSTEMS instead of PARTITIONS. This is what we do, we have a DEV and PROD system and each have the same partition. Deployments are not very nice, because we have to manually edit the webmodules.conf file on PROD when we deploy a new API (the modules are already compiled so we don't have to worry about over writes).
It would be nice if there was a xPartition variable (like xLanguage) that could be used in the URL to map to the correct partition.
You may want to contact support and see if they have a better option.