ExecuteAction
Execute the specified action
Description
Execute the specified action to update the item and add a comment.
Method
POST
Request Format
/api/v0/applications/:app-id/datastores/:datastore-id/items/action/:item-id/:action-id
Payload
Content-Type : application/json
{
"comment": "test-comment",
"return_item_result": true, // If true, returns updated item information
"item": {
"5e256923aeae8e212cb2e03b": "value", // text type
"58bbaa27fbfcba6098746061": "5d4c058baa39555618ac9e98", // select type
"58bbaa27fbfcba6098746067" : [ "58bbaa27fbfcba6098746015", "596e2327fbfcbab8283dde09"] // checkbox type
},
"rev_no":8, // Current revision number
"ensure_transaction": false, // If true, all registrations will be rolled back if even one error occurs during the processing of a related item. The default is false, which means that successful related_item registrations and updates will be reflected, and error messages will be returned for details that have errors.
"exec_children_post_procs": true, // If true is specified, ActionScript (POST ActionScript), Webhook execution, automatic link generation, and notification processing will also be performed for related_ds_items. (Note: PRE ActionScript is not executed for related_ds_items.
"as_params": {"param1": "value1", "param2": "value2",}, // You can pass any object (of any type) to ActionScript, and it will be passed to both PRE and POST ActionScript. From within ActionScript, you can refer to it as `data.as_params`.
"is_sync_related_items": true, // If true, related_ds_items will be registered in the order specified in payload (processing will be slightly slower because of synchronous execution).
"related_ds_items" : {
"関連データストアID_1" : [{ },{ },{ },{ }... ] ,
"関連データストアID_2" : [{ },{ },{ },{ }... ]
}, // Specify new, updated, or deleted associated data stores. Please see details below.
"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: append to the existing key)
"ignore_action_settings": true, // Do not use the public settings set in the action (only grant the key specified in this Payload).
"apply_related_ds": true, // Use the same settings for items specified in related_ds_items (if specified individually, they will be executed).
"groups_to_publish": ["GROUP1", "GROUP2"], // Specify group display_id (only keys held by the executing user can be specified).
"roles_to_publish": ["ADMIN", "MEMBER"], // Specify role display_id (only keys held by the executing user can be specified)
"users_to_publish": ["607c2a25844887b6855a12a9", "5f25956428dc5c55b463bc77" ] // Specify user_id (user_id existing in workspace can be specified).
}
}
- To use the transaction feature, specify ensure_transaction: true. In this case, if even one error occurs during the processing of a related item, all registrations will be rolled back. The default is false, which means that successful related_item registrations and updates will be reflected, and error messages will be returned for details that have errors.
- To update related items at the same time, specify in the following format:
"related_ds_items" : { // Specify new, updated, or deleted associated data stores
"RELATED_DS_1" : [
{
"operation" : 1, // new
"link_to_parent": true, // Create a data link to the parent Item (both links will be created) default: false (only link from parent to the specified i_id)
"action_id" : "", // new actionID *Omit this option (if omitted, the default new action will be used)
"item": {
"FIELD_ID1" : "data",
"FIELD_ID2" : "data",
"FIELD_ID3" : "data",
"FIELD_ID4" : "data",
},
"access_key_updates": { // Specify access keys individually
"overwrite": true, // Overwrite and save the access key (default is false: append to the existing key).
"ignore_action_settings": true, // Do not use the public settings set in the action (only grant the key specified in this Payload).
"apply_related_ds": true, // Use the same settings for items specified in related_ds_items.
"groups_to_publish": ["GROUP1", "GROUP2"], // Specify group display_id (only keys held by the executing user can be specified)
"roles_to_publish": ["ADMIN", "MEMBER"], // Specify group display_id (only keys held by the executing user can be specified)
"users_to_publish": ["607c2a25844887b6855a12a9", "5f25956428dc5c55b463bc77" ] // Specify user_id (user_id existing in workspace can be specified)
},
"related_ds_items" : { // related_ds_items can also be nested. (Multiple nesting of the same Datastore is not allowed.)
"関連データストアID_3" : [{ },{ },{ },{ }... ] ,
}
},{
"operation" : 2, // update
"action_id" : "Update2", // update actionID *Omit this option (if omitted, the default update action will be used).
"link_to_parent": true, // Create a data link to the parent Item (both links will be created) default: false (only link from parent to the specified i_id).
"i_id" : "58bbaa27fbfcba609874aaa3f", // Target Item ID
"item": {
"FIELD_ID1" : "data",
"FIELD_ID3" : "data"
},
"access_key_updates": { // Specify access keys individually
"overwrite": true, // Overwrite and save the access key (default is false: append to the existing key)
"ignore_action_settings": true, // Do not use the public settings set in the action (only grant the key specified in this Payload).
"apply_related_ds": true, // Use the same settings for items specified in related_ds_items.
"groups_to_publish": ["GROUP1", "GROUP2"], // Specify group display_id (only keys held by the executing user can be specified).
"roles_to_publish": ["ADMIN", "MEMBER"], // Specify role display_id (only keys held by the executing user can be specified)
"users_to_publish": ["607c2a25844887b6855a12a9", "5f25956428dc5c55b463bc77" ] // Specify user_id (user_id existing in workspace can be specified).
},
},{
"operation" : 3, // delete
"i_id" : "58bbaa27fbfcba609874aqr45", // Target Item ID
},{
"operation" : 11, // add link : Create a link
"link_to_parent": true, // Create a data link to the parent Item (both links will be created). default: false (only link from parent to the specified i_id)
"i_id" : "58bbaa27fbfcba609874aqr46", // Target Item ID
},{
"operation" : 12, // remove link : Remove
"i_id" : "58bbaa27fbfcba609874aqr47", // Target Item ID
},{
// Multiple related items can be specified. sample omitted
},{
// Multiple related items can be specified. sample omitted
},{
// Multiple related items can be specified. sample omitted
}
]
"RELATED_DS_2" : [ // sample omitted ]
"RELATED_DS_3" : [ // sample omitted ]
}
- The value for updating can also be specified as an array to the
changes
property.
"changes": [
{
"id": "5e256923aeae8e212cb2e03b",
"value": "value"
},
{
"id": "58bbaa27fbfcba6098746061",
"value": "5d4c058baa39555618ac9e98",
},
{
"id": "58bbaa27fbfcba6098746067",
"value": [ "58bbaa27fbfcba6098746015", "596e2327fbfcbab8283dde09"], // checkbox type
},
]
Request Sample
POST https://api.xxx.com/api/v0/applications/:app-id/datastores/:datastore-id/items/action/:item-id/:action-id
Response Sample
null
If "return_item_result": true is specified for Payload, the registered item information will be returned
{
"item": {
// The registered item information will be retrieved (but not the details of related items).
// If there is related data, the datastore_id and item_id group of the target item is returned in links.
"links": [
{
"d_id": "62bc37653f0b074bc12f5cfa",
"i_ids": [
"62bc376ba678e4e7ee1da6b6"
]
},
{
"d_id": "62bc3942a678e4e7ee1da6cf",
"i_ids": [
"63454d2fd4958dbd8b63f990",
"63454d2fd4958dbd8b63f98c"
]
}
]
}
}
Errors
- When an error occurs, an error is returned as follows.
- Please refer here for error codes.
Revision Matching Error for Item
- To update an Item, you must provide rev_no in the request payload or pass is_force_update: true to force an update. If another user has updated the corresponding Item first, a Revision error will occur.
HTTP 409 or 200 (Related datastore only; if this error occurs, 200 is returned, including the error message.)
{
"error": [
{
"description": "item:601978f228dc5c3c64e5b895(d_id:5f38b0afaa395581685afdf6) has rev_no:14 but specified rev_no:0",
"error": "Revision number mismatch",
"error_code": "ITEM_REV_CONFLICT",
"error_level": "ERROR",
"reference_id": "601978f228dc5c3c64e5b895"
}
],
"history_id": "609e6016f3d4d143baa13070",
"item": {
// (itemの値)
},
"item_id": "609e6015f3d4d143baa1306e"
}
ActionID specification error
- If the specified database or action ID is not found, the following error occurs:
- For example, if the current workspace of the logged-in user is facing a different workspace, the corresponding action may not be found, and this error may occur.
{
"error": "no available actions to create new item in the database. you should check settings or check if you are in your current workspace[ xxxxxxxxxxxxxxxxxx ]"
}
Other Errors
Note: For backward compatibility, the following error checks are only applied to workspaces created after July 2021. If you wish to enable this check for workspaces created prior to July 2021, please contact Hexabase for individual activation.
Authorization error in Action
- If there is no authorization for the corresponding Action, the following error occurs:
HTTP403
{
"error": "invalid action_id or has no privileges to the user or current item status. a_id:MoveToAssigned(5f38a11caa39556e74845a43) d_id:SAMPLEDB(5f38a11baa395581685afdb4)",
"error_code": "NO_PRIVILEGES"
}
Target Item not found
- This error occurs if there is an error in the ItemID to be updated or if another user has deleted the corresponding Item.
HTTP404
{
"description": "item is not found for i_id:601e5c3728dc5c447cfbc3b1",
"error": "target item was not found",
"error_code": "NOT_FOUND"
}
Related Item not found
- If the corresponding item cannot be found for the related Item, an error is returned in the error array. If the parent Item is successfully updated, the HTTP response will be 200.
HTTP 200
"error": [
{
"description": "couldn't check rev_no or item not found. ds:5f38a11baa395581685afdb4 i:609d0a6de59c442b85b0fed0 ",
"error": "couldn't check rev_no",
"error_code": "NOT_FOUND",
"error_level": "ERROR",
"reference_id": "d_id:5f38b0afaa395581685afdf6"
}
],
Incomplete input data
- For the associated Item, if the input data for the executed Aciton is incomplete, an error is returned in the error array.
- INVALID_VALUE (required field for this action) No data was entered in the required input field.
- NO_PRIVILEGES (not arrowed to update this field for this action) You attempted to enter data into a field that is set to be hidden or disabled for entry.
HTTP 400
{
"error_code": "INVALID_VALUE"
"description": "input validation error. datastore:TODO-SAMPLE action:(default edit)",
"error": [
{
"description": "d_id: 611e67c9720bbecb02013e64 field: Category(f_id:611e67c9485729c3fde24788), value: (not specified)",
"error": "required field for this action 611e67ca485729c3fde2479f (show,update,required)=(true,true,true)",
"error_code": "INVALID_VALUE",
"error_level": "ERROR"
},
{
"description": "d_id: 6121fccd27ef72f577ad28bc field: Number(f_id:6121fd24170986e3a7cfcb9b), value: 111",
"error": "not arrowed to update this field for this action 6121fcce170986e3a7cfcb98 (show,update,required)=(false,false,false)",
"error_code": "NO_PRIVILEGES",
"error_level": "ERROR"
}
]
}
Incomplete data entered into related Item
- For the associated Item, if the input data for the executed Aciton is incomplete, an error is returned in the error array.
- INVALID_VALUE (required field for this action) No data was entered in the required input field.
- NO_PRIVILEGES (not arrowed to update this field for this action) You attempted to enter data into a field that is set to be hidden or disabled for entry.
HTTP 400
"error": [
{
"description": "d_id: 6121fccd27ef72f577ad28bc field: Assignee(f_id:6121fd67170986e3a7cfcb9c), value: (not specified)",
"error": "required field for this action 6121fcce170986e3a7cfcb98 (show,update,required)=(true,true,true)",
"error_code": "INVALID_VALUE",
"error_level": "ERROR"
},
{
"description": "d_id: 6121fccd27ef72f577ad28bc field: Number(f_id:6121fd24170986e3a7cfcb9b), value: 111",
"error": "not arrowed to update this field for this action 6121fcce170986e3a7cfcb98 (show,update,required)=(false,false,false)",
"error_code": "NO_PRIVILEGES",
"error_level": "ERROR"
}
],