Save or update metric
- URL: JIRA_URL/rest/snapmetrics-api/latest/metrics
- Method: POST
Body:
{ "id": 1, //only when updating the metric. "key": "Unique name of the metric", "type": "IssueCount", "jql": "type your jql here" }
id attribute should not be placed in json if you want to create a new metric.
Save new UserInput metric with value{ "key": "Employee of the week", "type": "UserInput", "value": "Tyler Durden" }
Update UserInput metric
{ "id": 1, // id of the metric "value": "Marla Singer" }
Update IssuesCount metric with manual value
{ "id": 1, //id of the metric. "manualValue": true, "value": "Tyler Durden" }
Possible results:
status: 200 { "success": true, "message": "Metric was successfully saved" }
status: 400 { "success": false, "message": "key should not be empty" }
status: 400 { "success": false, "message": "type should be valid" }
status: 400 { "success": false, "message": "JQL should not be empty if type is IssueCount" }
List all metrics
- URL: JIRA_URL/rest/snapmetrics-api/latest/metrics
- Method: GET
Result:
[ { "id": 29, "key": "Issues closed by Team A", "type": "IssueCount", "jql": "\"First Closed User\" in membersOf(\"Team A\")", "lastrun": 1522967400014, "value": "0" }, { "id": 30, "key": "Issues closed by Team B", "type": "IssueCount", "jql": "\"First Closed User\" in membersOf(\"Team B\")", "lastrun": 1522967400039, "value": "0" }, { "id": 27, "key": "Issues created last two weeks", "type": "IssueCount", "jql": "created >= startOfDay(-15)", "lastrun": 1522967400043, "value": "53" }, { "id": 28, "key": "Issues resolved last two weeks", "type": "IssueCount", "jql": "resolved >= startOfDay(-15)", "lastrun": 1522967400051, "value": "18" } ]
Show a metric
- URL: JIRA_URL/rest/snapmetrics-api/latest/metrics/{id}
- Method: GET
Result:
{ "id": 27, "key": "Issues created last two weeks", "type": "IssueCount", "jql": "created >= startOfDay(-15)", "lastrun": 1522967580015, "value": "53" }
Delete a metric
- URL: JIRA_URL/rest/snapmetrics-api/latest/metrics/{id}
- Method: DELETE
Possible results:
status: 200
status: 400 { "success": false, "message": "Metric with id[123] could not be found!" }
Execute metric
This REST service immediately executes the metric and stores the result.
- URL: JIRA_URL/rest/snapmetrics-api/latest/metrics/{id}/execute
- Method: GET
Possible results:
status: 200
status: 400 { "success": false, "message": "Metric with id[123] could not be found!" }