Create a category attribute
POST /api/category_attribute/v1
creates a new categorization attribute in the specified category.
Request schema
Method | URL |
---|---|
POST | /api/category_attribute/v1 |
Request header
*indicates required parameters
Field | Value Type | Description |
---|---|---|
*Authorization |
String | Enter: Bearer access token. |
*Upc-Selected-Company |
Integer | Company’s ID. Use the value returned in the id field received in response to the following request: GET /api/auth/v1/companies . |
X-User-Id |
Text | Enter the email address of the user being impersonated. This value is required if you are using a two-legged token. If you are using a three-legged token, then this field is not required. |
Request body
Field | Value Type | Description |
---|---|---|
*categoryId |
Integer | ID of the category in which to create a new attribute. |
*name |
String | Name of the category attribute to be created. |
*valueType |
String | Type of the categorization attribute. Allowed inputs are:
|
listOfvalue |
Array of item values | This field is only set if the value type of the attribute is LOV . It takes an array of possible string values for the drop-down list. |
Sample request body
For all category attribute types except LOV:
{
"categoryId": 1271,
"name": "Fill weight",
"valueType": "INTEGER"
}
For the LOV category attribute type:
{
"categoryId": 1271,
"name": "Liner Material",
"valueType": "LOV",
"listOfValue": [
{
"itemValue": "100% Brushed Poly Flannel"
},
{
"itemValue": "70D Poly Taffeta"
}
]
}
Response schema
Response body
201 response
Field | Value Type | Description |
---|---|---|
id |
Integer | Created category attribute ID. |
categoryId |
Integer | The ID of the category that the attribute belongs to. |
name |
String | Created category attribute name. |
valueType |
String | The value type of the created category attribute. |
listOfValue |
Array of item values | Contains the list of item values created for a drop-down list if the value type is LOV . Otherwise this returns null. Item values have the following parameters:
|
Sample response body
For all category attribute types except LOV:
{
"id": 9524,
"categoryId": 1271,
"name": "Fill weight",
"valueType": "INTEGER",
"listOfValue": null
}
For the LOV category attribute type:
{
"id": 9525,
"categoryId": 1271,
"name": "Liner Material",
"valueType": "LOV",
"listOfValue": [
{
"id": 3150,
"attributeId": 9525,
"itemIndex": 1,
"itemValue": "100% Brushed Poly Flannel"
},
{
"id": 3151,
"attributeId": 9525,
"itemIndex": 2,
"itemValue": "70D Poly Taffeta"
}
]
}