Step: 5 Import Composite Data
Composites model complex, repeating groups of attributes. These are allowed to nest 1..many levels deep.
Prerequisite: Create the Attribute Definitions
Unlike flat attributes, composites must be defined in the PDX datastandard before you can import product data into them. Use the following endpoint to create both the child attributes and the parent composite container.
PUT /api/datastandards/v1/datastandards/attributes
Example Composite Attribution Creation Payload:
[
{
"id": "AllergenInformation",
"name": "Allergen Information",
"compositeAttribute": null,
"type": {
"id": "composite",
"multiValue": true
}
},
{
"id": "AllergenType",
"name": "Allergen Type",
"compositeAttribute": "AllergenInformation",
"type": {
"id": "string",
"multiValue": false
}
},
{
"id": "Containment",
"name": "Containment",
"compositeAttribute": "AllergenInformation",
"type": {
"id": "string",
"multiValue": false
}
},
{
"id": "Agency",
"name": "Agency",
"compositeAttribute": "AllergenInformation",
"type": {
"id": "string",
"multiValue": false
}
}
]Note that the parent composite needs to be set to
multiValue=trueto allow for multiple rows.
After the composite and composite attribution has been created, you can begin loading the composite data within the existing product import feed:
Example Composite Payload:
{
"products": [
{
"__ID": "WIDGET-100",
"AllergenInformation": [
{
"AllergenType": "Peanuts",
"Containment": "Does Not Contain",
"Agency": "USDA"
},
{
"AllergenType": "Dairy",
"Containment": "May Contain",
"Agency": "EFSA"
}
]
}
]
}Updated about 1 month ago
Did this page help you?
