Introduction
The Errand API provides mechanisms to send requests to the Calculation Engine to execute Calculations, Imports and Imported Data Deletes asynchronously.
Errand Resources
Errands
Errands are wrappers around various asynchronous tasks executed by the system at the request of the user. Each of the sub types of Errand create an Errand resource, which is used to track the execution progress.
Once created, use the following endpoints to request further information regarding the execution of an Errand.
GET /errand/v1/errands
Utilise this endpoint to retrieve all Errands. Results are paginated.
Responses are JSON (application/json).
Request
$ curl 'https://gateway-domain.performio.co/gateway/errand/v1/errands?page=0&size=20' -i -X GET \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer e9036e38-d67e-11e8-9f8b-f2801f1b9fd1'
Headers
Name | Description |
---|---|
|
OAuth 2.0 authentication token |
Request Parameters
Parameter | Description |
---|---|
|
(Optional) Number representing the page to retrieve. Pages start from 0. |
|
(Optional) Number representing the records per page count. Default page size is 20 and the maximum is 2000. |
Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 421
{
"results" : [ {
"id" : 1,
"name" : "SIP Batch",
"type" : "Calc",
"state" : "Complete",
"startTime" : 1539922402211,
"endTime" : 1539922945221
}, {
"id" : 2,
"name" : "SIP Batch",
"type" : "Calc",
"state" : "Complete",
"startTime" : 1539922402211,
"endTime" : 1539922945221
} ],
"page" : {
"totalPages" : 1,
"totalElements" : 2,
"hasNext" : false
}
}
Path | Type | Description |
---|---|---|
|
|
Array of results. |
|
|
Number representing the ID of the created Errand. |
|
|
String representing he name of the task the Errand encapsulates. |
|
|
String representing the type of the Errand. |
|
|
String representing the current state of the errand. May be one of the following: Running, Complete, Failed, Terminated |
|
|
String representing the timestamp the errand began execution. |
|
|
String representing the timestamp the errand completed execution. |
|
|
Object representing result pagination. |
|
|
Number representing the total pages at current page size. |
|
|
Number representing the total possible elements for the request. |
|
|
Boolean representing if there is a next page of results. |
GET /errand/v1/errands/{errandId}
Utilise this endpoint to retrieve a specific Errand, used if you wish to poll until the Errand has a "Completed" status. In the event of a "Failed" state, further information can be accessed by requesting logs.
Responses are JSON (application/json).
Request
$ curl 'https://gateway-domain.performio.co/gateway/errand/v1/errands/1' -i -X GET \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer e9036e38-d67e-11e8-9f8b-f2801f1b9fd1'
Headers
Name | Description |
---|---|
|
OAuth 2.0 authentication token |
Parameters
Parameter | Description |
---|---|
|
Number representing the ID of the Errand to fetch. |
Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 141
{
"id" : 1,
"name" : "SIP Batch",
"type" : "Calc",
"state" : "Complete",
"startTime" : 1539922402211,
"endTime" : 1539922945221
}
Path | Type | Description |
---|---|---|
|
|
Number representing the ID of the created Errand. |
|
|
String representing he name of the task the Errand encapsulates. |
|
|
String representing the type of the Errand. |
|
|
String representing the current state of the errand. May be one of the following: Running, Complete, Failed, Terminated |
|
|
String representing the timestamp the errand began execution. |
|
|
String representing the timestamp the errand completed execution. |
Error Conditions
|
|
Errand ID provided does not resolve to an Errand. |
|
GET /errand/v1/errands/{errandId}/logs
Utilise this endpoint to retrieve logs for a specific Errand. Results are paginated.
Responses are JSON (application/json).
Request
$ curl 'https://gateway-domain.performio.co/gateway/errand/v1/errands/1/logs?page=0&size=2' -i -X GET \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer e9036e38-d67e-11e8-9f8b-f2801f1b9fd1'
Headers
Name | Description |
---|---|
|
OAuth 2.0 authentication token |
Parameters
Parameter | Description |
---|---|
|
Number representing the ID of the Errand to fetch logs for. |
|
(Optional) Number representing the page to retrieve. Pages start from 0. |
|
(Optional) Number representing the records per page count. Default page size is 20 and the maximum is 2000. |
Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 297
{
"results" : [ {
"logMessage" : "first line",
"status" : "",
"createTime" : 1539922402211
}, {
"logMessage" : "second line",
"status" : "ended",
"createTime" : 1539922402222
} ],
"page" : {
"totalPages" : 1,
"totalElements" : 2,
"hasNext" : false
}
}
Path | Type | Description |
---|---|---|
|
|
Array of results. |
|
|
String representing the status of the log, indicating if it’s not in a batch or logging has ended |
|
|
String representing time since epoch for log creation. |
|
|
String representing the the logged message. |
|
|
Object representing result pagination. |
|
|
Number representing the total pages at current page size. |
|
|
Number representing the total possible elements for the request. |
|
|
Boolean representing if there is a next page of results. |
Error Conditions
|
|
Errand ID provided does not resolve to an Errand. |
|
Batch Errands
Batch Errands are wrappers around Batches that are provided asynchronously to the Calculation Engine where they are actioned. In order for a Batch Errand to be correct it requires a Batch and may require a Period range and a list of Participants (an empty list indicates all) to run for.
Utilise V2 of the endpoint if you intend to provide Participant EIDs instead of IDs.
Once created you can poll for the created Batch Errand to verify that is has been completed by utilising the GET /errand/v1/errands/{errandId} endpoint.
POST /errand/v1/batches
Utilise this endpoint to create a Batch Errand by providing Batch ID along with a Period range and Participant set to run the Batch Errand for.
Requests are JSON (application/json). Responses are JSON (application/json).
Related Resources
Batches |
|
Periods |
|
Participants |
|
Errands |
Request (Calculation)
$ curl 'https://gateway-domain.performio.co/gateway/errand/v1/batches' -i -X POST \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer e9036e38-d67e-11e8-9f8b-f2801f1b9fd1' \
-d '{ "periodRange": [1, 2, 3], "batchId": 1, "participantIds": [1, 2, 3] }'
Headers
Name | Description |
---|---|
|
OAuth 2.0 authentication token |
Parameters
Path | Type | Description |
---|---|---|
|
|
Array representing Period numbers to run the Errand for. |
|
|
Number representing the the ID of Batch to run. |
|
|
Array representing the IDs of the Participant to run the Calculation for, empty representing run the Calculation for all Participants. |
Response
HTTP/1.1 202 Accepted
Content-Type: application/json;charset=UTF-8
Content-Length: 129
{
"id" : 1,
"name" : "Batch 1",
"type" : "Calc",
"state" : "Running",
"startTime" : 1539922402211,
"endTime" : null
}
Path | Type | Description |
---|---|---|
|
|
Number representing the ID of the created Errand. |
|
|
String representing he name of the task the Errand encapsulates. |
|
|
String representing the type of the Errand. |
|
|
String representing the current state of the errand. May be one of the following: Running, Complete, Failed, Terminated |
|
|
String representing the timestamp the errand began execution. |
|
|
String representing the timestamp the errand completed execution, Null if not finished. |
Error Conditions
|
|
A required parameter is missing from the request. |
|
The requested Batch exists but is not published. |
|
The requested Batch exists but is not valid for the selected Period range. |
|
The requested Batch does not exist. |
|
Due to an internal issue a Batch Errand could not be created. |
|
POST /errand/v2/batches
Utilise this endpoint to create a Batch Errand by providing a Batch ID along with a Period range and Participant set to run the Batch Errand for.
If Period Range is omitted, the Batch Errand will default to the current Period based on the date the request is run on.
If Participant EIDs are omitted, the Batch Errand will run for all active Participants.
Requests are JSON (application/json). Responses are JSON (application/json).
Related Resources
Batches |
|
Periods |
|
Participants |
|
Errands |
Request
$ curl 'https://gateway-domain.performio.co/gateway/errand/v2/batches' -i -X POST \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer e9036e38-d67e-11e8-9f8b-f2801f1b9fd1' \
-d '{
"periodRange" : [ 1, 2, 3 ],
"batchId" : 1,
"participantEids" : [ "test_user_1", "test_user_2", "test_user_3" ]
}'
Headers
Name | Description |
---|---|
|
OAuth 2.0 authentication token |
Parameters
Path | Type | Description |
---|---|---|
|
|
(Optional) Array representing Period numbers to run the Errand for, omitted or empty will default to the current Period based on the current date. |
|
|
Number representing the the ID of Batch to run. |
|
|
(Optional) Array representing the EIDs of active Participants to run the Batch for, omitted or empty representing all active Participants. |
Response
HTTP/1.1 202 Accepted
Content-Type: application/json;charset=UTF-8
Content-Length: 129
{
"id" : 1,
"name" : "Batch 1",
"type" : "Calc",
"state" : "Running",
"startTime" : 1539922402211,
"endTime" : null
}
Path | Type | Description |
---|---|---|
|
|
Number representing the ID of the created Errand. |
|
|
String representing he name of the task the Errand encapsulates. |
|
|
String representing the type of the Errand. |
|
|
String representing the current state of the errand. May be one of the following: Running, Complete, Failed, Terminated |
|
|
String representing the timestamp the errand began execution. |
|
|
String representing the timestamp the errand completed execution, Null if not finished. |
Error Conditions
|
|
A required parameter is missing from the request. |
|
The requested Batch does not exist. |
|
The requested Batch exists but is not published. |
|
The requested Batch exists but is not valid for the selected Period range. |
|
One or more of the provided Periods are locked |
|
One or more of the provided Periods do not exist |
|
The provided Participant EIDs do not resolve to any Participants |
|
Period Range has been omitted and a valid current Period could not be found. |
|
Due to an internal issue a Batch Errand could not be created. |
|
Calculation Errands
Calculation Errands are wrappers around Calculations that are provided asynchronously to the Calculation Engine where they are actioned. In order for a Calculation Errand to be correct it requires a Calculation and may require a Period range and a list of Participants (an empty list indicates all) to run for.
Utilise V2 of the endpoint if you intend to provide Participant EIDs instead of IDs.
Once created you can poll for the created Calculation Errand to verify that is has been completed by utilising the GET /errand/v1/errands/{errandId} endpoint.
POST /errand/v1/calculations
Utilise this endpoint to create a Calculation Errand by providing a Calculation ID along with a Period range and Participant set to run the Calculation Errand for. A Calculation ID can refer to a Plan Template, Leader Board or Script calculation.
Requests are JSON (application/json). Responses are JSON (application/json).
Related Resources
Calculations |
|
Periods |
|
Participants |
|
Errands |
Request
$ curl 'https://gateway-domain.performio.co/gateway/errand/v1/calculations' -i -X POST \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer e9036e38-d67e-11e8-9f8b-f2801f1b9fd1' \
-d '{ "periodRange": [1, 2, 3], "calculationId": 1, "participantIds": [1, 2, 3] }'
Headers
Name | Description |
---|---|
|
OAuth 2.0 authentication token |
Parameters
Path | Type | Description |
---|---|---|
|
|
Array representing Period numbers to run the Errand for. |
|
|
Number representing the the ID of Calculation to run. |
|
|
Array representing the IDs of the Participant to run the Calculation for, empty representing run the Calculation for all Participants. |
Response
HTTP/1.1 202 Accepted
Content-Type: application/json;charset=UTF-8
Content-Length: 140
{
"id" : 1,
"name" : "SIP Calc: Period 1",
"type" : "Calc",
"state" : "Running",
"startTime" : 1539922402211,
"endTime" : null
}
Path | Type | Description |
---|---|---|
|
|
Number representing the ID of the created Errand. |
|
|
String representing he name of the task the Errand encapsulates. |
|
|
String representing the type of the Errand. |
|
|
String representing the current state of the errand. May be one of the following: Running, Complete, Failed, Terminated |
|
|
String representing the timestamp the errand began execution. |
|
|
String representing the timestamp the errand completed execution, Null if not finished. |
Error Conditions
|
|
A required parameter is missing from the request. |
|
The requested Calculation exists but is not published. |
|
The requested Calculation exists but is not active. |
|
The requested Calculation exists but is not valid for the selected Period range. |
|
The requested Calculation does not exist. |
|
Due to an internal issue a Calculation Errand could not be created. |
|
POST /errand/v2/calculations
Utilise this endpoint to create a Calculation Errand by providing a Calculation ID along with a Period range and Participant set to run the Calculation Errand for. A Calculation ID can refer to a Plan Template, Leader Board or Script calculation.
If Period Range is omitted, the Calculation Errand will default to the current Period based on the date the request is run on.
If Participant EIDs are omitted, the Calculation Errand will run for all active Participants.
Requests are JSON (application/json). Responses are JSON (application/json).
Related Resources
Calculations |
|
Periods |
|
Participants |
|
Errands |
Request
$ curl 'https://gateway-domain.performio.co/gateway/errand/v2/calculations' -i -X POST \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer e9036e38-d67e-11e8-9f8b-f2801f1b9fd1' \
-d '{
"periodRange" : [ 1, 2, 3 ],
"calculationId" : 1,
"participantEids" : [ "test_user_1", "test_user_2", "test_user_3" ]
}'
Headers
Name | Description |
---|---|
|
OAuth 2.0 authentication token |
Parameters
Path | Type | Description |
---|---|---|
|
|
(Optional) Array representing Period numbers to run the Errand for, omitted or empty will default to the current Period based on the current date. |
|
|
Number representing the the ID of Calculation to run. |
|
|
(Optional) Array representing the EIDs of active Participants to run the Calculation for, omitted or empty representing all active Participants. |
Response
HTTP/1.1 202 Accepted
Content-Type: application/json;charset=UTF-8
Content-Length: 140
{
"id" : 1,
"name" : "SIP Calc: Period 1",
"type" : "Calc",
"state" : "Running",
"startTime" : 1539922402211,
"endTime" : null
}
Path | Type | Description |
---|---|---|
|
|
Number representing the ID of the created Errand. |
|
|
String representing he name of the task the Errand encapsulates. |
|
|
String representing the type of the Errand. |
|
|
String representing the current state of the errand. May be one of the following: Running, Complete, Failed, Terminated |
|
|
String representing the timestamp the errand began execution. |
|
|
String representing the timestamp the errand completed execution, Null if not finished. |
Error Conditions
|
|
A required parameter is missing from the request. |
|
The requested Calculation does not exist. |
|
The requested Calculation exists but is not published. |
|
The requested Calculation exists but is not active. |
|
The requested Calculation exists but is not valid for the selected Period range. |
|
One or more of the provided Periods are locked |
|
One or more of the provided Periods do not exist |
|
The provided Participant EIDs do not resolve to any Participants |
|
Period Range has been omitted and a valid current Period could not be found. |
|
Due to an internal issue a Calculation Errand could not be created. |
|
Imported Data Delete Errands
Imported Data Delete Errands are wrappers around deletions for data previously imported via Import File that are asynchronously passed to the Calculation Engine where they are actioned. In order to be successful, Delete Data Errands must reference an Import File.
Once created you can poll for the created Imported Data Delete Errand to verify that is has been completed by utilising the GET /errand/v1/errands/{errandId} endpoint.
POST /errand/v1/imported-data-deletes
This endpoint allows you to request that an Errand wrapping a request to delete previously imported file data to be created and sent to the Calculation Engine to be actioned. The response is an object describing the current state of the Errand.
Requests are JSON (application/json). Responses are JSON (application/json).
Related Resources
Import Files |
|
Errands |
Request
$ curl 'https://gateway-domain.performio.co/gateway/errand/v1/imported-data-deletes' -i -X POST \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer e9036e38-d67e-11e8-9f8b-f2801f1b9fd1' \
-d '{
"importFileId": 1
}'
Headers
Name | Description |
---|---|
|
OAuth 2.0 authentication token |
Parameters
Path | Type | Description |
---|---|---|
|
|
Number representing the ID of the Import File to delete data for. |
Response
HTTP/1.1 202 Accepted
Content-Type: application/json;charset=UTF-8
Content-Length: 146
{
"id" : 1,
"name" : "file.csv",
"type" : "Delete Imported Data",
"state" : "Running",
"startTime" : 1539922402211,
"endTime" : null
}
Path | Type | Description |
---|---|---|
|
|
Number representing the ID of the created Errand. |
|
|
String representing he name of the task the Errand encapsulates. |
|
|
String representing the type of the Errand. |
|
|
String representing the current state of the errand. May be one of the following: Running, Complete, Failed, Terminated |
|
|
String representing the timestamp the errand began execution. |
|
|
String representing the timestamp the errand completed execution, Null if not finished. |
Error Conditions
|
|
A required parameter is missing from the request. |
|
The request Import File does not exist. |
|
Due to an internal issue an Imported Data Delete Errand could not be created. |
|
Import Errands
Import Errands are wrappers around Import File / Import File Type combinations that are provided asynchronously to the Calculation Engine to be imported. In order to be successful, an Import Errand must contain a reference to an Import File and an Import File Type. Depending on the Import File Type, a Period range may be required too.
Once created you can poll for the created Import Errand to verify that is has been completed by utilising the GET /errand/v1/errands/{errandId} endpoint.
POST /errand/v1/imports/file
Utilise this endpoint to create an Import Errand to import a pre-created Import File.
Requests are JSON (application/json). Responses are JSON (application/json).
Related Resources
Import Files |
|
Import File Types |
|
Periods |
|
Errands |
Request
$ curl 'https://gateway-domain.performio.co/gateway/errand/v1/imports/file' -i -X POST \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer e9036e38-d67e-11e8-9f8b-f2801f1b9fd1' \
-d '{
"importFileId": 1, "periodRange": [1, 2, 3],
"importFileTypeId": "standard-3"
}'
Headers
Name | Description |
---|---|
|
OAuth 2.0 authentication token |
Parameters
Path | Type | Description |
---|---|---|
|
|
Number representing the ID of the File to be imported. |
|
|
(Optional) Array representing the Period range to run the Errand for. May be omitted if the Import File Type selected does not require a Period. Full range will be derived from the lowest to highest value provided. |
|
|
String representing the the ID of the Import File Type to import the provided records as. |
Response
HTTP/1.1 202 Accepted
Content-Type: application/json;charset=UTF-8
Content-Length: 154
{
"id" : 1,
"name" : "Import Test: Period 1",
"type" : "Import",
"state" : "Running",
"startTime" : 1539922402211,
"endTime" : 1539922945221
}
Path | Type | Description |
---|---|---|
|
|
Number representing the ID of the created Errand. |
|
|
String representing he name of the task the Errand encapsulates. |
|
|
String representing the type of the Errand. |
|
|
String representing the current state of the errand. May be one of the following: Running, Complete, Failed, Terminated |
|
|
String representing the timestamp the errand began execution. |
|
|
String representing the timestamp the errand completed execution, Null if not finished. |
Error Conditions
|
|
A required parameter is missing from the request |
|
The requested Import File does not exist. |
|
The requested Import File Type does not exist. |
|
Due to an internal issue an Import Errand could not be created. |
|
POST /errand/v1/imports/records
Utilise this endpoint to perform an Import Errand for up to 50 records as provided in the request.
Requests are JSON (application/json). Responses are JSON (application/json).
Related Resources
Import File Types |
|
Periods |
|
Errands |
Request
$ curl 'https://gateway-domain.performio.co/gateway/errand/v1/imports/records' -i -X POST \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer e9036e38-d67e-11e8-9f8b-f2801f1b9fd1' \
-d '{
"records": [
{ "field1": "value1" }, { "field1": "value2" }, { "field1": "value3" }, { "field1": "value4" } ],
"periodRange": [1],
"importFileTypeId": "standard-1"
}'
Headers
Name | Description |
---|---|
|
OAuth 2.0 authentication token |
Parameters
Path | Type | Description |
---|---|---|
|
|
(Optional) Array representing the Period range to run the Errand for. May be omitted if the Import File Type selected does not require a Period. Full range will be derived from the lowest to highest value provided. |
|
|
String representing the the ID of the Import File Type to import the provided records as. |
|
|
Array representing records to import as JSON objects. |
Response
HTTP/1.1 202 Accepted
Content-Type: application/json;charset=UTF-8
Content-Length: 141
{
"id" : 1,
"name" : "Account: Period 1",
"type" : "Import",
"state" : "Running",
"startTime" : 1539922402211,
"endTime" : null
}
Path | Type | Description |
---|---|---|
|
|
Number representing the ID of the created Errand. |
|
|
String representing he name of the task the Errand encapsulates. |
|
|
String representing the type of the Errand. |
|
|
String representing the current state of the errand. May be one of the following: Running, Complete, Failed, Terminated |
|
|
String representing the timestamp the errand began execution. |
|
|
String representing the timestamp the errand completed execution, Null if not finished. |
Error Conditions
|
|
A required parameter is missing from the request. |
|
Record count in the request exceeds the maximum allowed. |
|
The requested Import File Type does not exist. |
|
Due to an internal issue an Import Errand could not be created. |
|