release-events-api
REST API16 October 2019 Version: 0.0.3
<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
Required! Access keys are generated from the UCV UI:
Authorization
UserAccessKey <insert key generated by UCV>
Create a deployment programatically
{
"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 -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
}'
Code | Description |
---|---|
200 | Expected response to a valid request |
Create a build programatically
{
"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 -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": []
}'
Code | Description |
---|---|
200 | Expected response to a valid request |
Upload metrics
{
"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 -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"
}
}'
Code | Description |
---|---|
200 | Expected response to a valid request |
Upload metrics file
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
Code | Description |
---|---|
200 | Expected response to a valid request |
POST endpoint for MetricDefinition
{
"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 -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"
}
}'
Code | Description |
---|---|
200 | Expected response to a valid request |