Skip to main content

CreateItem

Create a new item

Description

Create a new item (using DisplayID).

Method

POST

Request URL Format

/api/v0/applications/:app-id/datastores/:datastore-id/items/new

URL Params

app-id      : Application ID(Specify the ID entered from the Hexabase screen)
datastore-id : Data Store ID(Specify the ID entered from the Hexabase screen)

Request URL Sample

POST https://api.xxx.com/api/v0/applications/APPNAME/datastores/DATABASEID/items/new

Payload

(例) Content-Type : application/json

{
"action_id": "NewAction2", // (Can be omitted.) If omitted, it will be registered by the new registration Action specified by default. The display ID (display_id) or internal ID (a_id) of the action can be specified.
"item": {
"field_id": "登録データ",
"title": "タイトル",
"assignee": "担当者"
},
"return_item_result": true, // If true, returns registered item information.
"return_display_id": true, // If true, returns the key of the registered item information as display_id
"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_force_update": true, // Force update of child Item (related_ds_items) if "rev_no" is not specified
"is_sync_related_items": true, // If true, the order in which related_ds_items are registered will be 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 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" : "", // 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
},{
// Multiple related items can be specified. sample omitted
}
]
"RELATED_DS_2" : [ // sample omission ]
"RELATED_DS_3" : [ // sample omission ]
}

Response Sample

{
"error": null,
"history_id": "5d661782aa39559a80479492",
"item_id": "5a2647410e24792d87451e34",
"item": {
 // If "return_item_result": true is specified for Payload, registered item information is returned
 // If "return_display_id": true is specified for Payload, the key of registered item information is returned by display_id
},
"pre_result": { // Prescripts are registered for the target action and returned if any results are available.
"result": "OK" // Return the result of pre-scripted ActionScript execution
},
"as_result": { // If the post script is registered for the target action and the result is available, return it.
"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": {
// registered item information is returned (not including related item details)
// 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.