Use the Batch REST endpoint to group together multiple sequential calls into a single network request. For environments which make a number of programmatic alterations to the session configuration, Batch can significantly reduce the network load and time to create the session.
The session ID can be passed as a URL parameter just as it is for the other REST endpoints.
When supplied as part of a Batch call, the individual requests are evaluated sequentially in the order they are supplied.
Note
The
GET|PATCH|DELETE /Sessions/{sid}
endpoints are not supported by Batch REST.
The body of a Batch call is formatted as an array of Batch objects, each of which has the following JSON format:
Name | Type | Writable | Description |
---|---|---|---|
Url | string | required | REST endpoint URL (e.g. the part following /rest/ ).
|
Method | constant | required | Request method, one of: POST, PATCH, GET, DELETE
|
Payload | Payload | yes | Optional payload for POST and PATCH calls. |
[ { "Url": "Sessions", "Method": "POST" }, { "Url": "Roles/MyRole", "Method": "PATCH", "Payload": { ... } } ]
The format of the Payload property depends on the Url, and mirrors the payload supplied for the non-batch versions of the endpoint. For example, when the Url is Parameters, the payload has the following format (as detailed in REST — Parameters):
{ "Id": "MyParameter", "DataType": "String", "Value": "", "PromptText": "Input a value", "IsHidden": true }
Tip
When the Url is Sessions/Save, only the FileName property in the payload is required. The current session ID will be used automatically.
For example:
{ "Url": "Sessions/Save", "Method": "POST", "Payload": { "FileName" : "MyConfig.xml" } }
POST /rest/batch
All Batch calls are made using the POST method. Otherwise, calls to the Batch endpoint require the same Headers as all other REST calls. Each request object is supplied in order of evaluation. The response object contains the responses from each request in the same order that they were sent.
Important
Adding additional Data Source column metadata or performing a GET for the Data Source Fields will result in fixing the current column metadata list as the only defined columns. The column metadata can be further altered, but will not be reflected in the Entity Columns collection until the session is launched in a browser.
Name | Type | Description |
---|---|---|
config | string | Specify which config file to create the session with.
Format:
|
Name | Type | Description |
---|---|---|
ReturnCode | string | Response code indicating whether the call was successful |
ResponseContent | object | If the response code is 200 or 201, this is the content of the response. Otherwise this indicates whether an error occurred and the error type. |
ReturnCode: 204
Name | Type | Description |
---|---|---|
StatusCode | int | Status code |
StatusDescription | string | Status description |
ReturnCode: 400-500
Name | Type | Description |
---|---|---|
reason | string | Error message |
stacktrace | string | Stack trace, if available |
curl http://{webservice}/rest/batch -X POST ^ -d "[{'Url':'Sessions','Method':'POST'}, ^ {'Url':'Roles/Example','Method':'PATCH','Payload':{'IsActive':true}}]"
[ { "ReturnCode": "201", "ResponseContent": { "AppUrl": "ExagoHome.aspx?...", "ApiKey": "...", "Id": "...", "Page": "ExagoHome", "ApiAction": "Default", "ExportType": null, "ShowTabs": true, "ShowErrorDetail": true, "ReportSettings": { "Id": null, "ReportPath": null, "SortsResource": null, "FilterItems": null, "IsError": false, "ErrorList": null } } }, { "ReturnCode": "204", "ResponseContent": { "StatusCode": 204, "StatusDescription": null } } ]