Multivalue Attributes

In the Integration API, the persistence behavior for collections of optional and required multivalue primitive attributes depends on whether values are provided in the payload.

The following tables describe the persistence behavior for POST upsert scenarios.

Required Multivalue Primitive Attributes

In the following example scenarios, the colors attribute is required and multivalue.

POST Scenario Value provided in payload Example payload Result Response code
Create a Product with new values for a required, multivalue attribute provided
{
	"code": "test_article7a",
	"catalogVersion": {
		"catalog": {
			"id": "Default"
		},
		"version": "Staged"
	},
	"colors": [ 
		{"value": "black"}, 
		{"value": "white"}, 
		{"value": "blue"}
	]
}
Attribute persists with values 201
Update a Product using an empty collection for a required, multivalue attribute provided as an empty collection
{
	"code": "test_article7a",
	"catalogVersion": {
		"catalog": {
			"id": "Default"
		},
		"version": "Staged"
	},
	"colors": []
}
Existing values merge with the updated POST and since no new values are added, the collection keeps the original values 201
Update Product with a null value for a required, multivalue attribute null
{
	"code": "test_article7a",
	"catalogVersion": {
		"catalog": {
			"id": "Default"
		},
		"version": "Staged"
	},
	"colors": null
}
Existing values merge with the updated POST and since no new values are added, the collection keeps the original values 201
Update a Product without providing the required multivalue attribute or value not provided
{
	"code": "test_article7a",
	"catalogVersion": {
		"catalog": {
			"id": "Default"
		},
		"version": "Staged"
	}
}
Existing values merge with the updated POST and since no new values are added, the collection keeps the original values 201
Update a Product with new values for required multivalue attribute provided
{
	"code": "test_article7a",
	"catalogVersion": {
		"catalog": {
			"id": "Default"
		},
		"version": "Staged"
	},
	"colors": [ 
		{"value": "green"}, 
		{"value": "red"}
	]
}
New values merge with the existing values 201
Update a Product with duplicate values for a required multivalue attribute duplicate values provided

The following example includes two existing values, black and white, and one new value, pink:

{
	"code": "test_article7a",
	"catalogVersion": {
		"catalog": {
			"id": "Default"
		},
		"version": "Staged"
	},
	"colors": [ 
		{"value": "black"}, 
		{"value": "white"},
		{"value": "pink"}
	]
}
Merges the duplicate values with the original values and adds the new value 201
Create Product with an empty collection for a required multivalue attribute provided as empty collection
{
	"code": "test_article7b",
	"catalogVersion": {
		"catalog": {
			"id": "Default"
		},
		"version": "Staged"
	},
	"colors": []
}
attributes persist without values 201
Create a Product without providing a required, multivalue attribute not provided
{
	"code": "test_article7c",
	"catalogVersion": {
		"catalog": {
			"id": "Default"
		},
		"version": "Staged"
	}
}
Because the collection attribute is required and not provided, the API returns an error 400
Create a Product with a null value for a required multivalue attribute null
{
	"code": "test_article7d",
	"catalogVersion": {
		"catalog": {
			"id": "Default"
		},
		"version": "Staged"
	},
	"colors": null
}
Because null is not a valid value for a new, required collection attribute, the API returns an error 400

Optional Multivalue Primitive Attributes

The following examples assume the existence of the optional, multivalue sizesAvailable attribute.

POST Scenario Value provided in payload Example payload Result Response code
Create an Integration Object including values for an optional, multivalue primitive attribute provided
{
	"code": "test_article6a",
	"catalogVersion": {
		"catalog": {
			"id": "Default"
		},
		"version": "Staged"
	},
	"sizesAvailable":[
		{"value":28},
		{"value":30},
		{"value":32},
		{"value":34}
	]
}
Persists all provided values 201
Create a Product with an empty collection for an optional, multivalue primitive attribute provided as an empty collection
{
	"code": "test_article6b",
	"catalogVersion": {
		"catalog": {
			"id": "Default"
		},
		"version": "Staged"
	},
	"sizesAvailable":[]
}
Creates the Integration Object with empty values for the attribute 201
Create an Integration Object without a value for an optional, multivalue primitive attribute not provided
{
	"code": "test_article6c",
	"catalogVersion": {
		"catalog": {
			"id": "Default"
		},
		"version": "Staged"
	}
}
Creates the Integration Object with an empty value for the attribute 201
Create an Integration Object with a null value for an optional, multivalue primitive attribute null
{
	"code": "test_article6d",
	"catalogVersion": {
		"catalog": {
			"id": "Default"
		},
		"version": "Staged"
	},
	"sizesAvailable": null
}
Creates the Integration Object with an empty value for the attribute 201