Versioning API Proxy

I have a proxy with hosted target with the basePath as /v1/offers (based on APIgee books, this is the best way to accomplish versioning)

So now, we want to do some major changes to the API and keep version 1. What I tried to do is change the basePath to /v2/offers and deploy.

The results is that I have two deployed revisions, but unfortunately both are routing to the same Target endpoint.

I'm surprised that Apigee talks a lot about API best practices and versioning, and yet doesn't have an easy way to accomplish versioning.

Also deploying to a different proxy is no longer an option since we reached the limit of hosted targets.

0 9 529
9 REPLIES 9

Not applicable

The v1 and v2 have separate base path, so both are deployed. Apigee differentiate on the basis of base path.

Allowing v1 and v2 at the same time handle traffic is a best practice in versioning concept.

Versioning design suggests to support the old one till all the users migrate to new one. Also each new version should support the old.

That's why you should allow v1 and v2 both to take the traffic and later you can disassociate the v1 when it will have the minimal impact

I am doing that. I have both v1 and v2 deployed (each on a specific revision). But v1 seems to redirect to the hosted target of v2 for some reason.

Then you should have different target endpoints for v1 and v2 if you want both pointing to different.

How can this be achieved if my Proxy is a Hosted Target?

@Ghassan Barghouti - I am guessing you have two Proxy endpoints with two different basepath in the same proxy ? Am also assuming you have two target endpoints in the same proxy (for v1 and v2).

If thats the case and if you want each of those to be going to different targets.

Just update the RouteRule condition of your v2 proxy to point to the v2 Target Endpoint.

For example, if my v2 TargetEndpoint is configured as "Target-v2", then my RouteRule config in v2 Proxy endpoint will be

<RouteRule name="v2">
        <TargetEndpoint>Target-v2</TargetEndpoint>
    </RouteRule>

NOTE: If you have the above structure, try deploying v1 and v2 as separate proxies so that you have control over them independently. Otherwise if you make a change to one of them, the other also will get deployed (go down for a few seconds) as they are on the same proxy

I have 1 proxy endpoint that differs from a division to another. For example, Revision 1 has /v1/offers, Revision 2 has /v2/offers Both are deployed since they have different base path.

Also this proxy is NodeJS hosted target. So I guess it can only have 1 Target Endpoint?

Not applicable

Yes, the proxy endpoint is one and it allows multiple revisions deployed when the base path is different.

But your hosted target should have both the old and new one supported as I had specified you should make both old and new available for users to seamlessly migrated.

You can have multiple endpoints, and can configure multiple hosted targets.

Also can add one route rule with condition of the base path in the proxy endpoint to route to another target endpoint.

I'm just not sure how to make multiple hosted targets on the same proxy? I can make multiple proxy end points, just not sure how to make multiple target endpoints in a Hosted Target proxy.

Can you provide some code examples please?