Export Incident and Retrospective Data Using API
-
Go into the Blameless Reliability Insight module.
-
Create a tile with the fields you want to export in a data table.
There are two methods for exporting the data:
-
Manual export
-
Automated export (using the API and a script)
Manual Method
Use the Export button or make a curl request to that endpoint.
- If you mouse over the ellipse (…) in the upper right corner of the tile. The “View Tile Options” modal appears.
-
Click on the ellipse and a drop down option list appears.
-
Select “Export Tile to”. A drop-down appears. Your choices are “CSV” and “API”.
-
Select “API”. The following information appears.
Sample Manual cURL Request
Follow steps 1-4 above and copy the entire command from the modal pop-up for the tile you want to export data from. This cURL command will result in the tile query data.
Note: Each Tile will have a unique ID.
Automated
Create a script to do the following (or do it manually) fetch a fresh API token to call this endpoint.
Note: We already support exporting tile via API so they can just use this and write a script.
-
Fetch a fresh token. Refer to the API Authentication content for more information.
-
Call this endpoint by making curl -x POST command and get the export.
-
Use the exported data as desired.
Sample Request
curl -X POST 'https://blameless.blameless.io/api/v1/topics/incident/execute?5dfab4cf23a2ed00017403bb' \\ -d '
{
"items":[
{
"header":"Incident \#","formula":"[incident.number]",
"dataType":"number",
"order":"desc",
"orderSequence":0,"grouped":true,
"format":"incident_url",
"hidden":false,
"ref":"field-k3sx3k9q",
"filters":[]
},
{
"header":"Custom Postmortem Key",
"formula":"[postmortem_custom.custom_key]",
"dataType":"text",
"orderSequence":0,
"grouped":false,
"aggregate":"count","hidden":false,
"ref":"field-k4bsi2bj",
"filters":[
{
"operator":"in",
"values":[
"impactedgroup",
"likelyhood",
"occuredbefore",
"followup",
"recentchange",
"self-inflicted",
"completeanalysis",
"withinsla",
"customerpm",
"pmscheduled",
"pmcomplete",
"swimlanes",
"nwhys",
"alertimprovements",
"howlong",
"primaryrootcause",
"knownissue",
"assignedcorrectteam",
"resolutiontype",
"resolutionsummary",
"resolvedsooner",
"rightpeople",
"teamsolved",
"preventionworksoon",
"preventionworklater",
"prevention-impact",
"recommendedimprovement"],
"beforeAggregate":true
}
]
},
{
"header":"percentage",
"formula":"round(([ref:field-k4bsi2bj] /27) \* 100,2)",
"dataType":"number",
"orderSequence":0,
"grouped":false,"format":
"percentage",
"hidden":false,
"ref":"field-k4bslfoi",
"filters":[]},
{
"header":"Incident Status",
"formula":"[incident.status]",
"dataType":"text",
"orderSequence":0,
"grouped":true,
"hidden":false,"ref":"field-k4bsnaj3",
"filters":[{"operator":"ct","values":["resolved"],
"beforeAggregate":true}]},
{
"header":"Incident Created",
"formula":"[incident.created]",
"dataType":"datetime",
"orderSequence":0,
"grouped":false,
"aggregate":"count",
"function":"date",
"hidden":false,
"ref":"field-k4bulwje",
"filters":[{"operator":
"gt","values":["2019-11-01"],
"beforeAggregate":true
}
]
},
{
"header":"info",
"formula":"concat( [incident.type] , '-',
[incident.severity_label] , '-',
[incident.description] )",
"dataType":"text",
"orderSequence":0,
"grouped":true,"format":"pretty",
"hidden":false,
"ref":"field-k4buoqt9",
"filters":[]}],
"options":{"pageNumber":0,
"itemsPerPage":50,
"ignoreRepeatedRows":false
}
}' \\ -H 'authorization: Bearer
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IlJFUTFRMFpETlRsRFJURTFNalJCUVVSRE9FWkVSalpFUTBZelF6WTBRVFEyTlVRek5EQTNOdyJ9.eyJpc3MiOiJodHRwczovL2JsYW1lbGVzc2hxLmF1dGgwLmNvbS8iLCJzdWIiOiJhdXRoMHw1ZTg0ZGI4NjhkODU0MTBjNGU3NjUyZWUiLCJhdWQiOlsiYmxhbWVsZXNzLmJsYW1lbGVzcy5pbyIsImh0dHBzOi8vYmxhbWVsZXNzaHEuYXV0aDAuY29tL3VzZXJpbmZvIl0sImlhdCI6MTYwMzcyOTc5NiwiZXhwIjoxNjAzNzM2OTk2LCJhenAiOiJ6RVlKUjRZNWlqRm5PUTkyWmxlck5YelhBOTVJb0xvdyIsInNjb3BlIjoib3BlbmlkIHByb2ZpbGUgZW1haWwifQ.C0dDCsifcaSDdPx6cv6aZbTrjL0he4K_mkmaSEJnrPa3PD1Yt2C_usI3DMlYNREzhSIMXMufuKf3bae7DQZ8MHENCV3oomqi_uikUlA20zGcOwJVSUIOetFcAd8TB1Xj6bKWaJCaZ-njMHU4IPCxbGy7KU2ndOjFyr7kr-OZcuTwK_BRCZniq0qeSgRvkslO-CIWj7qqyffaFyS20CNC5DQcQ4WINKtfV65qVVXchUlQAVV8zVS7yCB8y2PSv2wKgQ-ZphHAtkwkY6y90Gg9pt-IloSZeGWaLnoVBTvfDFGA3bRrXk4BENZ-8uFZ-OuQU3azuOiyGOqLSOe_5Do1lw'
\\ -H
'content-type: application/json;charset=UTF-8'
Sample Response
Note: The important property is the rows, which would contain the results based on your query.
{
"ok": true,
"result":{
"navigation":{
"hasPrev": false,
"hasNext": false,
"rowsCount":49,
"totalRows":49
},
"headers":[
"Tag Label",
"Incident Created",
"Severity Label"
],
"dataTypes":[
"number",
"text",
"text"
],
"rows":[...], //rows of data results here depending on query
"sourceImported": true,
"query":{
"items":[
{
"header":"Tag Label",
"formula":"[tag.label]",
"orderSequence":0,
"grouped": false,
"aggregate":"count",
"hidden": false,
"filters":[]
},
{
"header":"Incident Created",
"formula":"[incident.created]",
"order":"asc",
"orderSequence":0,
"grouped": true,
"function":"date",
"format":"year_month_number_day_number_hyphen",
"hidden": false,
"filters":[
{
"operator":"rw",
"values":[
"3",
"month",
"0",
"day"
],
"beforeAggregate":true
}
]
},
{
"header":"Severity Label",
"formula":"[incident.severity_label]",
"orderSequence":0,
"grouped": true,
"format":"pretty",
"hidden": false,
"filters":[]
}
],
"options":{
"pageNumber":0,
"itemsPerPage":50,
"ignoreRepeatedRows":false
}
}
}
}
Comments
0 comments
Article is closed for comments.