Handling annotations by using API URLs

Before you begin

If the authentication and authorization feature is enabled with the Authentication Server (DEX) installed and configured, the passwordConnector parameter must be added in the dex.yaml file. Also, a security token is needed. For more information, see step 1.4 in topic STEP 4. (Optional) Configuring Authentication Server (DEX).

About this task

The annotation web service runs on the Liberty server. After the annotation REST API is enabled, you can run requests to handle annotations by using URLs with other tools, for example, Postman. For more information about handling annotations in IBM® AD Analyze Client, see section Handling Annotations.

Procedure

Enter one of the following endpoints with the corresponding request body.
The create endpoint: libertyURL/annotations/project/create/ProjectName
When the annotation property of a project is null, this endpoint can be used to create annotations. Otherwise, use the update endpoint. You must specify the annotation keys and values that you want to create in the request body. See the following example:
URL:
http://localhost:9080/annotations/project/create/Regression
Body:
					{
						"testare": "noua_testare",
						"testing": 43,
						"si mai multa testare": "sdasdasdasdasdasdasdasdasdasda",
						"bababa": "dsadasdas"
					}
The update endpoint: libertyURL/annotations/project/update/ProjectName
This endpoint can be used to update existing annotations. If the annotation property of a project is null, this endpoint can also be used to create annotations. You must specify the annotation keys and values that you want to update in the request body. See the following example:
URL:
http://localhost:9080/annotations/project/update/Regression
Body:
					{
						"1": "update_test",
						"2": "update_test_test",
						"3": "test_test_test",
						"4": 45
					}
The delete endpoint: libertyURL/annotations/project/delete/ProjectName
This endpoint can be used to delete existing annotations. You must specify the annotation keys that you want to delete in the request body. The annotation values are optional. See the following example:
URL:
http://localhost:9080/annotations/project/delete/Regression
Body:
					{
						"1": "",
						"2": "",
						"3": ""
					}
The get endpoint: libertyURL/annotations/project/get/ProjectName
This endpoint returns the annotations that are set at the project level. See the following example:
URL:
http://localhost:9080/annotations/project/get/Regression

Results

After a create, update, or delete request is sent, a message is displayed to confirm the result. See the following message examples:
Create annotations operation: successful
Update annotations operation: successful
Delete annotations operation: successful
The following example shows the response to a get request:
{
    "annotations_key_1": "annotations_value_1",
    "annotations_key_2": "annotations_value_2",
    "annotations_key_3": "annotations_value_3",
    "annotations_key_4": "annotations_value_4"
}