ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Multiple REST API projects with same basepath url

Post new topic  Reply to topic
 Multiple REST API projects with same basepath url « View previous topic :: View next topic » 
Author Message
IIB_Intel
PostPosted: Tue Aug 20, 2019 9:39 am    Post subject: Multiple REST API projects with same basepath url Reply with quote

Acolyte

Joined: 07 May 2015
Posts: 64

Is there a way we can split a rest api into multiple IIB Rest applications?

For example:
If swagger.json has one basepath - "/customerdb/v1" with 2 resources/paths defined as

"Customers" and

"/Customers/{CustomerId}".

Each path has its own set of operations (GET, POST, DELETE).

How can I implement this in IIB using two different REST API which will be deployed on same integration server.

I have to keep the basepath same/similar in both. Currently when I try to split it and deploy the 2nd REST application I get error - "/customerdb/v1*" already in use by first application.

I need to do this to provide flexibility in defining more resources belonging to same category.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Aug 20, 2019 10:30 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Can you explain a bit more about your solution?

I'm not clear why this is 2 APIs when (design wise) it looks like 1 API that takes an optional parameter
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
IIB_Intel
PostPosted: Wed Aug 21, 2019 7:35 am    Post subject: Reply with quote

Acolyte

Joined: 07 May 2015
Posts: 64

I just provide a simple example.

We would like to add more resources to the same basepath in an iterative development approach. When we add new resources we don't want to disturb existing resources for the API.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Aug 21, 2019 7:47 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

IIB_Intel wrote:
We would like to add more resources to the same basepath in an iterative development approach. When we add new resources we don't want to disturb existing resources for the API.


Fair enough.

IIB_Intel wrote:
I just provide a simple example.


And happily it lines up very well with the example given here, as this extract shows:

Quote:

Table 1. Example resources
Resource Description
/customers All the customers in the database
/customers/12345 Customer #12345
/customers/12345/orders All orders for customer #12345
/customers/12345/orders/67890 Order #67890 for customer #1234


So just add additional resources as described in the link and you're golden.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
IIB_Intel
PostPosted: Wed Aug 21, 2019 8:27 am    Post subject: Reply with quote

Acolyte

Joined: 07 May 2015
Posts: 64

I am trying to address this need.

A rest API can have many resources like - customer info, customer details etc. When a swagger is generated for that API, multiple team work on different functionality and each team would like to have their own rest application which has the implementation of the corresponding resource.

In APIC you can have multiple swagger documents with same basepath, so from URL perspective all resources are accessed same way but from implementation standpoint they are isolated.

I would like to provide similar functionality for IIB.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Aug 21, 2019 9:11 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

IIB_Intel wrote:
In APIC you can have multiple swagger documents with same basepath, so from URL perspective all resources are accessed same way but from implementation standpoint they are isolated.


By APIC do you mean this or something else?

IIB_Intel wrote:
I would like to provide similar functionality for IIB.


I'd like my car to fly me from the office to home, but alarmingly it doesn't work the same way as an aircraft.

IIB_Intel wrote:
A rest API can have many resources like - customer info, customer details etc. When a swagger is generated for that API, multiple team work on different functionality and each team would like to have their own rest application which has the implementation of the corresponding resource.


A lot hinges on what you define as a "REST API". IBM takes the not unreasonable position that the API is defined by the basepath and the independently developed functions under it route from that.

This is not to say your view is wrong, but skimming through the Cisco implemtation I linked to above seems to work that way as well. The problem here is that I don't think you're going to successfully bend the IBM software to do this.

I can think of two possible solutions for your situation; there may well be other, better solutions out there and someone may well suggest one in a minute.

The first solution is to slap the development teams round a bit, get them a decent collaboration tool and leave them to it. Nothing in IIB is preventing them implementing a resource separate, distinct and entirely their own for any given function round a common root, which is a good way of organizing APIs. Depending on how the Swagger is authored, they might have to update a central copy(ies) of it(them) (hence the need for a collaboration tool) but whatever you're using for source control can almost certainly hold the Swagger with all the controls and workflow you need.

The second solution would be to put a bit of network hardware in front of IIB and have that map all the API calls to whichever independently developed, IIB hosted application is supporting them . Maintaining the mapping would be a full time job, and this would certainly be my clear second choice, & not just because I enjoy slapping developers.

