ExecuteBulkAction
Execute actions in bulk by specifying conditions
Description
- Execute actions on target items that match the specified conditions all at once, and add updates and comments to the items.
- It can be used in situations where you want to change the status all at once (batch approval, etc.), or when you want to update field values all at once.
- The number of simultaneous processing executions is 100 by default. You can specify up to 300 items with the
max_items
parameter. - If the
continue_proc
option is set to true, the target will be updated up to the maximum number when the maximum number is exceeded. All records can be updated by executing this API multiple times untilmatched
=processed
in the resulting JSON. - If you specify a map of item_id and revision number (rev_no) in
item_revisions
, an exclusive error check will be applied according to the revision number. If omitted, always determine the latest rev_no and update. (If no revision number is specified, execute with the force_update option = true, and exclusive control will not be performed)
Method
POST
Request URL Format
/api/v0/applications/:app-id/datastores/:datastore-id/items/bulkaction/:action-id
Payload
Seeconditionsfor more information on conditions
Content-Type : application/json
{
"conditions": [
{
"id": "i_id", // By specifying i_id, you can target the specified Item
"search_value": [
"58272f4efb90a148d850qwer", // item_id
"5846636efb90a1024d29as12", // item_id
"5846636efb90a1024d29asdf" // item_id (Multiple items can be specified)
]
},
{
"id": "STATUS_FLD", // Field ID of StatusID
"search_value": [
"New" // status_id
]
}
],
"item": { // Specifies the fields and values to update the Item
"TEXT_FIELD_1": "更新データサンプル", // field_id : update value
"SELECT_FIELD_1": ["5ab84c1fcce5fe5c983ea186","5846636efb90a1024d2982fa" ], // For select type Field Specify the array of option ID o_id
"USER_FIELD_1": ["58272f4efb90a148d8508d9c","5ab84c1fcce5fe5c983ea999" ], // For user type Field, specify the array of user_id
"FILE_FIELD_1": ["5ab84c1fcce5fe5c983ea185","5ab84c1fcce5fe5c983ea789" ] // For attachment file type Field, specify an array of file_ids
},
"item_revisions": { // If item_revisions is specified, an exclusive error check will be applied to the corresponding Item. Items that are omitted or do not have Revision specified will be updated with the specified value (is_force_update: true is applied)
"58272f4efb90a148d850qwer": 1, // item_id : rev_no
"5846636efb90a1024d29as12": 3,
"5846636efb90a1024d29asdf": 12
},
"comment": "一括承認", // A comment message will be added to the item when the action is executed
"max_items": 100, // Maximum number of process executions. The default is 100. Up to 300 cases. Specify in units of 10 (10,20,30,...300)
"use_display_id" : true, // Specify the display ID. If true, display ID can be used for field ID
"continue_proc": true, // (default) false: error if the target exceeds max_items (do not process even one item); if true, if the number of target items exceeds max_items, process up to max_items.
"as_params": {"param1": "value1", "param2": "value2",}, // Any Object (type format is free) can be passed to ActionScript. Passed to both PRE/POST ActionScript. From within ActionScript it can be referenced as `data.as_params`.
"realtime_auto_link": true, // If true, run auto_link creation synchronously(processing will be slightly slower because of synchronous execution).
"access_key_updates": { // Specify access key
"overwrite": true, // Overwrite and save the access key (default is false: add to existing key)
"ignore_action_settings": true, // Do not use the public settings set in the action (only the key specified in this payload is given)
"groups_to_publish": ["GROUP1", "GROUP2"], // Specify group display_id (only keys held by the execution user can be specified)
"roles_to_publish": ["ADMIN", "MEMBER"], // Specify role display_id (only keys held by the execution user can be specified)
"users_to_publish": ["607c2a25844887b6855a12a9", "5f25956428dc5c55b463bc77" ] // Specify user_id (user_id existing in workspace can be specified)
}
}
- The information in the update item specifies only the changes.
- The value for updating can also be specified as an array to the
changes
property.
"changes": [
{
"id": "5a26722e0e24794c979fa5b6",
"value": "更新データサンプル"
},
{
"id": "5ab84bfecce5fe5c983ea184", // user type Fieldの場合
"value": [
"58272f4efb90a148d8508d9c", // user_id
"5846636efb90a1024d2982fa" // user_id
],
},
{
"id": "5ab0c239cce5fed3a859a910", // attachment file type Fieldの場合
"value": [
"5ab84c1fcce5fe5c983ea185", // file_id
"5ab84c1fcce5fe5c983ea186" // file_id
],
},
]
Request URL Sample
POST https://api.xxx.com/api/v0/applications/TestApp/datastores/SampleDB/items/bulkaction/UpdateAction
Response Sample
// Success
{
"has_error": false,
"result": {
"matched": 99,
"processed": 99
}
}
// Partial error
{
"errors": [
{
"description": "item:601a572c28dc5c4e8c0783cd(d_id:5f263b7628dc5c6af0b1206a) has rev_no:4 but specified rev_no:2",
"error": "Revision number mismatch",
"error_code": "ITEM_REV_CONFLICT", // Exclusion error
"error_level": "ERROR",
"reference_id": "601a572c28dc5c4e8c0783cd" // Target ItemID at the time of the exclusion error
},
{
"description": "error occurred when execute action",
"error": "Error",
"error_code": "SYSTEM_ERROR",
"error_level": "ERROR",
"reference_id": "5c6a674f84f4be1f241ff4af" // Error target ItemID
}
],
"has_error": true,
"result": {
"matched": 21,
"processed": 19
}
}
// Warn output if the number of target items exceeds max_items (for example, max_items:10).
{
"errors": [
{
"description": "the number of items has reached max_items 10",
"error_level": "WARN"
}
],
"has_error": true,
"result": {
"matched": 15,
"processed": 10
}
}
// Warn output if the target number is not found
{
"errors": [
{
"description": "target was not found.",
"error": "",
"error_level": "WARN"
}
],
"has_error": false,
"result": {
"matched": 0,
"processed": 0
}
}