Francis Mwangi Chege
Francis Mwangi Chege

Reputation: 55

Multiple Google Cloud Endpoint API versions in the same Appengine Version

I have an android app in alpha stage that I am testing how I will be managing updates both in the server and client side..

First release to users. My android is using generated classes from this base

class and deployed to the default Appengine version.
@Api(name = "myAPIName", version = "v1
public class AbstractEndpoint<T>{
}

<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
   <application>myapp</application>
   <module>default</module>
   <version>1</version>
</appengine-web-app>

2nd Release I increment the Api version from V1 to V2 and use the generated classes in my for my 2nd app release. I deploy the backend to the same default appengine version 1.

@Api(name = "myAPIName", version = "v2
public class AbstractEndpoint<T>{
}

<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
   <application>myapp</application>
   <module>default</module>
   <version>1</version>
</appengine-web-app>

The problem is that after the upgrade only the latter client apps using v2 can cases the Appengine endpoint v2 and those using V1 can no longer access the api v1. Either V2 overwrites V1 or something else or both v1 and V2 cannot run in the same Appengine instance or something else..

Have tried combing the document, and stack overflow for clues with no much success.

Upvotes: 4

Views: 447

Answers (1)

Jeffrey Godwyll
Jeffrey Godwyll

Reputation: 3893

By just bumping up the version number to v2, endpoints no longer knows of any v1 because it'll be no where in your project and that could prove messy.

Unless you are no longer supporting v1 (which you clearly are), you'll want to avoid just incrementing the version.

Ideally, What you could do is to use a variation of API versioning since you want to support both users(v1 & v2) side by side.

The following are approaches you could use.

This 1st example demonstrates a form of versioning whereby v2 of your API (probably) has nothing in common with v1:

@Api(name="myAPIName", version="v1")
class MyAPI1 {
    ...
}

@Api(name="myAPIName", version="v2")
class MyAPI2 {
    ...
}

or this example where v2 of the API extends v1 in some way:

@Api(name="myAPIName", version="v1")
class MyAPI1 {
    ...
}

@Api(version="v2")
class MyAPI2 extends MyAPI1 {
    ...
}

This way both versions of your API will live in the same version of your app engine project.

Upvotes: 1

Related Questions