Application Versioning -- User Documentation
Uploading and listing artifact:
In order to create applications with versions, the artifact jars (which contains CDAP application) needs to be uploaded first. Once an artifact is uploaded, an application can be created from it by optionally providing a configuration.
Uploading artifact
POST /v3/namespaces/<namespace-id>/artifacts/<artifact-id> --data-binary @path/to/file-1.1.0.jar
You can view the information about artifacts deployed using the listing endpoint. Â
Listing artifacts
GET /v3/namespaces/<namespace-id>/artifacts
Creating applications from artifacts:
REST call to create application from artifact
POST /v3/namespaces/<namespace-id>/apps/<app-id>/versions/<version-id>/create -d { "artifact": { "name": "WordCount", "version": "3.5.1", "scope": "user"}, "config": {"stream": "purchaseStream"} }
version-id: Needs to be composed only of alphanumeric, -, _ and .Â
Note:
- If a version-id is not specified during application creation, '-SNAPSHOT' is used as the application version
- Â If a version-id ends with '-SNAPSHOT', then that version is mutable and it can be updated using the update app endpoint (more details below).Â
Â
Starting/Stopping programs of a particular version of an Application:
POST /v3/namespaces/<namespace-id>/apps/<app-id>/versions/<version-id>/services/<service-id>/start  POST /v3/namespaces/<namespace-id>/apps/<app-id>/versions/<version-id>/services/<service-id>/stop
Note: We don't support concurrent runs of the same Flow and Worker across multiple versions. That is, flow F1 in v2 of app MyApp can't be started when flow F1 in v1 of app MyApp is running.
Deleting a version of an Application:
DELETE /v3/namespaces/<namespace-id>/apps/<app-id>/versions/<version-id>
Note: No program of this version should be running.
Â
Service Routing:Â
1. Deterministic routing - call methods of a service of a specific version (service of that version should be running)
GET|POST|PUT|DELETE /v3/namespaces/<namespace-id>/apps/<app-id>/versions/<version-id>/services/<service-id>/methods/<method-name>
 Note: Deterministic routing through version-id in the REST API works only in SDK. In distributed mode, as a workaround, the routeconfig can be used to set 100% routing to a version that is desired. This will be fixed in 3.6 (CDAP-7331).
    Â
2. Configuration based Routing – configuration based routing will be used when the method call is made to non-versioned API:
GET|POST|PUT|DELETE /v3/namespaces/<namespace-id>/apps/<app-id>/services/<service-id>/methods/<method-name>
 Say, if the configuration is : { "v1" : 30, "v2" : 30, "v3" : 40 } : 30% of requests are routed to version v1, 30% requests are routed to version v2, 40% requests are routed to v3
Setting up route configs for Config based routing
Updating route config:
PUT /v3/namespaces/<namespace-id>/apps/<app-id>/services/<service-id>/routeconfig -d '{ "v1" : 30, "v2" : 30, "v3" : 40 }'
Note: The route %s should always integers and should sum to 100. Otherwise the config will not be accepted.
View/Get Route Config:
GET /v3/namespaces/<namespace-id>/apps/<app-id>/services/<service-id>/routeconfig
Delete Route Config:
DELETE /v3/namespaces/<namespace-id>/apps/<app-id>/services/<service-id>/routeconfig
Note: If a route config is not present, a random endpoint will be chosen among all the versions.Â