Creates a new attribute whose values are stored in nodes of the same dimension.
Attributes require a
name
identifier and a
constraint.
The
AttributeConstraint describes the attribute's data type and any
other boundary conditions. The attribute's name must be unique among all other
attributes in the same dimension, for use by external systems to refer to or
access the attribute. Additionally, each attribute will be assigned a permanent,
system-generated ID at the time of creation; however, it is an error to set the
id
field as a part
of this operation.
Path Elements
+dimension
string
|
The URI path to a specific dimension (whether
by ID or
by name).
|
Example
- creating a new attribute
Request:
{
"name" : "POPULATION",
"labels": [
{
"locale" :"en",
"value" :"Population"
},
{
"locale" :"es",
"value" :"poblaciĆ³n"
}
],
"constraints": {
"type": "integer-constraints",
"min": 0
}
}
Response:
HTTP/1.1
201
CREATED
{
"id" : "c689acc7-ee13-3482-aa7b-c6a13419431c",
"name" : "POPULATION",
"label": {
"locale" :"en",
"value" :"Population"
},
"constraints": {
"type": "integer-constraints",
"min": 0
}
}
Example
- missing constraint and data type
Request:
{
"name" : "MY_ATTRIBUTE",
"labels": [
{
"locale" :"en",
"value" :"My Attribute"
}
]
}
Response:
HTTP/1.1
201
CREATED
{
"id" : "7f4731f0-36c6-4718-87b4-ce87ecd47a26",
"name" : "MY_ATTRIBUTE",
"label": {
"locale" :"en",
"value" :"My Attribute"
},
"constraints": {
"type": "text-constraints"
}
}
Error
Example
- the 'id' field cannot be assigned
Request:
{
"id" : "c689acc7-ee13-3482-aa7b-c6a13419431c",
"name" : "POPULATION",
"labels": [
{
"locale" :"en",
"value" :"Population"
}
],
"constraints": { "type": "integer-constraints" }
}
Response:
HTTP/1.1
400
BAD REQUEST
{
"errorID" : "DIM-001402",
"errorMessage": "Sorry, the 'id' field value cannot be pre-assigned when creating an attribute.",
"requestID" : "DIM-b7780800200c9a66",
"details": [ {"fieldID": "id"} ]
}
Error
Example
- the 'name' field is missing, empty, or contains only whitespace
Request:
{
"name" : " ",
"labels": [
{
"locale" :"en",
"value" :"Population"
}
],
"constraints": { "type": "integer-constraints" }
}
Response:
HTTP/1.1
400
BAD REQUEST
{
"errorID" : "DIM-001403",
"errorMessage": "Sorry, when creating an attribute the 'name' field must not be missing or blank.",
"requestID" : "DIM-b7780800200c9a66",
"details": [ {"fieldID": "name"} ]
}
Error
Example
- new attribute name is already in use
Request:
{
"name" : "POPULATION",
"labels": [
{
"locale" :"en",
"value" :"Population"
}
],
"constraints": { "type": "integer-constraints" }
}
Response:
HTTP/1.1
409
CONFLICT
{
"errorID" : "DIM-001404",
"errorMessage": "Sorry, the name 'POPULATION' is already used by an existing attribute in the dimension.",
"requestID" : "DIM-b7780800200c9a66",
"details": [ {"fieldID": "name"} ]
}
Error
Example
- missing request payload
Request:
Response:
HTTP/1.1
400
BAD REQUEST