Add a version
1 min
POST
{baseUrl}/idgen/templates/{name}/versions
Path Parameters
- namestringrequiredDescription
Body Parameters
- bodyVersionDraftDtorequiredDescription
- separatorstringrequiredDescription
- segmentsSegmentDto[]Description
- typestringrequiredDescription
- valuestringDescription
- startinteger<int64>DescriptionFormatint64
- endinteger<int64>DescriptionFormatint64
- stepinteger<int64>DescriptionFormatint64
- paddinginteger<int32>DescriptionFormatint32
- charsetstringDescription
- charsstringDescription
- lengthinteger<int32>DescriptionFormatint32
- startTextstringDescription
- endTextstringDescription
- blockSizeinteger<int32>DescriptionFormatint32
- continuesFrominteger<int32>DescriptionFormatint32
Responses
201
- VersionDtoDescription
- versioninteger<int32>requiredDescriptionFormatint32
- statestringrequiredDescription
- separatorstringrequiredDescription
- segmentsSegmentDto[]Description
- typestringrequiredDescription
- valuestringDescription
- startinteger<int64>DescriptionFormatint64
- endinteger<int64>DescriptionFormatint64
- stepinteger<int64>DescriptionFormatint64
- paddinginteger<int32>DescriptionFormatint32
- charsetstringDescription
- charsstringDescription
- lengthinteger<int32>DescriptionFormatint32
- startTextstringDescription
- endTextstringDescription
- blockSizeinteger<int32>requiredDescriptionFormatint32
- continuesFrominteger<int32>DescriptionFormatint32
- activatedAtstring<date-time>DescriptionFormatdate-time
- createdAtstring<date-time>requiredDescriptionFormatdate-time
- linksmap<string, string>requiredDescription
400
- ErrorDtoDescription
- errorstringrequiredDescription
- messagestringrequiredDescription
- statusinteger<int32>requiredDescriptionFormatint32
- detailsmap<string, string>requiredDescription
- linksmap<string, string>requiredDescription
401
- ErrorDtoDescription
- errorstringrequiredDescription
- messagestringrequiredDescription
- statusinteger<int32>requiredDescriptionFormatint32
- detailsmap<string, string>requiredDescription
- linksmap<string, string>requiredDescription
403
- ErrorDtoDescription
- errorstringrequiredDescription
- messagestringrequiredDescription
- statusinteger<int32>requiredDescriptionFormatint32
- detailsmap<string, string>requiredDescription
- linksmap<string, string>requiredDescription
404
- ErrorDtoDescription
- errorstringrequiredDescription
- messagestringrequiredDescription
- statusinteger<int32>requiredDescriptionFormatint32
- detailsmap<string, string>requiredDescription
- linksmap<string, string>requiredDescription
422
- ErrorDtoDescription
- errorstringrequiredDescription
- messagestringrequiredDescription
- statusinteger<int32>requiredDescriptionFormatint32
- detailsmap<string, string>requiredDescription
- linksmap<string, string>requiredDescription
500
- ErrorDtoDescription
- errorstringrequiredDescription
- messagestringrequiredDescription
- statusinteger<int32>requiredDescriptionFormatint32
- detailsmap<string, string>requiredDescription
- linksmap<string, string>requiredDescription
503
- ErrorDtoDescription
- errorstringrequiredDescription
- messagestringrequiredDescription
- statusinteger<int32>requiredDescriptionFormatint32
- detailsmap<string, string>requiredDescription
- linksmap<string, string>requiredDescription
curl
curl --request POST \
--url http://localhost:8080/idgen/templates/{name}/versions \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"separator": "",
"segments": [
{
"type": ""
}
]
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"separator": "",
"segments": [
{
"type": ""
}
]
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("http://localhost:8080/idgen/templates/{name}/versions", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("http://localhost:8080/idgen/templates/{name}/versions")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"separator": "",
"segments": [
{
"type": ""
}
]
})
response = http.request(request)
puts response.read_body
python
import requests
import json
url = "http://localhost:8080/idgen/templates/{name}/versions"
payload = json.dumps({
"separator": "",
"segments": [
{
"type": ""
}
]
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
201
// The new DRAFT version.
{
"version": "",
"state": "",
"separator": "",
"segments": [
{
"type": "",
"value": "",
"start": "",
"end": "",
"step": "",
"padding": "",
"charset": "",
"chars": "",
"length": "",
"startText": "",
"endText": ""
}
],
"blockSize": "",
"continuesFrom": "",
"activatedAt": "",
"createdAt": "",
"links": ""
}400
// INVALID_REQUEST: a malformed path or body value, or an invalid name.
{
"error": "",
"message": "",
"status": "",
"details": "",
"links": ""
}401
// UNAUTHENTICATED: missing, expired or invalid credentials.
{
"error": "",
"message": "",
"status": "",
"details": "",
"links": ""
}403
// FORBIDDEN: the caller lacks the idgen.templates.write permission, or its tenant or site scope does not match.
{
"error": "",
"message": "",
"status": "",
"details": "",
"links": ""
}404
// NAMESPACE_NOT_FOUND: no such template (or it was deleted).
{
"error": "",
"message": "",
"status": "",
"details": "",
"links": ""
}422
// INVALID_FORMAT (message lists every violation) or FORMAT_OVERLAP (details.conflictingVersion, details.exampleId).
{
"error": "",
"message": "",
"status": "",
"details": "",
"links": ""
}500
// INTERNAL_ERROR: an unexpected failure. Retry once, then report it with the x-request-id.
{
"error": "",
"message": "",
"status": "",
"details": "",
"links": ""
}503
// AUTH_UNAVAILABLE or BACKEND_UNAVAILABLE (both retryable): retry with backoff.
{
"error": "",
"message": "",
"status": "",
"details": "",
"links": ""
}