0
votes

Can I add multiple endpoints to 1 API in WSO2 Api Manager?

As far as I know I have to create a context and a version. The background is that I just want to make a request like https://api.manager.com/rest/1.0/userList or https://api.manager.com/rest/1.0/tasks.

The userList REST-Controller is implemented on backend A and tasks REST-Controller is implemented in backend B. (A and B are separate web applications)

As far as I know I have to create in my API Manager two APIs with different context values.

The API Manager application would simply subscribe both APIs.

But this would mean that I have to change my requests on the javascript side. This is in my opinion not good because I dont want my javascript application to care about the context. I want that the API Manager delegates to the correct backend automatically. Is this possible? What is best practise?

1

1 Answers

0
votes

You can have multiple endpoints per API using Dynamic Endpoint Feature. When creating the API you need to set the Endpoint Type as "Dynamic Endpoint" and upload a mediation in-sequence that sets the "To" header. Within the sequence you can specify your logic to route to the correct endpoint (setting the correct "To" header) according to the request path. Please read [1] for more information.

[1] http://blog.lakmali.com/2016/08/dynamic-endpoints-in-wso2-api-manager.html