Chores
Chores act like any other entity in the TM1 REST API. You can use create, read, update, and delete operations on chores. You can also execute a chore.
Chores are a container object for a set of TM1 processes. You can run processes in a certain order and schedule processes to be run at a certain time by using chores. For details, see Scheduling a Process for Automatic Execution with Chores.
The Chore
, ChoreTask
, and ChoreReference
entity types are used to perform the following actions with
the TM1 REST API:
- Retrieve a definition of an existing Chore (subjected to security context)
- Retrieve the chore's basic properties
- Retrieve the chore's tasks (by using a
ChoreTask
) - Retrieve the chore's execution mode
- Retrieve a set of chores (subjected to security context)
- Filter a set of chores (subjected to security context)
- Retrieve a set of chore properties (subjected to security context)
- Create a chore (subjected to security context)
- Modify an existing chore (subjected to security context)
- Modify a chore's basic properties
- Add a chore task
- Remove a chore task
The following examples demonstrate how to use chores in the TM1 REST API. These operations are
available with 10.2.2 FP2. For these examples to work, two TurboIntegrator processes need to be in
place, myProcess1
and myProcess2
. To learn how to add a
TurboIntegrator process to your TM1 model, see Creating a TurboIntegrator Process in the TM1
TurboIntegrator documentation and Create an entity (HTTP POST).
Create a chore
- POST
-
http://tm1server:8000/api/v1/Chores
- POST data
-
{ "Name": "myChore", "StartTime": "2012-07-27T23:03:00-04:00", "Frequency": "P223DT10H12M23S", "ExecutionMode": "MultipleCommit", "Tasks": [ { "Process@odata.bind": "Processes('myProcess1')", "Parameters": [ { "Name": "pParam1", "Value": "pValue1" }, { "Name": "pParam2", "Value": "pValue2" } ] }, { "Process@odata.bind": "Processes('myProcess2')" } ] }
Get the names of processes contained in a chore
- GET
-
http://tm1server:8000/api/v1/Chores('myChore')/Tasks?$expand=Process($select=Name)
Activate a chore
- POST
-
http://tm1server:8000/api/v1/Chores('myChore')/tm1.Activate
- POST data
- Not applicable.
Deactivate a chore
- POST
-
http://tm1server:8000/api/v1/Chores('myChore')/tm1.Deactivate
- POST data
- Not applicable.
Change some properties of a chore
- PATCH
-
http://tm1server:8000/api/v1/Chores('myChore')
- PATCH data
-
{ "ExecutionMode" : "SingleCommit", "StartTime": "2013-07-27T23:03:00Z", "Frequency": "P1DT2H3M4S" }
Add tasks to a chore
- POST
-
http://tm1server:8000/api/v1/Chores('myChore')/Tasks
- POST data
-
[ { "Process@odata.bind": "Processes('MyProcess1')", "Parameters": [ { "Name": "pParam1", "Value": "pValue1" }, { "Name": "pParam2", "Value": "pValue2" } ] }, { "Process@odata.bind": "Processes('MyProcess2')" } ]
Remove a Task from a chore
- DELETE
-
http://tm1server:8000/api/v1/Chores('myChore')/Tasks(1)
Change the settings of a Task
- PATCH
-
http://tm1server:8000/api/v1/Chores('myChore')/Tasks(1)
- PATCH data
-
{ "Process@odata.bind" : "Processes('plan_load_actual_ascii')", "Parameters": [ { "Name": "pParam1", "Value": "pNewValue1" }, { "Name": "pParam2", "Value": "pNewValue2" } ] }
Execute a chore
- POST
-
http://tm1server:8000/api/v1/Chores('myChore')/tm1.Execute
- POST data
- Not applicable.
List all chores that contain a certain TurboIntegrator process
- GET
-
http://tm1server:8000/api/v1/Chores?$filter=Tasks/any(t: t/Process/Name eq 'myProcess')