Bulk Requests
Bulk requests allow for more optimized execution of multiple requests at once by replacing the default completion of requests with specialized database bulk operations. Only specific endpoints support these optimized queries. If it does not, the API falls back to the usual operations. Currently, as of version 4.12.2 the following endpoints are optimized:
- Creating multiple time series
However, it is also possible for users of the PowerTSM .NET API to implement their own bulk handlers for requests they frequently use.
Request
POST /automation/bulkRequest Body
{ "endpoint": "/repositories/<repository>/timeSeries", "method": "POST", "items": [ { "identifier": "string", "parameters": { "repository": "MyRepository" }, "body": { ... } } ]}Response
[ { "$successful": "true", "identifier": "string", "status": 2XX, "value": { ... } } ]Status is the successful status code the individual request would have returned on its own (200, 201 or 204), and value is that request’s response body. Since a 204 No Content response has no body by definition, value is null in that case.
The endpoint is parameterized by placeholders in <> brackets. A list of items defines the parameter combinations for which the request is performed. Each item needs to define all endpoint parameters. The method is the type of request that should be sent and has to be one of GET, POST, PUT or DELETE. For requests that require a body, such as the creation of time series, the body property within the item is available. If it is not needed, it can simply be omitted.
The identifier parameter is used to correlate sent items with the response. The response body might be in a completely different order than the request. To help organize the items in the response body, the identifier can be set to any string value. Ideally these identifiers are unique to each item, however, they are not verified by PowerTSM in any way, so the same identifier can be used for multiple items if necessary.
The response is a list of individual HTTP Error responses. If one item fails, its error is returned as that item’s entry. The status code of the bulk request itself remains 200 OK, and the other items are unaffected.
A failed item is returned as follows:
[ { "$successful": "false", "identifier": "string", "status": 404, "error": { "title": "HKXXXXX", "status": 404, "detail": "..." } }]error always contains title, status and detail. Beyond those, two fields are optional and must be treated as possibly absent:
| Field | Present when |
|---|---|
traceId |
The called endpoint reported the error. An item that fails before the endpoint is reached: an endpoint path that does not exist, or a placeholder that an item does not fill has no traceId. |
root |
The error wraps an inner error. root may itself contain a root, nested to any depth. |
traceId identifies the request that produced the error in the server’s logs. It follows the W3C Trace Context format 00-<trace-id>-<span-id>-<flags> — quote the whole value when reporting a problem to support.
Nested errors
Section titled “ Nested errors”[ { "$successful": "false", "identifier": "string", "status": 400, "error": { "title": "HK01003", "status": 400, "detail": "…", "root": { "title": "Internal Server Error", "status": 500, "detail": "…", "root": { "title": "Bad Request", "status": 400, "detail": "…" } } } }]Examples
Section titled “Examples”Reading data in the same time interval for two time series
Section titled “ Reading data in the same time interval for two time series”This request reads data from 2026-01-01 to 2026-01-03 for two time series: Test01 and Test02.
Request
POST /automation/bulkRequest Body
{ "endpoint": "/repositories/TSM_ORACLE/timeSeries/<ts>/data?from=2026-01-01&to=2026-01-03", "method": "GET", "items": [ { "identifier": "1", "parameters": { "ts": "Test01" } }, { "identifier": "2", "parameters": { "ts": "Test02" } } ]}Response Body (200 OK)
[ { "$successful": "true", "value": { "unit": { "identifier": "C", "storageInformation": { "repositoryName": "TSM_ORACLE" } }, "interval": { "type": 4, "multiplier": 1 }, "cyclic": true, "function": 1, "timeZone": "W. Europe Standard Time", "data": [ { "time": "2026-01-01T00:00:00+01:00", "value": 1, "flag": 9 }, { "time": "2026-01-02T00:00:00+01:00", "value": 2, "flag": 9 } ] }, "identifier": "1", "status": 200 }, { "$successful": "true", "value": { "unit": { "identifier": "C", "storageInformation": { "repositoryName": "TSM_ORACLE" } }, "interval": { "type": 4, "multiplier": 1 }, "cyclic": true, "function": 1, "timeZone": "W. Europe Standard Time", "data": [ { "time": "2026-01-01T00:00:00+01:00", "value": 4, "flag": 9 }, { "time": "2026-01-02T00:00:00+01:00", "value": 5, "flag": 9 } ] }, "identifier": "2", "status": 200 }]Post two time series to different repositories at once
Section titled “ Post two time series to different repositories at once”The time series have the same name but are posted to two different repositories, so no issues arise.
Request
POST /automation/bulkRequest Body
{ "endpoint": "/repositories/<repo>/timeSeries/", "method": "POST", "items": [ { "identifier": "one", "parameters": { "repo": "TSM_POSTGRESQL" }, "body": { "name": "TSM_Example_TimeSeries_01", "cyclic": true, "function": 1, "interval": { "type": 3, "multiplier": 15 } } }, { "identifier": "two", "parameters": { "repo": "TSM_ORACLE" }, "body": { "name": "TSM_Example_TimeSeries_01", "cyclic": true, "function": 1, "interval": { "type": 4, "multiplier": 1 } } } ]}Response Body (200 OK)
[ { "$successful": "true", "value": { "identifier": 11756, "storageInformation": { "repositoryName": "TSM_POSTGRESQL" }, "value": { "name": "TSM_Example_TimeSeries_01", "description": null, "function": 1, "cyclic": true, "interval": { "type": 3, "multiplier": 15 }, "unit": null, "intervalTransformationMethod": null, "formula": null, "timeZone": null, "startOfTime": null, "preserveDuplicatedValues": null, "preserveHistoricData": false, "preserveAuditLog": false, "quotation": false, "quotationDefaultBehavior": null, "compressionMode": 0, "compressionMultiplier": null } }, "identifier": "one", "status": 200 }, { "$successful": "true", "value": { "identifier": 10259, "storageInformation": { "repositoryName": "TSM_ORACLE" }, "value": { "name": "TSM_Example_TimeSeries_01", "description": null, "function": 1, "cyclic": true, "interval": { "type": 4, "multiplier": 1 }, "unit": null, "intervalTransformationMethod": null, "formula": null, "timeZone": null, "startOfTime": null, "preserveDuplicatedValues": null, "preserveHistoricData": false, "preserveAuditLog": false, "quotation": false, "quotationDefaultBehavior": null, "compressionMode": 0, "compressionMultiplier": null } }, "identifier": "two", "status": 200 }]Response Body if Repository TSM_ORACLE is unavailable: 200 OK
Posting time series is a request executed by an optimized endpoint which is also responsible for the error message.
[ { "$successful": "true", "value": { "identifier": 11755, "storageInformation": { "repositoryName": "TSM_POSTGRESQL" }, "value": { "name": "TSM_Example_TimeSeries_01", "description": null, "function": 1, "cyclic": true, "interval": { "type": 3, "multiplier": 15 }, "unit": null, "intervalTransformationMethod": null, "formula": null, "timeZone": null, "startOfTime": null, "preserveDuplicatedValues": null, "preserveHistoricData": false, "preserveAuditLog": false, "quotation": false, "quotationDefaultBehavior": null, "compressionMode": 0, "compressionMultiplier": null } }, "identifier": "one", "status": 200 }, { "$successful": "false", "error": { "title": "HK12008", "status": 404, "detail": "No repository named 'TSM_ORACLE' available." }, "identifier": "two", "status": 404 }]Read two attributes, one of which does not exist
Section titled “ Read two attributes, one of which does not exist”Request
POST /automation/bulkRequest Body
{ "endpoint": "/repositories/TSM_ORACLE/attributes/<name>", "method": "GET", "items": [ { "identifier": "#01", "parameters": { "name": "Location" } }, { "identifier": "#02", "parameters": { "name": "doesnt_exist" } } ]}As of version 4.12.2, attribute requests are not optimized, which is why the error is the exact same as if the attribute was requested directly via GET /repositories/TSM_ORACLE/attributes/doesnt_exist.
Response
[ { "$successful": "true", "value": { "identifier": 29, "storageInformation": { "repositoryName": "TSM_ORACLE" }, "value": { "name": "Location", "description": "Geographic location of the measurement", "type": { "identifier": 2, "storageInformation": { "repositoryName": "TSM_ORACLE" } } } }, "identifier": "#01", "status": 200 }, { "$successful": "false", "error": { "title": "HK15104", "status": 404, "detail": "No attribute with name 'doesnt_exist' found.", "root": { "title": "HK12029", "status": 404, "detail": "No results for query." }, "traceId": "00-f62c422c82fceb6927b240826b46ba1c-6f4de3d796f8a34c-00" }, "identifier": "#02", "status": 404 }]