As I said, one of the many people smarter than me may well post a better solution momentarially.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
IIB_Intel
PostPosted: Wed Aug 21, 2019 10:30 am    Post subject: Reply with quote

Acolyte

Joined: 07 May 2015
Posts: 64

Somehow I feel I didn't do a good job in explaining the issue. I will try one more time.

We are talking about resources/nested-resources.

Forexample: if my resources are organised like "/customers/:customerId/projects/:projectId/orders/:orderId/lines/:lineId"

and list can go upto 20s nested resources.

I don't want to implement all of them as just one IIB REST API application (too risky)

By APIC I meant IBM APIC. This is not a limitation there. I can break one swagger document into multiple swagger documents having same basepath with each implemented separately.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Aug 21, 2019 10:49 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

IIB_Intel wrote:
Forexample: if my resources are organised like "/customers/:customerId/projects/:projectId/orders/:orderId/lines/:lineId"

and list can go upto 20s nested resources.


Exactly as outlined in the IBM link I shared.

IIB_Intel wrote:
I don't want to implement all of them as just one IIB REST API application (too risky)


Define "risky". No one, not me, not IBM, are suggesting that all these resources are implemented as one giant lump of code. Again, I point you at that link. For extra clarity:

Quote:
Each resource in the REST API has a set of operations that can be called by an HTTP client. An operation in a REST API has a name and an HTTP method (such as GET, POST, or DELETE).


Quote:
Each operation in the REST API must be implemented as a subflow. A subflow for an operation has a single input node, and a single output node. The implementer of the operation can build the subflow for the operation by using all of the standard message flow nodes available with IBM App Connect Enterprise.


IIB_Intel wrote:
By APIC I meant IBM APIC. This is not a limitation there. I can break one swagger document into multiple swagger documents having same basepath with each implemented separately.


So you have API Connect? Then expose the IIB hosted application in that as anythig you want and get API Connect to sort it out.

API Connect is a specialized REST API management tool and has more capabilities than IIB / ACE. This is one of the reasons the Toolkit has direct integration with API Connect, because IBM think IIB is hosting the applications and API Connect is managing them. Enabling IBM to sell 2 products.

I still don't think you need anything other than IIB / ACE and a tweak to your development workflow to achieve what you're describing.

If you disagree, you need to explain your problem a lot more clearly, especially where it diverges from the IBM example which shows nested resources.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
IIB_Intel
PostPosted: Thu Aug 22, 2019 7:59 am    Post subject: Reply with quote

Acolyte

Joined: 07 May 2015
Posts: 64

Quote:
This is one of the reasons the Toolkit has direct integration with API Connect, because IBM think IIB is hosting the applications and API Connect is managing them. Enabling IBM to sell 2 products.


Exactly, I would like to use this feature where REST apis (multiple swagger documents) represented by same basepaths can be implemented as separate application in IIB and then pushed to APIC from toolkit.

From the link, "The REST API has a base path, which is similar to a context root. All resources in a REST API are defined relative to its base path. The base path can be used to provide isolation between different REST APIs".

IIB lacks this.

I have raised a PMR will post the findings.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Aug 22, 2019 8:32 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

IIB_Intel wrote:
Quote:
This is one of the reasons the Toolkit has direct integration with API Connect, because IBM think IIB is hosting the applications and API Connect is managing them. Enabling IBM to sell 2 products.


Exactly, I would like to use this feature where REST apis (multiple swagger documents) represented by same basepaths can be implemented as separate application in IIB and then pushed to APIC from toolkit.

From the link, "The REST API has a base path, which is similar to a context root. All resources in a REST API are defined relative to its base path. The base path can be used to provide isolation between different REST APIs".

IIB lacks this.

I have raised a PMR will post the findings.
I believe if you want to integrate them separately you'll have to deploy each in a different integration server. Otherwise in the same integration server everything under the same base path should be in the same swagger doc.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
IIB_Intel
PostPosted: Fri Aug 23, 2019 3:24 am    Post subject: Reply with quote

Acolyte

Joined: 07 May 2015
Posts: 64

Yeah that's the problem. If you could have 20s of resources within the same path and resources can be reached thru different "context" as well. Deployment management for 100+ apis becomes nightmare.

Let's see what PMR says.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Multiple REST API projects with same basepath url
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.