Question about Partitions and RESTful Web Services

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.
Post Reply
pkoopmanpk
Posts: 29
Joined: Wed Apr 26, 2017 7:12 pm

Question about Partitions and RESTful Web Services

Post by pkoopmanpk » Thu Jan 09, 2020 2:15 am

I build a small POC using the REST Api interface.

After promoting the source from partition DEV to partition ACC I get an error.

Code: Select all

{ "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?

jyoung
Posts: 673
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Re: Question about Partitions and RESTful Web Services

Post by jyoung » Tue Jan 14, 2020 2:20 am

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.

Hope this helps,
Joe

pkoopmanpk
Posts: 29
Joined: Wed Apr 26, 2017 7:12 pm

Re: Question about Partitions and RESTful Web Services

Post by pkoopmanpk » Wed Jan 15, 2020 1:54 am

Thank you for your information.

Post Reply