Rather than routing requests to different API versions, the same
requirement would be catered if we have one API but route requests to
different back-ends, isn't it? This is how you would do it if so.

Say your application (back-end) context is /bookstore and has versions 1.0,
2.0, etc...

You would define the endpoint of the api (an http endpoint) as
*http://books.com/bookstore
<http://books.com/bookstore>/{uri.var.appversion}*

You would then define an extension sequence for the API which would contain
the logic of getting the user's role(s) (probably from the JWT) and then
decide on the app version to forward the request to and populate a property
named *uri.var.appversion *with the app version

Ex: <property name="uri.var.appversion" value="1.0"/>

This would mean that your final endpoint would be
*http://books.com/bookstore/1.0
<http://books.com/bookstore/1.0>*

Now, the only problem I see here is defining an endpoint as
*http://books.com/bookstore
<http://books.com/bookstore>**/{uri.var.appversion} *from the Publisher UI.
IIRC it does a url validation when saving the endpoint, hence the
validation would fail. But this is something that can be fixed easily :).

Thanks,
NuwanD.


On Thu, Jun 5, 2014 at 2:05 AM, Dmitry Sotnikov <[email protected]> wrote:

> Do we have a capability to route API requests to different URL based on
> the user role?
>
> The sample use-case that someone who asked had in mind was: a multitenant
> application which has both web UI and API access. When the app gets
> upgraded to a new version, they stage upgrades bringing customers to newer
> version in batches. The web front is smart enough to redirect to proper web
> UI version depending on whether the user is upgraded or not, and they would
> like to have similar routing for the API access.
>
> Do we support such a scenario?
>
> --
> Dmitry Sotnikov
> VP of Cloud; WSO2, Inc.;  http://wso2.com/
> email: [email protected]; cell: +1.949.303.9653; Skype: DSotnikov
> Lean . Enterprise . Middleware
>
>  <http://wso2.com/events/>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Nuwan Dias

Associate Tech Lead - WSO2, Inc. http://wso2.com
email : [email protected]
Phone : +94 777 775 729
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to