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
Code Block | ||
---|---|---|
| ||
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
Code Block | ||||
---|---|---|---|---|
| ||||
GET /v3/namespaces/<namespace-id>/artifacts |
Creating applications from artifacts:
REST call to create application from artifact
Code Block | |||
---|---|---|---|
| |||
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 .
...
Starting/Stopping programs of a particular version of an Application:
Code Block | theme | Emacs|
---|---|---|
| ||
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 |
...
Deleting a version of an Application:
Code Block | theme | Emacs|
---|---|---|
| ||
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)
Code Block | ||||
---|---|---|---|---|
| ||||
GET|POST|PUT|DELETE /v3/namespaces/<namespace-id>/apps/<app-id>/versions/<version-id>/services/<service-id>/methods/<method-name> |
...
2. Configuration based Routing – configuration based routing will be used when the method call is made to non-versioned API:
Code Block | theme | Emacs|
---|---|---|
| ||
GET|POST|PUT|DELETE /v3/namespaces/<namespace-id>/apps/<app-id>/services/<service-id>/methods/<method-name> |
...
Setting up route configs for Config based routing
REST call for updating Updating route config:
Code Block | ||||
---|---|---|---|---|
| ||||
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:
Code Block | ||||
---|---|---|---|---|
| ||||
GET /v3/namespaces/<namespace-id>/apps/<app-id>/services/<service-id>/routeconfig |
Delete Route Config:
Code Block | theme | Emacs|
---|---|---|
| ||
DELETE /v3/namespaces/<namespace-id>/apps/<app-id>/services/<service-id>/routeconfig |
...