Create locale
1 min
POST
https://api.cms.optimizely.com/v1/locales
Header Parameters
- Preferstring[]Example
[ "return=representation" ]
Description
Body Parameters
- bodyLocalerequiredDescription
- keystringrequiredDescriptionMin Length1
- displayNamestringrequiredDescriptionMin Length1Max Length255
- isEnabledbooleanDescription
- routeSegmentstringrequiredDescriptionMin Length1Max Length255
- sortOrderinteger<int32>DescriptionFormatint32
- accessRightsSecurityIdentity[]Description
- namestringrequiredDescriptionMin Length1Max Length255
- typestringExamplesuserroleapplicationDescriptionMax Length50
- fallbackstringDescription
Responses
201
- LocaleDescription
- keystringrequiredDescriptionMin Length1
- displayNamestringrequiredDescriptionMin Length1Max Length255
- isEnabledbooleanDescription
- routeSegmentstringrequiredDescriptionMin Length1Max Length255
- sortOrderinteger<int32>DescriptionFormatint32
- accessRightsSecurityIdentity[]Description
- namestringrequiredDescriptionMin Length1Max Length255
- typestringExamplesuserroleapplicationDescriptionMax Length50
- createdstring<date-time>DescriptionFormatdate-time
- createdBystringDescription
- lastModifiedstring<date-time>Formatdate-time
- lastModifiedBystringDescription
- fallbackstringDescription
Response Headers
- ETagstringDescription
- Last-Modifiedstring<http-date>DescriptionFormathttp-date
- LocationstringDescription
- Preference-Applied
400
401
403
409
429
- ProblemDetails
- typestring<uri>DescriptionFormaturi
- titlestringDescription
- statusinteger<int32>DescriptionFormatint32Minimum100Maximum599
- detailstringDescription
- instancestring<uri>DescriptionFormaturi
- codestringDescription
- errorsobject[]Description
- detailstringDescription
- fieldstringExampleDescription
Response Headers
- Retry-AfternumberDescription
500
curl
curl --request POST \
--url https://api.cms.optimizely.com/v1/locales \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"key": "",
"displayName": "",
"routeSegment": "",
"accessRights": [
{
"name": ""
}
]
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"key": "",
"displayName": "",
"routeSegment": "",
"accessRights": [
{
"name": ""
}
]
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.cms.optimizely.com/v1/locales", 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("https://api.cms.optimizely.com/v1/locales")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"key": "",
"displayName": "",
"routeSegment": "",
"accessRights": [
{
"name": ""
}
]
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.cms.optimizely.com/v1/locales"
payload = json.dumps({
"key": "",
"displayName": "",
"routeSegment": "",
"accessRights": [
{
"name": ""
}
]
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
201
// Created
{
"key": "",
"displayName": "",
"isEnabled": false,
"routeSegment": "",
"sortOrder": "",
"accessRights": [
{
"name": "",
"type": "user"
}
],
"created": "",
"createdBy": "",
"lastModified": "",
"lastModifiedBy": "",
"fallback": ""
}400
// Bad Request
401
// Unauthorized
403
// Forbidden
409
// Conflict
429
// Too Many Requests
{
"type": "",
"title": "",
"status": "",
"detail": "",
"instance": "",
"code": "",
"errors": [
{
"detail": "",
"field": "properties.header.displayName"
}
]
}500
// Internal Server Error