[Apiman-user] How to update backend implementation URL for published Service without changing the version

Eric Wittmann eric.wittmann at redhat.com
Mon Jan 4 11:26:15 EST 2016


Hi Sanjay, thanks for the questions.

Currently there is no easy way to update the backend implementation 
endpiont URL without creating a new version of the service.

However, if this is a one-off sort of thing then you may be able to get 
it done.  It depends mostly on what configuration you are using.  But 
I'll explain based on the most recent 1.1.x release (1.1.9.Final) with 
its default configuration.

The Manager and Gateway are decoupled, resulting in the duplication of 
*some* of the data (including the endpoint URL).  So when you "publish" 
a service from the Manager, the Gateway is given information about the 
service.  This information is stored in the Gateway's "registry".  By 
default the registry implementation is elasticsearch.  So if you wanted 
to change the endpoint URL for a service, you would need to update that 
information in your Database (you did this) *and* in elasticsearch.

It's actually not that difficult to update the information in 
elasticsearch.  You'll need to find the correct record and then update 
it.  If you're using the default installation, then ES is running on 
port 19200.  If you want to change the following service:

Organization:  Example
Service ID:    MyService
Version:       1.0

Then you might do something like this:

curl -XGET 
http://localhost:19200/apiman_gateway/service/Example:MyService:1.0/_source

You could then take that JSON result, modify the bits you want to 
change, and then update it like so (as an example - please replace the 
JSON below with the JSON you get back from the GET above):

curl -XPUT 
http://localhost:19200/apiman_gateway/service/Example:MyService:1.0 -d '
{
   "endpoint" : "http://UPDATED-ENDPOINT-HERE",
   "endpointType" : "rest",
   "publicService" : true,
   "organizationId" : "Example",
   "serviceId": "MyService",
   "version" : "1.0",
   "endpointProperties": [],
   "policies":[]
}
'

Once this is done you'll have to restart apiman so that the Gateway 
picks up the changes.

Note: we are making some changes in apiman 1.2.x that will make all of 
this easier under some circumstances.  In particular, as of apiman 
1.2.0.Final you will be able to re-publish "Public" services (now called 
APIs).  So if the API is public then you can simply make changes and 
then republish those changes to the Gateway.  If the API is *not* public 
then the current semantics are the same:  you cannot make changes and 
republish because that may violate contracts that consumers have made 
with your API.

-Eric


On 12/29/2015 12:19 PM, Sanjay Melinamani wrote:
> Hi All,
> I am using APIMAN 1.1.9 and for an existing API that I have published to
> consumers, I like to change its backend implementation end point URL
> without changing the API service version.
> I updated the backend implementation URL in database table
> "service_versions". I can see the updated URL from UI but still the
> gateway is using the old implementation URL specified.
> Does it cache the implementation URL once the service is published ? Is
> there anyway I can update  the implementation URL for an existing service?
>
> Appreciate your time and help.
>
> Thanks
> Sanjay
>
>
>
>
> _______________________________________________
> Apiman-user mailing list
> Apiman-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/apiman-user
>


More information about the Apiman-user mailing list