Lesson 3 Creating a metric record#
Create a metric data record and upload it to UrbanCode™Velocity.
Before you begin
Before you begin this lesson, make sure that you complete the previous lesson.
About this task
In the last lesson, you uploaded a metric definition for the data type "Tutorial Definition" to UrbanCodeVelocity. In this lesson, you create a data record for that type and upload it.
To create a metric data record, complete the following steps:
Procedure
-
Create a curl POST request for the data record.
Most of these fields are familiar to you from the first lesson.
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 '{ "tenantId": "my_tenant_id", "dataSet": "Tutorial data set", "record": { "metricDefinitionName": "Tutorial Definition", "recordName": "My tutorial record", "pluginType": "plugin", "dataFormat": "custom", "executionDate": 1570028414997, "value": { "north": 199, "south": 322, "east": 485, "west": 234 }, "description": "Tutorial data record" }, "application": { "name": "Metric Tutorial" } }'
The
record
object defines the record. You can associate a record to its metric definition by using themetricDefinitionId
, ormetricDefinitionName
property, as we do here. ThepluginType
property is set to the generic value of "plugin". TheexecutionDate
value must be in milliseconds.The
value
object can have an arbitrary number of name-value pairs. The values defined in this property are displayed on the chart. Create enough values to make the chart interesting.The
application
property defines the application to which this record belongs. "Application" can refer to an integrated application, such as an UrbanCode Deploy application, or a set of metric records, among other things. In this tutorial, "Metric Tutorial" refers simply to the record that you upload. -
Run the curl command
The record is uploaded to UrbanCodeVelocity. To confirm this, expand the dashboard's Applications list, as shown in the following graphic.
Results
In this lesson, you created a metric data record of the "Tutorial Definition" type and uploaded it to UrbanCodeVelocity.
What to do next
In the next lesson, you add a Tutorial Definition-type chart to the dashboard and examine the data you created in this lesson.
Parent topic: Implementing custom metrics