Skip to main content

UpdateAutoNumber

Auto number field update API

Description

  • Updates auto-numbered values for specific fields in the data store

Related information > About the numbering API's automatic numbering

Method

POST

Request URL Format

/api/v0/applications/:app-id/datastores/:datastore-id/fields/:field-id/autonum

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)
field-id : Field ID for auto-numbering items(Specify the ID entered from the Hexabase screen)

Payload

Content-Type : application/json

{
"auto_num": 1, // Required
"branch_key": "branch-" // (Optional)By specifying it, getAutoNumber will target the auto-number value set with branch_key
}

Request URL Sample

POST https://api.xxx.com/api/v0/applications/APP_NAME/datastores/DS_NAME/fields/Branch-No/autonum

Response Description

  • Return the formatted form for updated values and autonumber field settings

Request Sample

Example1

  • auto_numOnly specified

Payload

{
"auto_num": 1
}

Response

{
"has_error": false,
"result": {
"number": "000000001",
"value": 1
}
}
Target itemfield-idauto_numbranch_key
Branch-No2NULL
Branch-No3""
Branch-No1branch-
  • If branch_key is not specified, the value at the time of automatic number field display will be updated

Example2

  • Specify""(empty) for branch_key

Payload

{
"auto_num": 1,
"branch_key": ""
}

Response

{
"has_error": false,
"result": {
"number": "000000001",
"value": 1
}
}
Target itemfield-idauto_numbranch_key
Branch-No2NULL
Branch-No3""
Branch-No1branch-
  • if branch_key is specified as ""(empty), the value when branch_key is not specified in GetAutoNumber will be updated.

Example3 -Specify branch- for branch_key

Payload

{
"auto_num": 1,
"branch_key": "branch-"
}

Response

{
"has_error": false,
"result": {
"number": "branch-000000001",
"value": 1
}
}
Target itemfield-idauto_numbranch_key
Branch-No2NULL
Branch-No3""
Branch-No1branch-

Errors

  • When an error occurs, an error is returned as follows.
  • Please refer here for error codes。

The corresponding field was not found.

  • An error will occur if the specified data store or field ID is incorrect or cannot be found.
HTTP 400(Bad Request)

{
"errors": [
{
"description": "invalid fieldID in the datastore",
"error": "could not find field for AutoNum1",
"error_code": "INVALID_PARAMS",
"error_level": "ERROR",
"reference_id": "f_id:AutoNum1"
}
],
"has_error": true,
"result": null
}
  • The specified field must be of type AutoNumber. Otherwise, an error will occur.
HTTP 400(Bad Request)
{
"errors": [
{
"description": "invalid fieldID in the datastore",
"error": "specified field[600a839528dc5c3e9cd7e7de] is not the auto number type",
"error_code": "INVALID_PARAMS",
"error_level": "ERROR",
"reference_id": "f_id:600a839528dc5c3e9cd7e7de"
}
],
"has_error": true,
"result": null
}
  • If the specified branch_key does not exist, an error is returned.
HTTP 400(Bad Request)
{
"errors": [
{
"description": "error update auto_number",
"error": "could not find field for f_id: 63ce11b063c4431d4443e880 branch_key: branch-",
"error_code": "INVALID_PARAMS",
"error_level": "ERROR",
"reference_id": "f_id:63ce11b063c4431d4443e880"
}
],
"has_error": true,
"result": null
}