Create attribute
POST/attributes
Before setting an attribute value for a specific resource, the attribute definition needs to be created. This endpoint is used to create a single attribute definition.
If an attribute is successfully created, the response will include the attribute id.
Fields
Name | Required |
---|---|
name | yes |
class | yes |
isPublic | no Default value is true |
isSearchable | no Default value is false |
isSystem | no Default value is false |
isHidden | no Default value is false |
type | yes |
typeParam | only when type value is enum or enumlist |
descriptions | no |
value | only when type is integer , decimal , date or datetime |
units | no |
group | no |
Request
- application/json
Body
Array [
]
descriptions
object[]
Responses
- 201
- 400
Create product enum attribute - 201 / Create product text attribute - 201
Response Headers
Alt-Svc
string
Via
string
alt-svc
string
content-length
string
date
string
return-format
string
server
string
x-request-id
string
- application/json
- Schema
- Example (from schema)
- Create product enum attribute - 201
- Create product text attribute - 201
Schema
Array [
]
- MOD1
- MOD2
Array [
]
data
object
descriptions
object[]
value
object
anyOf
string
{
"data": {
"class": "product",
"descriptions": [
{
"language": "NL",
"value": "Kleur"
},
{
"language": "EN",
"value": "Color"
}
],
"group": "",
"id": 668,
"isHidden": false,
"isPublic": true,
"isSearchable": false,
"isSystem": false,
"name": "COLOR",
"type": "enum",
"typeParam": "COLORS",
"value": ""
},
"messages": [
"Attribute created"
],
"total": 1
}
{
"data": {
"class": "product",
"descriptions": [
{
"language": "NL",
"value": "Kleur"
},
{
"language": "EN",
"value": "Color"
}
],
"group": "",
"id": 668,
"isHidden": false,
"isPublic": true,
"isSearchable": false,
"isSystem": false,
"name": "COLOR",
"type": "enum",
"typeParam": "COLORS",
"value": ""
},
"messages": [
"Attribute created"
],
"total": 1
}
{
"data": {
"class": "product",
"descriptions": [
{
"language": "NL",
"value": "Framemateriaal"
},
{
"language": "EN",
"value": "Frame material"
}
],
"group": "",
"id": 669,
"isHidden": false,
"isPublic": true,
"isSearchable": false,
"isSystem": false,
"name": "MATERIAAL_FRAME",
"type": "text",
"typeParam": "",
"value": [
{
"language": "NL",
"value": ""
},
{
"language": "EN",
"value": ""
}
]
},
"messages": [
"Attribute created"
],
"total": 1
}
Create product text attribute - 400 (invalid value) / Create product enum attribute - 400 (duplicate name)
Response Headers
Alt-Svc
string
Via
string
alt-svc
string
content-length
string
date
string
return-format
string
server
string
x-request-id
string
- application/json
- Schema
- Example (from schema)
- Create product enum attribute - 400 (duplicate name)
- Create product text attribute - 400 (invalid value)
Schema
error
object
{
"error": {
"code": 10007,
"messages": [
"#/type: text is not a valid enum value",
"#/value: expected type: JSONArray, found: String",
"#/type: text is not a valid enum value",
"#/value: expected type: Integer, found: String",
"#/type: text is not a valid enum value",
"#/value: expected type: Number, found: String",
"#/type: text is not a valid enum value",
"#/value: string [] does not match pattern [12]\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$",
"#/type: text is not a valid enum value",
"#/value: string [] does not match pattern ([12]\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])T(0[1-9]|1[\\d]|2[0-3]):(0[\\d]|[1-5][\\d]):(0[\\d]|[1-5][\\d]))$"
],
"moreInfo": "https://www.propel.us/docs/errors/10007",
"status": 400,
"type": "SchemaValidationException"
}
}
{
"error": {
"code": 14003,
"messages": [
"Attribute with name [COLOR] already exists."
],
"moreInfo": "https://www.propel.us/docs/errors/14003",
"status": 400,
"type": "AttributeExists"
}
}
{
"error": {
"code": 10007,
"messages": [
"#/type: text is not a valid enum value",
"#/value: expected type: JSONArray, found: String",
"#/type: text is not a valid enum value",
"#/value: expected type: Integer, found: String",
"#/type: text is not a valid enum value",
"#/value: expected type: Number, found: String",
"#/type: text is not a valid enum value",
"#/value: string [] does not match pattern [12]\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$",
"#/type: text is not a valid enum value",
"#/value: string [] does not match pattern ([12]\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])T(0[1-9]|1[\\d]|2[0-3]):(0[\\d]|[1-5][\\d]):(0[\\d]|[1-5][\\d]))$"
],
"moreInfo": "https://www.propel.us/docs/errors/10007",
"status": 400,
"type": "SchemaValidationException"
}
}