Preferences Microservices
Use the CDAP Preferences Microservices to save, retrieve, and delete preferences in CDAP. Preferences, usage, and examples of using them, are described in Preferences and Runtime Arguments.
All methods or endpoints described in this API have a base URL (typically http://<host>:11015
or https://<host>:10443
) that precedes the resource identifier, as described in the Microservices Conventions. These methods return a status code, as listed in the Microservices Status Codes.
Set Preferences
To set preferences for the CDAP instance, namespace, application, or program, submit an HTTP PUT request:
PUT /v3/preferences/
PUT /v3/namespaces/<namespace-id>/preferences
PUT /v3/namespaces/<namespace-id>/apps/<app-id>/preferences
PUT /v3/namespaces/<namespace-id>/apps/<app-id>/<program-type>/<program-id>/preferences
Parameter | Description |
---|---|
| Namespace ID. |
| Name of application. |
| One of |
| Name of program. |
Properties, as a map of string-string pairs, are passed in the JSON request body.
Preferences can be set only for entities that exist. For example, preferences cannot be set for a namespace that does not exist or an application that has not yet been deployed.
HTTP Responses
Status Codes | Description |
---|---|
| The event successfully called the method, and the preferences were set/ |
| The JSON body has an invalid format. |
| The entity for which preferences are being set was not found. |
Get Preferences
To retrieve the current preferences, issue an HTTP GET request:
GET /v3/preferences/
GET /v3/namespaces/<namespace-id>/preferences
GET /v3/namespaces/<namespace-id>/apps/<app-id>/preferences
GET /v3/namespaces/<namespace-id>/apps/<app-id>/<program-type>/<program-id>/preferences
This will return a JSON String map of the preferences:
{"key1": "value1", "key2": "value2"}
To retrieve the resolved preferences (collapsing preferences from higher levels into a single level), set the resolved
query parameter to true
:
Parameter | Description |
---|---|
| Namespace ID. |
| Name of application. |
| One of |
| Name of program. |
HTTP Responses
Status Codes | Description |
---|---|
| The event successfully called the method, and the preferences were retrieved. |
| The entity for which preferences are being set was not found. |
Delete Preferences
To delete preferences, issue an HTTP DELETE. Preferences can be deleted only at one level with each request:
Parameter | Description |
---|---|
| Namespace ID. |
| Name of application. |
| One of |
| Name of program. |
HTTP Responses
Status Codes | Description |
---|---|
| The event successfully called the method, and the preferences were deleted. |
| The entity for which preferences are being deleted was not found. |
Created in 2020 by Google Inc.