Model Classification Attributes by Meta API
Create a Product Integration Object with classification attributes using the Meta API.
In addition to configuring Integration Objects with classification attributes using ImpEx, you can also use the Meta API. See Configuring an Integration Object with Classification Attributes for more information about configuring using ImpEx.
As the following example shows, you can add classification attributes to the payload in the same way as you add regular attributes. The example requires ClassificationSystem and ClassificationSystemVersion to exist.
Use the following ImpEx to configure the prerequisite ClassificationSystem and ClassificationSystemVersion.
$SYSTEM = Electronics
$VERSION = Demo
$CLASSIFICATION_CLASS = 3D
$SYSTEM_VERSION = $SYSTEM:$VERSION
INSERT_UPDATE ClassificationSystem; id[unique = true]
; $SYSTEM
INSERT_UPDATE ClassificationSystemVersion; catalog(id)[unique = true]; version[unique = true]
; $SYSTEM ; $VERSION
$catalogVersionHeader = catalogVersion(catalog(id), version)
INSERT_UPDATE ClassificationClass; code[unique = true]; $catalogVersionHeader[unique = true]
; $CLASSIFICATION_CLASS ; $SYSTEM_VERSION
$systemVersionHeader = systemVersion(catalog(id), version)
INSERT_UPDATE ClassificationAttributeUnit; $systemVersionHeader[unique = true]; code[unique = true]; symbol; unitType
; $SYSTEM_VERSION ; centimeters ; cm ; measurement
INSERT_UPDATE ClassificationAttribute; code[unique = true]; $systemVersionHeader[unique = true]; name;
; status ; $SYSTEM_VERSION
; relatedProduct ; $SYSTEM_VERSION
; inStock ; $SYSTEM_VERSION
; availableSince ; $SYSTEM_VERSION
; name ; $SYSTEM_VERSION
; height ; $SYSTEM_VERSION ; tallness
; width ; $SYSTEM_VERSION
; depth ; $SYSTEM_VERSION
; brand ; $SYSTEM_VERSION
; model ; $SYSTEM_VERSION
$class = classificationClass($catalogVersionHeader, code)
$attribute = classificationAttribute($systemVersionHeader, code)
INSERT_UPDATE ClassAttributeAssignment; $class[unique = true]; $attribute[unique = true] ; unit($systemVersionHeader, code); attributeType(code); mandatory[default = false]; referenceType(code)[unique = true];
; $SYSTEM_VERSION:$CLASSIFICATION_CLASS ; $SYSTEM_VERSION:status ; ; enum
; $SYSTEM_VERSION:$CLASSIFICATION_CLASS ; $SYSTEM_VERSION:relatedProduct ; ; reference ; ; Product
; $SYSTEM_VERSION:$CLASSIFICATION_CLASS ; $SYSTEM_VERSION:availableSince ; ; date
; $SYSTEM_VERSION:$CLASSIFICATION_CLASS ; $SYSTEM_VERSION:inStock ; ; boolean ; true
; $SYSTEM_VERSION:$CLASSIFICATION_CLASS ; $SYSTEM_VERSION:name ; ; string ; true
; $SYSTEM_VERSION:$CLASSIFICATION_CLASS ; $SYSTEM_VERSION:height ; $SYSTEM_VERSION:centimeters ; number
; $SYSTEM_VERSION:$CLASSIFICATION_CLASS ; $SYSTEM_VERSION:width ; $SYSTEM_VERSION:centimeters ; number
; $SYSTEM_VERSION:$CLASSIFICATION_CLASS ; $SYSTEM_VERSION:depth ; $SYSTEM_VERSION:centimeters ; number
; $SYSTEM_VERSION:$CLASSIFICATION_CLASS ; $SYSTEM_VERSION:brand ; ; number ; true
; $SYSTEM_VERSION:$CLASSIFICATION_CLASS ; $SYSTEM_VERSION:model ; ; number ; true
After creating the ClassificationSystem and ClassificationSystemVersion, run the following POST request with the provided request body. You can then view the created Integration Object with a GET request to see that the classification attributes appear in the same way as nonclassification attributes.
Request URL
POST https://localhost:9002/odata2webservices/IntegrationService/IntegrationObjects
Request Body
{
"code": "3D-Product",
"integrationType": {
"code": "INBOUND"
},
"items": [
{
"code": "Product",
"root": true,
"type": { "code": "Product" },
"integrationObject": {
"code": "3D-Product"
},
"attributes": [
{
"integrationObjectItem": {
"code": "Product",
"type": {
"code": "Product"
},
"integrationObject": {
"code": "3D-Product"
}
},
"attributeDescriptor": {
"qualifier": "code",
"enclosingType": {
"code": "Product"
}
},
"unique": true,
"attributeName": "code"
},
{
"integrationObjectItem": {
"code": "Product",
"type": {
"code": "Product"
},
"integrationObject": {
"code": "3D-Product"
}
},
"attributeDescriptor": {
"qualifier": "name",
"enclosingType": {
"code": "Product"
}
},
"attributeName": "name"
},
{
"returnIntegrationObjectItem": {
"code": "CatalogVersion",
"type": {
"code": "CatalogVersion"
},
"integrationObject": {
"code": "3D-Product"
}
},
"integrationObjectItem": {
"code": "Product",
"type": {
"code": "Product"
},
"integrationObject": {
"code": "3D-Product"
}
},
"attributeDescriptor": {
"qualifier": "catalogVersion",
"enclosingType": {
"code": "Product"
}
},
"unique": true,
"attributeName": "catalogVersion"
}
],
"classificationAttributes": [
{
"classAttributeAssignment": {
"classificationAttribute": {
"code": "width",
"systemVersion": {
"catalog": {
"id": "Electronics"
},
"version": "Demo"
}
},
"classificationClass": {
"catalogVersion": {
"catalog": {
"id": "Electronics"
},
"version": "Demo"
},
"code": "3D"
}
},
"attributeName": "width",
"integrationObjectItem": {
"code": "Product",
"type": {
"code": "Product"
},
"integrationObject": {
"code": "3D-Product"
}
}
},
{
"classAttributeAssignment": {
"classificationAttribute": {
"code": "height",
"systemVersion": {
"catalog": {
"id": "Electronics"
},
"version": "Demo"
}
},
"classificationClass": {
"catalogVersion": {
"catalog": {
"id": "Electronics"
},
"version": "Demo"
},
"code": "3D"
}
},
"attributeName": "height",
"integrationObjectItem": {
"code": "Product",
"type": {
"code": "Product"
},
"integrationObject": {
"code": "3D-Product"
}
}
},
{
"classAttributeAssignment": {
"classificationAttribute": {
"code": "depth",
"systemVersion": {
"catalog": {
"id": "Electronics"
},
"version": "Demo"
}
},
"classificationClass": {
"catalogVersion": {
"catalog": {
"id": "Electronics"
},
"version": "Demo"
},
"code": "3D"
}
},
"attributeName": "depth",
"integrationObjectItem": {
"code": "Product",
"type": {
"code": "Product"
},
"integrationObject": {
"code": "3D-Product"
}
}
}
]
},
{
"code": "Catalog",
"type": {
"code": "Catalog"
},
"integrationObject": {
"code": "3D-Product"
},
"attributes": [
{
"integrationObjectItem": {
"code": "Catalog",
"type": {
"code": "Catalog"
},
"integrationObject": {
"code": "3D-Product"
}
},
"attributeDescriptor": {
"qualifier": "id",
"enclosingType": {
"code": "Catalog"
}
},
"unique": true,
"attributeName": "id"
}
]
},
{
"code": "CatalogVersion",
"type": {
"code": "CatalogVersion"
},
"integrationObject": {
"code": "3D-Product"
},
"attributes": [
{
"returnIntegrationObjectItem": {
"code": "Catalog",
"type": {
"code": "Catalog"
},
"integrationObject": {
"code": "3D-Product"
}
},
"integrationObjectItem": {
"code": "CatalogVersion",
"type": {
"code": "CatalogVersion"
},
"integrationObject": {
"code": "3D-Product"
}
},
"attributeDescriptor": {
"qualifier": "catalog",
"enclosingType": {
"code": "CatalogVersion"
}
},
"unique": true,
"attributeName": "catalog"
},
{
"integrationObjectItem": {
"code": "CatalogVersion",
"type": {
"code": "CatalogVersion"
},
"integrationObject": {
"code": "3D-Product"
}
},
"attributeDescriptor": {
"qualifier": "version",
"enclosingType": {
"code": "CatalogVersion"
}
},
"unique": true,
"attributeName": "version"
}
]
}
]
}