Lesson 2 Uploading the metric definition
Upload the metric definition that you created in the previous lesson.
Before you begin
About this task
Before you can use the metric definition created in the last lesson, you have to upload it.
HCL™ Accelerate provides REST API endpoints and a GraphQL API. In the tutorial, we use curl to access the REST API
endpoint metricDefinition
. If you want to use GraphQL instead, you can
access schema information at the following URL:
https://my_velocity:port/release-events-api/graphiql
.
To upload the metric definition, complete the following steps:
Procedure
-
Using curl, create the header for a POST request, as shown in the following fragment.
curl -X POST "https://my_velocity:port/api/v1/metricDefinition" \ -H "accept: application/json" \ -H "Authorization: UserAccessKey my_user_access_token" \ -H "Content-Type: application/json" \ -k \
REST API endpoints are located at
https://my_velocity:port/api/v1/endpoint_name
. For theauthorization
property, use the user access key that you configured earlier. -
Add the metric definition that you created in the last lesson to the curl request, then submit
the request.
The complete request is shown in the following code example:
curl -X POST "https://my_velocity:port/api/v1/metricDefinition" \ -H "accept: application/json" \ -H "Authorization: UserAccessKey my_user_access_token" \ -H "Content-Type: application/json" \ -k \ -v \ -d '{ "id": "TUTORIAL_DEFINITION", "name":"Tutorial Definition", "category": "quality", "tenantId":"my_tenant_id", "chartDefaults":{ "groupBy":"result", "chartType":"bar", "barMode": "stack" }, "aggregation":{ "operation":"sum" } }'
Results
If the curl command succeeded, you see the new chart listed on the dashboard. To confirm that the command worked, open the dashboard that you created earlier, and then expand the Quality chart list. You can see the chart displayed at the bottom of the quality-type charts, as shown in the following graphic:

If you add the chart to the dashboard display, it won't have any data because you haven’t sent any data of the "Tutorial Definition" type to HCL™ Accelerate.