Lesson 2 Uploading the metric definition#

Upload the metric definition that you created in the previous lesson.

Before you begin

Before you begin this lesson, make sure that you complete the previous lesson.

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:


  1. 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: UserAcessKey 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 the authorization property, use the user access key that you configured earlier.

  2. 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",
              "barMode": "stack"



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:

Quality chart list

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.

What to do next

In the next lesson, you create a metric data record of the "Tutorial Definition" type and upload it to HCL Accelerate.

Parent topic: Implementing custom metrics