velocity-info

UC Velocity release-events-api REST API

16 October 2019 Version: 0.0.3

Routes:

<velocityURL>/release-events-api/api<route> Example: https://ucv-stage.hclpnp.com/release-events-api/api/v1/deployments would query the deployments route of UrbanCode’s Stage UCV instance

Authorization:

Required! Access keys are generated from the UCV UI:


/v1/deployments

POST

Description:

Create a deployment programatically

POST Payload Template
{
    "version_name": "<your version name>",
    "version_id_external": "<external version ID>",
    "type": "<deployment type>",
    "id_external": "<optional external ID>",
    "tenant_id": "<your tenantId>",
    "application": {
        "name": "<Your Application Name>"
        },
    "environment_id": "<build environment ID>",
    "environment_name": "<build environment name>",
    "description": "<deployment description>",
    "by_user": "<deployment user>",
    "result": "<deployment result>",
    "start_time": <Epoch timestamp in milliseconds>,
    "end_time": <Epoch timestamp in milliseconds>
}
cURL Example
curl -k -X POST "https://demo.uc-velocity.com/api/v1/deployments" -H 'Authorization: UserAccessKey <YOUR ACCESS KEY>' -H 'Content-Type: application/json' -d '{
    "version_name": "1.0",
    "version_id_external": "1.0",
    "type": "Jenkins",
    "id_external": "1.0",
    "tenant_id": "5ade13625558f2c6688d15ce",
    "application": {
        "name": "Test Application 2"
        },
    "environment_id": "DEV",
    "environment_name": "DEV", 
    "description": "Deployment to DEV 2",
    "by_user": "admin",
    "result": "success",
    "start_time": 1571236638000,
    "end_time": 1571236638000
}'
Responses
Code Description
200 Expected response to a valid request

/v1/builds

POST

Description:

Create a build programatically

POST Payload Template
{
    "id": "<your build ID>",
    "name": "<build name, often your version number>",
    "versionName": "<your version name>",
    "application": {
        "externalId": "<optional external ID>",
        "name": "<Your Application Name>"
        },
    "tenantId": "<your tenantId>",
    "status": "<build status>",
    "url": "<build URL>",
    "startTime": <Epoch timestamp in milliseconds>,
    "endTime": <Epoch timestamp in milliseconds>,
    "requestor": "admin",
    "revision": "<revision, often your commit ID>",
    "source": "<build source, such as Jenkins>",
    "steps": [],
    "history": []
}

cURL Example
curl -k -X POST "https://demo.uc-velocity.com/api/v1/builds" -H 'Authorization: UserAccessKey <YOUR ACCESS KEY>' -H 'Content-Type: application/json' -d '{
"id": "TEST_ID",
    "name": "1.0",
    "versionName": "1.0",
    "application": {
        "name": "Test Application"
        },
    "tenantId": "5ade13625558f2c6688d15ce",
    "status": "success",
    "url": "http://www.google.com",
    "startTime": 1571236638000,
    "endTime": 1571236638000,
    "requestor": "admin",
    "revision": "12345678",
    "source": "Jenkins",
    "steps": [],
    "history": []
}'
Responses
Code Description
200 Expected response to a valid request

/v1/metrics

POST

Description:

Upload metrics

POST Payload Template
{
    "tenantId": "<your tenantId>",
    "dataSet": "<your dataSet>",
    "record": {
        "metricDefinitionId": "<ID value for your existing Metric Definition>",
        "description": "<your metric description>",
        "metricsRecordUrl": "<URL for metrics record>",
        "recordName": "<your record name>",
        "pluginType": "<type of plugin>",
        "executionDate": <Epoch timestamp in milliseconds>,
        "dataFormat": "<data format>",
        "value": <integer value>
    },
    "application": {
        "name": "<your application's name>"
    }
}
cURL Example
curl -k -X POST "https://demo.uc-velocity.com/api/v1/metrics" -H 'Authorization: UserAccessKey <YOUR ACCESS KEY>' -H 'Content-Type: application/json' -d '{
    "tenantId": "5ade13625558f2c6688d15ce",
    "dataSet": "Test Suite",
    "record": {
        "metricDefinitionId": "CUSTOMER_SATISFACTION",
        "description": "Customer satisfaction metric",
        "metricsRecordUrl": "https://www.google.com",
        "recordName": "Customer Survey",
        "pluginType": "plugin",
        "executionDate": 1571236639000,
        "dataFormat": "custom",
        "value": 50
    },
    "application": {
        "name": "Test Application 2"
    }
}'
Responses
Code Description
200 Expected response to a valid request

/v1/metrics/upload

POST

Description:

Upload metrics file

cURL Example
curl --request POST --url https://demo.uc-velocity.com/release-events-api/api/v1/metrics/upload -H "Authorization: UserAccessKey <YOUR ACCESS KEY>" --form 'payload={
    "tenantId": "5ade13625558f2c6688d15ce",
    "record": {
        "metricsRecordUrl": "http://myjenkins/1.8425",
        "metricDefinitionId": "Unit Tests",
        "recordName": "Test version 8425",
        "pluginType": "junitXML",
        "executionDate": 1571240042000,
        "dataFormat": "junitXML"
    },
    "application": {
        "name": "JKE-Finance"
    },
    "build": {
        "url": "http://myjenkins/1.8425"
    }
}' -k  --form file=@junit.xml -i
Responses
Code Description
200 Expected response to a valid request

/v1/metricDefinition

POST

Description:

POST endpoint for MetricDefinition

POST Payload Template
{
	"id": "<YOUR_METRICDEFINITION_ID>",
	"name": "<Your Metric Definition Name>",
	"category": "<your metric definition category>",
	"tenantId": "<your tenantId>",
	"chartDefaults": {
	  "groupBy": "<'value', 'status', or 'result'>",
	  "chartType": "<'line' or 'bar'>",
	  "barMode": "<'stack' or 'group'>"
	},
	"aggregation":{
	  "operation": "<'sum'>"
	}
}
cURL Example
curl -k -X POST "https://demo.uc-velocity.com/api/v1/metricDefinition" -H 'Authorization: UserAccessKey <YOUR ACCESS KEY>' -H 'Content-Type: application/json' -d '{
	"id": "CUSTOMER_SATISFACTION",
	"name": "Customer Satisfaction",
	"category": "quality",
	"tenantId": "5ade13625558f2c6688d15ce",
	"chartDefaults": {
	  "groupBy": "result",
	  "chartType": "bar",
	  "barMode": "stack"
	},
	"aggregation":{
	  "operation": "sum"
	}
}'
Responses
Code Description
200 Expected response to a valid request