Initiate a batch upsertion of metric values#
Deprecated
This endpoint is deprecated and may be removed in a future release.
This endpoint was deprecated on 2026-02-12.
It is scheduled for sunset on 2027-01-31.
Description#
Batch upsert values for the given metric. The payload is limited to 10MB; break it into multiple requests if necessary.
For each value, provide either the id or both the reportingPeriod and coordinates (if any). If both are provided, the given id will be used.
The API will validate the request and return a 202 Accepted status. However, the operation will be processed asynchronously, so the values may take some time to appear in the system. Poll the location provided in the Location header to check the status of the operation.
If any of the values fail to be processed, no changes will be stored in the system.
POST /prototype/platform/programs/{programId}/metrics/{metricId}/values/batchUpsertion
Required OAuth Scopes
file:write
Parameters#
Parameter |
In |
Type |
Required |
Description |
|---|---|---|---|---|
X-Version |
header |
string |
false |
Version of the API (2022-01-01) |
programId |
path |
string |
true |
The unique identifier of the program |
metricId |
path |
string |
true |
The unique identifier of the metric |
body |
body |
true |
The metric values to upsert |
Body parameter example#
{
"data": [
{
"coordinates": {
"b38353ce-32bc-4ea7-852a-bf5e12b72d95": "Ames, IA"
},
"dataSource": {
"connectionType": "spreadsheetCell",
"spreadsheetCellConnection": {
"cell": "A1",
"sheet": "576696e0f7a143b4a0bc7c20a34480ab",
"spreadsheet": "7a5e271acf1d49d480a6fbabc394a0fa"
}
},
"fieldsToClear": [
"notes"
],
"id": "bf9aa2c3-f278-4c77-8acb-97584e843dcd",
"notes": "metric value notes",
"reportingPeriod": {
"end": 12,
"start": 1,
"year": 2024
},
"status": "complete",
"task": "VGFMDU1MmJiOGEwZDVjZWYzNDlVhZDWU5Y2jYzY3zax5iMg",
"value": "512.8768743"
}
]
}
Code Samples#
curl -X POST https://api.app.wdesk.com/prototype/platform/programs/{programId}/metrics/{metricId}/values/batchUpsertion \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}' \
-H 'X-Version: 2022-01-01'
http POST https://api.app.wdesk.com/prototype/platform/programs/{programId}/metrics/{metricId}/values/batchUpsertion \
X-Version:2022-01-01 \
Content-Type:application/json \
Accept:application/json \
Authorization:"Bearer {access-token}"
wget --method=POST "https://api.app.wdesk.com/prototype/platform/programs/{programId}/metrics/{metricId}/values/batchUpsertion" \
--output-document - \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {access-token}' \
--header 'X-Version: 2022-01-01'
import requests
headers = {
'X-Version': '2022-01-01',
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.app.wdesk.com/prototype/platform/programs/{programId}/metrics/{metricId}/values/batchUpsertion', headers = headers)
print(r.headers['Location'])
Returns#
202 - Accepted#
Header |
Description |
|---|---|
Location |
The location to poll for the operation result. |
Retry-After |
The number of seconds to wait before polling for a result and between polling attempts. |
400 - Bad Request#
Error response that indicates that the service is not able to process the incoming request. The reason is provided in the error message.
403 - Forbidden#
Error response that indicates that the service is not able to process the incoming request. The reason is provided in the error message.
404 - Not Found#
Error response that indicates that the service is not able to process the incoming request. The reason is provided in the error message.
409 - Conflict#
Error response that indicates that the service is not able to process the incoming request. The reason is provided in the error message.
429 - Too Many Requests#
Error response that indicates that the service is not able to process the incoming request. The reason is provided in the error message.
500 - Internal Server Error#
Error response that indicates that the service is not able to process the incoming request. The reason is provided in the error message.
Example Responses#
{
"code": "400BadRequest",
"message": "The request was unacceptable, often due to a missing or invalid parameter"
}
{
"code": "401Unauthorized",
"message": "No valid API token provided"
}
{
"code": "403Forbidden",
"message": "The API token does not have permissions to perform the request"
}
{
"code": "404NotFound",
"message": "The requested resource could not be found"
}
{
"code": "409Conflict",
"message": "The request conflicts with another request"
}
{
"code": "429TooManyRequests",
"message": "Too many requests have been made against the API in too short a time"
}
{
"code": "500InternalServerError",
"message": "The server encountered an unexpected condition that prevented it from fulfilling the request"
}
{
"code": "503ServiceUnavailable",
"message": "The server cannot handle the request due to a temporary overload or scheduled maintenance"
}