User-Defined Sequences
A user-defined sequence generates unique numbers for a specific purpose. Configure the sequence through the /usersequences resource and use the code authorization_number for the authorization number sequence.
Maintain User-Defined Sequences
Send a POST request to /usersequences with the required unique sequence code:
{
"code": "authorization_number"
}
When you omit optional settings, the sequence starts at its minimum value and increments by 1. The system returns sequence metadata through the HTTP API. To review configured sequences, send a GET request to /usersequences.
The sequence code identifies the number generator. You cannot update an existing sequence. To change its settings, delete the sequence and create it again. Before recreating a sequence, set startWith to a value that accounts for numbers already used.
Configure Sequence Settings
You can provide these optional settings when you create a sequence:
-
incrementBy: Sets the interval between sequence numbers. Specify a nonzero positive or negative integer. A positive value makes the sequence ascend; a negative value makes it descend. The value can have up to 28 digits for an ascending sequence or 27 digits for a descending sequence. Its absolute value must be less than the difference betweenmaxValueandminValue. If you omit this setting, the interval is 1. -
startWith: Sets the first number that the sequence generates. For an ascending sequence, the default isminValue; for a descending sequence, the default ismaxValue. The value can have up to 28 digits when positive or 27 digits when negative. -
minValue: Sets the smallest number in the sequence. The value can have up to 28 digits when positive or 27 digits when negative. It must be less than or equal tostartWithand less thanmaxValue. -
maxValue: Sets the largest number in the sequence. The value can have up to 28 digits when positive or 27 digits when negative. It must be greater than or equal tostartWithand greater thanminValue.
Use startWith to continue numbering from the latest value used in another system.
To validate a sequence, the system creates it in the Oracle database with the specified values or database defaults for omitted attributes. If the database cannot create the sequence, the system returns HTTP 422. Omitted attributes that use database defaults do not appear as values in retrieved data.
A sequence that the database creates is not necessarily usable. For example, the following setting combinations create a sequence, but requesting its next number raises the listed database error:
| incrementBy | startWith | minValue | maxValue | Database Error |
|---|---|---|---|---|
-2 |
-1 |
0 |
100 |
|
2 |
20 |
10 |
18 |
|