Skip to main content

GetAutoNumber

Auto number API

Description

  • Get the auto-numbering result for a specific field in the data store.
  • Store and save the obtained results in a separate field.

Related information > About the numbering API's automatic numbering

Method

GET

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)

Query Params

branch_key      : Specify branch number code (optional)
zero_padding : Pad number with zeros Example) 1 -> 0001
digit : Specify the number of digits Example) 5 -> 00001

Request URL Sample

GET https://api.xxx.com/api/v0/applications/APP_NAME/datastores/DS_NAME/fields/Branch-No/autonum?branch_key=SUB_&zero_padding=true&digit=3

Response Description

  • Returns a number for each branch_key in the specified format after the prefix specified in the auto-numbering field
  • Prefixes are specified in the field settings in the UI on Hexabase

Response Sample

Example1

  • Specify the prefix auto-numbering item as PREFIX_(in Hexabase UI)
  • Specify the following QueryParam
    • branch_key=SUBCODE_
    • zero_padding=true
    • digit=3
{
"has_error": false,
"result": {
"number": 4,
"value": "PREFIX_SUBCODE_004"
}
}

Example2

  • Specify the prefix A for auto-numbering items (in Hexabase UI)
  • Specify the following in QueryParam
    • branch_keyis not specified
    • zero_padding=true
    • digit=5
{
"has_error": false,
"result": {
"number": 1,
"value": "A00001"
}
}

Errors

  • When an error occurs, an error is returned as follows.
  • Please referherefor 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 403(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 the type AutoNumber. Otherwise, an error will occur.
HTTP 403(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
}