Persist attribute definitions
| /pim/attribute-definitions/persist Creates or updates attribute definitions. |
Allow to
-
Create an attribute definition
-
Update the attribute definition
Resource path |
/api/core/v1/pim/attribute-definitions/persist |
HTTP method |
POST |
Request content type |
|
Response content type |
|
Body parameters
Accepts PimType with filled AttributeDefinitionsType.
| Code | Message | Datatype |
|---|---|---|
200 |
PimType with filled ResponsesType |
|
400 |
Invalid input provided |
|
401 |
Not authorized |
|
404 |
Not found |
|
500 |
An unknown internal error occurred |
Samples
| Please use transform endpoint to get the JSON/compact-JSON samples from the XML one. |
1. Create an attribute definition
curl
curl --location 'http://<OMN_SERVER>/api/core/v1/pim/attribute-definitions/persist' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/xml' \
--data '<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
<attrDefs>
<attrDef tid="product_tid" type="text">
<name>
<itm loc="en_GB">SKU product</itm>
<itm loc="de_DE">SKU Produkt</itm>
</name>
</attrDef>
</attrDefs>
</pim>'
Request body
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
<attrDefs>
<attrDef tid="product_tid" type="text">
<name>
<itm loc="en_GB">SKU product</itm>
<itm loc="de_DE">SKU Produkt</itm>
</name>
</attrDef>
</attrDefs>
</pim>
Response body
<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
<meta>
<itm key="messageType">request</itm>
<itm key="messageTime">2023-02-14T08:39:54.996Z</itm>
<itm key="sourceEnv">web</itm>
</meta>
<responses>
<response action="create" dataType="attrDefinition" tid="product_tid">
<description>The attribute definition has been saved successfully</description>
<status>SUCCESS</status>
</response>
</responses>
</pim>
2. Update the attribute definition
curl
curl --location 'http://<OMN_SERVER>/api/core/v1/pim/attribute-definitions/persist' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/xml' \
--data '<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
<attrDefs>
<attrDef tid="product_tid" type="text">
<name>
<itm loc="en_GB">New value</itm>
<itm loc="de_DE">New value</itm>
</name>
</attrDef>
</attrDefs>
</pim>'
Request body
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
<attrDefs>
<attrDef tid="product_tid" type="text">
<name>
<itm loc="en_GB">New value</itm>
<itm loc="de_DE">New value</itm>
</name>
</attrDef>
</attrDefs>
</pim>
Response body
<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
<meta>
<itm key="messageType">request</itm>
<itm key="messageTime">2023-02-14T08:39:54.996Z</itm>
<itm key="sourceEnv">web</itm>
<itm key="itemInformationType">attrDefinition</itm>
</meta>
<responses>
<response action="update" dataType="attrDefinition" tid="product_tid">
<description>The attribute definition has been saved successfully</description>
<status>SUCCESS</status>
</response>
</responses>
</pim>
Error response examples
The attribute definition could not be saved
<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
<meta>
<itm key="messageType">request</itm>
<itm key="messageTime">2022-06-04T13:38:16.444Z</itm>
<itm key="sourceEnv">web</itm>
<itm key="itemInformationType">attrDefinition</itm>
</meta>
<responses>
<response dataType="attrDefinition"
id="12345"
tid="attrDefinitionIdentifier"
action="update">
<status>ERROR</status>
<description>The attribute definition could not be saved. Reason: {errormessage}</description>
</response>
</responses>
</pim>
The attribute definition not found
<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
<meta>
<itm key="messageType">request</itm>
<itm key="messageTime">2022-06-04T13:38:16.444Z</itm>
<itm key="sourceEnv">web</itm>
<itm key="itemInformationType">attrDefinition</itm>
</meta>
<responses>
<response dataType="attrDefinition"
id="54321"
action="update">
<status>ERROR</status>
<description>No attribute definition by id: 54321</description>
</response>
</responses>
</pim>