Collection Attributes
The handling of collection attributes in the Integration API varies based on whether required or optional attributes are included in the payload.
-
Accepts a new item with an empty collection as a value
-
Fails when sending a new item with null, or without a required attribute
-
Appends the sent values to the existing values
-
Accepts null and empty values without affecting existing values
-
Merges duplicate values
The following tables provide examples of how the API handles required and optional reference collection attributes and valueList attributes.
Required Reference Collection Attributes
The example scenarios assume that the multivalue countries attribute is mandatory, not autocreate, not nullable.
| POST Scenario | Value provided in payload | Example payload | Result | Response code |
|---|---|---|---|---|
| Create a Product with a null value for a required referenced collection | null |
{
"code": "test_article9a",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
},
"countries": null
}
|
Returns a missing navigation property error | 400 |
| Create a Product without a value for a required referenced collection | not provided |
{
"code": "test_article9b",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
}
}
|
Returns a missing navigation property error | 400 |
| Create a Product using an empty collection value for a required attribute | empty |
{
"code": "test_article9c",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
},
"countries": []
}
|
Persists an empty collection | 201 |
| Create a Product using a value that contains a nonexistent item for a required reference to a non-autocreate collection | provided with a nonexistent item |
{
"code": "test_article9d",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
},
"countries": [
{"isocode": "bldr"},
{"isocode": "fakeCountry"}{
"code": "test_article13a",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
},
]
}
|
Returns a missing navigation property error | 400 |
| Create a Product using a value that includes a collection of existing items for a required referenced collection | provided |
{
"code": "test_article9e",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
},
"countries": [
{"isocode": "bldr"},
{"isocode": "dnvr"}
]
}
|
Persists all collection items | 201 |
| Update a Product using a null value for a required referenced collection | null |
{
"code": "test_article9e",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
},
"countries": null
}
|
Keeps existing values because the request provides no new values | 201 |
| Update a Product without providing a value for a required referenced collection | not provided |
{
"code": "test_article9e",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
}
}
|
Keeps existing values because the request provides no new values | 201 |
| Update a Product using an empty collection for a required referenced collection | provided as an empty collection |
{
"code": "test_article9e",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
},
"countries": []
}
|
Keeps existing values because the request provides no new values | 201 |
| Update a Product using another existing item as the value for a required referenced collection | provided |
{
"code": "test_article9e",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
},
"countries": [
{"isocode": "lngmt"}
]
}
|
Item persists along with the existing attribute values | 201 |
Optional Reference Collection Attributes
The following examples illustrate the POST request behavior for Integration Objects with optional reference collection attributes. For the examples, the autocreateUnit reference type attribute is not mandatory or multivalue. The currencies reference type attribute is not mandatory but is multivalue. The optionalCountries attribute is a referenced attribute type.
| POST Scenario | Value provided in payload | Example payload | Result | Response code |
|---|---|---|---|---|
| Create a Product with a null value for an optional referenced collection |
null |
{
"code": "test_article13a",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
},
"optionalCountries": null
}
|
Creates the Product because the referenced collection is not required | 201 |
| Create a product without providing a value for an optional referenced collection | not provided |
{
"code": "test_article13b",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
}
}
|
Creates the Product because the referenced collection is not required | 201 |
| Create a Product with an empty collection for an optional referenced collection | provided with empty collection |
{
"code": "test_article13c",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
},
"optionalCountries": []
}
|
Creates the Product and persists the attribute with an empty collection | 201 |
| Create a Product using a nonexistent item in the values for an optional referenced, non-autocreate collection | provided with a nonexistent item |
{
"code": "test_article13d",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
},
"optionalCountries": [
{"isocode": "bldr"},
{"isocode": "fakeCountry"}
]
}
|
The API returns a missing navigation property error because it cannot persist a nonexistent collection item | 400 |
| Create Product using a collection of existing items as the values for an optional referenced collection | provided with collection of existing items |
{
"code": "test_article13e",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
},
"optionalCountries": [
{"isocode": "lngmt"}
]
}
|
Persists the Product with the attribute values | 201 |
Required ValueList Collection Attributes
The following scenarios assume the paymentMethod valueList attribute is mandatory and multivalue. Existing values for the valueList include newArrival and sale.
| POST Scenario | Value provided in payload | Example payload | Result | Response code |
|---|---|---|---|---|
| Create a Product with a null value for the required ValueList collection | null |
{
"code": "test_article11a",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
},
"tags": null
}
|
Cannot persist an Integration Object without providing a value for a required valueList. Returns a missing navigation property error. | 400 |
| Create Product without providing values for a required ValueList collection | not provided |
{
"code": "test_article11b",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
}
}
|
Returns a missing navigation property error | 400 |
| Create a Product with an empty collection for a required ValueList collection | provided as an empty collection |
{
"code": "test_article11c",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
},
"tags": []
}
|
Persists valueList with empty collection | 201 |
| Create a Product using existing values for a required valueList Collection | provided with existing valueList values |
{
"code": "test_article11d",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
},
"tags": [
{"value": "newArrival"},
{"value": "sale"}
]
}
|
Persists valueList with existing values | 201 |
| Update a Product using new values for a required valueList collection | provided with new values |
{
"code": "test_article11d",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
},
"tags": [
{"value": "bestSelling"}
]
}
|
Adds new value to existing values | 201 |
| Update a Product using an empty list for a required valueList collection | provided as empty list |
{
"code": "test_article11d",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
},
"tags": []
}
|
Existing values merge with the updated POST and because the request adds no new values, the collection keeps the original values | 201 |
| Update Product using a null value for a required valueList collection | null |
{
"code": "test_article11d",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
},
"tags": null
}
|
Existing values merge with the updated POST and because the request adds no new values, the collection keeps the original values | 201 |
| Update Product without providing values for a required valueList collection | not provided |
{
"code": "test_article11d",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
}
}
|
The request provides no new values, so the existing values remain | 201 |
| Create Product using nonexistent values for a required ValueList Collection | provided with nonexistent values |
{
"code": "test_article11e",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
},
"tags": [
{"value": "newArrival"},
{"value": "clearance"}
]
}
|
Adds the new value to the existing values | 201 |