Insert KPI's records (Upload JSON)
POST
/api/initiatives/{{product_external_key}}/kpi/{{kpi_external_key}}/insert-kpi-recordsThis API endpoint allows users to insert Key Performance Indicators (KPIs) by uploading a JSON file. This request supports only the insertion of new KPI records through JSON file upload.
Request
Query Params
product_external_key
string
required
How to get initiativeId:
- Visit https://app.shorterloop.com/ACME/product/SHO-MJXR/dashboard.
- The initiativeId is
SHO-MJXR
in the URL. - Use this initiativeId in the initiativeId header for API requests.
Example:
SHO-MJXR
kpi_external_key
string
required
How to get kpi_external_key:
1- Open the dialog box for the desired metric.
2- Locate the field labeled "KPI Unique Key."
3- Click the copy button next to the "KPI Unique Key" field to copy the key.
4- Use this key as the value for the kpi_external_key query parameter when making the API request.
Example:
KPI-46
Header Params
Content-Type
string
optional
Example:
multipart/form-data
Body Params multipart/form-data
metrics
file
required
Upload CSV for JSON file to insert or update data.
Example:
cmMtdXBsb2FkLTE3MTYzODAxOTUwOTQtMTM=/json-sample.json
Request samples
Responses
Created(201)
Invalid Input(400)
HTTP Code: 201
Content Type : JSONapplication/json
Data Schema
success
boolean
required
message
string
optional
data
object
required
id
integer
required
title
string
required
externalKey
string
required
benchmark
string
optional
visualization
boolean
optional
benchmarkUnit
string
optional
benchmarkType
string
optional
initiativeId
integer
optional
dueDate
string
optional
dashboardVisualization
boolean
optional
statement
string
optional
createdAt
string
optional
kpi_revisions
array [object {3}]
required
Example
{
"success": true,
"message": "Records inserted successfully. 2 out of 9 KPI records were not inserted due to incorrect entries in the provided data.",
"data": {
"id": 1162,
"title": "Matrics sample",
"externalKey": "KPI-15",
"benchmark": "334455.00",
"visualization": true,
"benchmarkUnit": "INR",
"benchmarkType": "MORE",
"initiativeId": 1139,
"dueDate": "2024-06-29T18:30:00.000Z",
"dashboardVisualization": true,
"statement": "4455",
"createdAt": "2024-05-16T06:48:10.000Z",
"kpi_revisions": [
{
"id": 1008,
"createdAt": "2024-05-16T06:53:19.000Z",
"value": "148.00"
},
{
"id": 1010,
"createdAt": "2024-05-16T06:53:19.000Z",
"value": "33.99"
},
{
"id": 1011,
"createdAt": "2024-05-16T06:53:19.000Z",
"value": "14.00"
},
{
"id": 1013,
"createdAt": "2024-05-16T06:53:19.000Z",
"value": "18.00"
},
{
"id": 1002,
"createdAt": "2024-05-16T06:49:36.000Z",
"value": "12.00"
},
{
"id": 1003,
"createdAt": "2024-05-16T06:49:36.000Z",
"value": "14.00"
},
{
"id": 1004,
"createdAt": "2024-05-16T06:49:36.000Z",
"value": "130.00"
},
{
"id": 1006,
"createdAt": "2024-05-16T06:49:36.000Z",
"value": "33.99"
},
{
"id": 1007,
"createdAt": "2024-05-16T06:49:36.000Z",
"value": "22.89"
},
{
"id": 999,
"createdAt": "2024-05-16T06:49:12.000Z",
"value": "148.00"
},
{
"id": 1001,
"createdAt": "2024-05-16T06:49:12.000Z",
"value": "33.99"
},
{
"id": 996,
"createdAt": "2024-05-16T06:48:52.000Z",
"value": "130.00"
},
{
"id": 998,
"createdAt": "2024-05-16T06:48:52.000Z",
"value": "33.99"
},
{
"id": 995,
"createdAt": "2024-05-16T06:48:10.000Z",
"value": "4455.00"
},
{
"id": 997,
"createdAt": "2024-05-11T07:38:05.000Z",
"value": "223.09"
},
{
"id": 1014,
"createdAt": "2024-04-04T07:38:05.000Z",
"value": "23.90"
},
{
"id": 1012,
"createdAt": "2024-03-10T07:38:05.000Z",
"value": "223.09"
},
{
"id": 1000,
"createdAt": "2024-03-01T07:38:05.000Z",
"value": "223.09"
},
{
"id": 1005,
"createdAt": "2024-03-01T07:38:05.000Z",
"value": "223.09"
},
{
"id": 1009,
"createdAt": "2024-02-21T07:38:05.000Z",
"value": "22.00"
}
]
}
}
Modified at 3 months ago