UpdateItem
Edit an item (using DisplayID)
Description
Update the specified item (given the ID entered from the Hexabase screen).
Method
POST
Request URL Format
/api/v0/applications/:app-id/datastores/:datastore-id/items/edit/:item-id
URL Params
app-id : Application ID(ID or internal ID [p_id] entered from the Hexabase screen)
datastore-id : Data store ID(ID or internal ID [p_id] entered from the Hexabase screen)
item-id : ID of the subject item
Payload
{
"comment": "test-comment"
"item": {
"CAR_NAME": "名前のデータ", // text type
"CAR_TYPE": "5d4c058baa39555618ac9e98", // select type
"OPTIONS" : [ "58bbaa27fbfcba6098746061", "596e2327fbfcbab8283dde09"] // checkbox type
},
"use_display_id" : true, // Use displayID for ID. If groups_to_publish is used, set to true.
"is_force_update": true, // Do not use the rev_no specification (ignore the exclusivity control and perform post-win registration).
"return_item_result": true, // If true, returns registered item information.
"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 the payload (processing will be slightly slower because of synchronous execution).
"related_ds_items" : {
"関連データストアID_1" : [{ },{ },{ },{ }... ] , // Specify new, updated, or deleted associated data stores. Please see details below.
"関連データストアID_2" : [{ },{ },{ },{ }... ] ,
},
"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 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 (if specified individually, the contents 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 (new, update, delete, add link, delete link operations can be specified).
"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 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 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)
},
"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
"action_id" : "", // delete actionID *Omit this option (if omitted, the default delete action will be used)
"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 link
"i_id" : "58bbaa27fbfcba609874aqr47", // Target item ID
},{
// 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 in the
changes
property as follows:
"changes": [
{
"id": "CAR_TYPE",
"value": "5d4c058baa39555618ac9e98" // select type
},
{
"id": "CAR_NAME",
"value": "名前のデータ" // text type
},
{
"id": "OPTIONS",
"value": [ "58bbaa27fbfcba6098746061", "596e2327fbfcbab8283dde09"] // checkbox type
}
],
Grant group roles when items are updated; set use_display_id to true if screen group ID is used; unify all screen group IDs if screen group ID is used; unify all screen group IDs if system group ID (g_id) is used. Determine whether roles can be granted based on the user roles held by the current user. Example: A warning is returned if a group cannot be granted from the lower level of the group tree to the upper level. Groups can be granted from the upper level to the lower level.
Request URL Sample
POST https://api.xxx.com/api/v0/applications/APPNAME/datastores/DATABASEID/items/edit/5d4c058baa39555618ac9e8b
Response Sample
{
"error": "",
"itemHistory": {
"IsChanged": true,
"UserObjID": "62d657fb0ac22e357f5b69c4",
"action_id": "62d7b390cc1351eb97f32be8",
"comment": "ITEM_DETAILS.POST_EMPTY_COMMENT",
"created_at": "2022-07-28T07:18:53.21601Z",
"datastore_id": "62d7b36da69d9d279545cbc7",
"datastore_name": "",
"display_order": 0,
"email": "",
"history_id": "62e2385db8464bb1e358dabd",
"i_id": "62d7b3a4a69d9d279545cbda",
"is_fetchreplymail": false,
"is_notify": true,
"item_id": "62d7b3a4a69d9d279545cbda",
"media_link": "",
"post_for_rel": false,
"post_mode": "ExecuteAction",
"project_id": "62d7b261cc1351eb97f32bd7",
"transaction_id": "62e2385db8464bb1e358dab8",
"updated_at": "0001-01-01T00:00:00Z",
"user_id": "62d657fb0ac22e357f5b69c4",
"workspace_id": "62d7afb1cc1351eb97f32bcf"
},
"rev_no": {
"_id": "62d7b3a4a69d9d279545cbda",
"rev_no": 3
},
"pre_result": {
"result": "OK" // Return the result of pre-scripted ActionScript execution
},
"as_result": {
"result": "OK" // Returns the result of the ActionScript post script execution (if synchronous execution is on)
}
}
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
- Please refer to the error description section of ExecuteAction when an error occurs.
- Please refer here for error codes.