Setting up an auto increment field

Auto increment is a Master Data feature that automatically creates unique and sequential values to integer type fields when new documents are created.

πŸ“˜

The starting value of auto increment fields is always 1. This value can not be changed.

Set up

Auto increment fields can be set up in data entities' JSON schemas.

Create an integer field and add its name to the v-auto-increment property, like in the example below:

{
    "properties": {
        "valueAsAutoIncrement": {
            "type": "integer"
        }
    },
    "v-auto-increment": [
        "valueAsAutoIncrement"
    ]
}

🚧

Keep in mind that:

  • The auto-increment field cannot be required.
  • The field's type has to be integer.

Usage

When saving new documents you must identify the corresponding JSON Schema with the query parameter _schema. See an example of this:

POST
https://{accountName}.{environment}.com.br/api/dataentities/{dataEntityName}/documents?_schema={schemaName}