Persist attributes
| /pim/attributes/persist Saves node attributes information. |
Allow to
-
Create the attribute
-
Update attribute values (AttributeType.vals)
Resource path |
/api/core/v1/pim/attributes/persist |
HTTP method |
POST |
Request content type |
|
Response content type |
|
Body parameters
Accepts PimType with AttributesType
| When creating attribute nodePath or nodeId parameters must be specified. |
When updating attributes one of parameters combination below must be used:
-
attribute id
-
nodeId and attribute key
-
nodePath and attribute key
| Attribute parameter key is attribute definition value. |
Return Type
PimType with statuses ResponsesType about each persisted attribute.
Responses
| 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
1.Create attribute by node id
curl
curl --location --request POST 'http://<OMN_SERVER>/api/core/v1/pim/attributes/persist' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/xml' \
--data-raw '<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
<attrs>
<attr nodeId="23456"
key="gender"
level="p"
inheritance="visible"
restriction="optional"
localized="true">
<domainVals allowNewValue="false" sortDirection="MANUAL">
<domainVal tid="female">
<itm loc="en_EN">female</itm>
<itm loc="de_DE">weiblich</itm>
</domainVal>
</domainVals>
</attr>
</attrs>
</pim>'
Request body
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
<attrs>
<attr nodeId="23456"
key="gender"
level="p"
inheritance="visible"
restriction="optional"
localized="true">
<domainVals allowNewValue="false" sortDirection="MANUAL">
<domainVal tid="female">
<itm loc="en_EN">female</itm>
<itm loc="de_DE">weiblich</itm>
</domainVal>
</domainVals>
</attr>
</attrs>
</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">2022-09-27T12:41:38.795Z</itm>
<itm key="sourceEnv">web</itm>
<itm key="itemInformationType">attribute</itm>
</meta>
<responses>
<response dataType="attribute" action="create" id="95547" nodeId="23456">
<status>SUCCESS</status>
<description>The attribute has been created successfully</description>
</response>
</responses>
</pim>
2.Create attribute by node path
curl
curl --location --request POST 'http://<OMN_SERVER>/api/core/v1/pim/attributes/persist' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/xml' \
--data-raw '<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
<attrs>
<attr nodePath="/RootNode/someNode"
inheritance="visible"
key="product_id"
level="p"
localized="false"
restriction="optional"/>
</attrs>
</pim>'
Request body
<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
<attrs>
<attr nodePath="/RootNode/someNode"
inheritance="visible"
key="product_id"
level="p"
localized="false"
restriction="optional"/>
</attrs>
</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">2022-09-27T12:41:38.795Z</itm>
<itm key="sourceEnv">web</itm>
<itm key="itemInformationType">attribute</itm>
</meta>
<responses>
<response dataType="attribute" action="create" id="95547" nodePath="/RootNode/someNode">
<status>SUCCESS</status>
<description>The attribute has been created successfully</description>
</response>
</responses>
</pim>
3.Update attribute by attribute id
curl
curl --location --request POST 'http://<OMN_SERVER>/api/core/v1/pim/attributes/persist' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/xml' \
--data-raw '<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
<attrs>
<attr id="95547"
inheritance="visible"
key="product_id"
level="p"
localized="false"
restriction="optional"/>
</attrs>
</pim>'
Request body
<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
<attrs>
<attr id="95547"
inheritance="visible"
key="product_id"
level="p"
localized="false"
restriction="optional"/>
</attrs>
</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">2022-09-27T12:41:38.795Z</itm>
<itm key="sourceEnv">web</itm>
<itm key="itemInformationType">attribute</itm>
</meta>
<responses>
<response dataType="attribute" action="update" id="95547">
<status>SUCCESS</status>
<description>The attribute has been saved successfully</description>
</response>
</responses>
</pim>
4.Update attribute by nodePath and attribute key
curl
curl --location --request POST 'http://<OMN_SERVER>/api/core/v1/pim/attributes/persist' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/xml' \
--data-raw '<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
<attrs>
<attr nodePath="/RootNode/someNode"
inheritance="visible"
key="product_id"
level="p"
localized="false"
restriction="optional"/>
</attrs>
</pim>'
Request body
<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
<attrs>
<attr nodePath="/RootNode/someNode"
inheritance="visible"
key="product_id"
level="p"
localized="false"
restriction="optional"/>
</attrs>
</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">2022-09-27T12:41:38.795Z</itm>
<itm key="sourceEnv">web</itm>
<itm key="itemInformationType">attribute</itm>
</meta>
<responses>
<response dataType="attribute" action="update" nodePath="/RootNode/someNode" key="product_id">
<status>SUCCESS</status>
<description>The attribute has been saved successfully</description>
</response>
</responses>
</pim>
5.Update attribute by nodeId and attribute key
curl
curl --location --request POST 'http://<OMN_SERVER>/api/core/v1/pim/attributes/persist' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/xml' \
--data-raw '<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
<attrs>
<attr nodeId="65425"
inheritance="visible"
key="product_id"
level="p"
localized="false"
restriction="optional"/>
</attrs>
</pim>'
Request body
<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
<attrs>
<attr nodeId="65425"
inheritance="visible"
key="product_id"
level="p"
localized="false"
restriction="optional"/>
</attrs>
</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">2022-09-27T12:41:38.795Z</itm>
<itm key="sourceEnv">web</itm>
<itm key="itemInformationType">attribute</itm>
</meta>
<responses>
<response dataType="attribute" action="update" nodeId="65425" key="product_id">
<status>SUCCESS</status>
<description>The attribute has been saved successfully</description>
</response>
</responses>
</pim>
Error responses
Attribute not found by attribute id
<?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-12-27T08:49:34.889Z</itm>
<itm key="sourceEnv">web</itm>
<itm key="itemInformationType">attribute</itm>
</meta>
<responses>
<response action="update" dataType="attribute" key="product_id">
<status>ERROR</status>
<description>Attribute with id 23456 was not found.</description>
</response>
</responses>
</pim>
Node not found by node id
<?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-12-27T08:52:40.287Z</itm>
<itm key="sourceEnv">web</itm>
<itm key="itemInformationType">attribute</itm>
</meta>
<responses>
<response action="create"
dataType="attribute"
key="product_id"
nodeId="23456">
<status>ERROR</status>
<description>Node with id 23456 not found</description>
</response>
</responses>
</pim>
Node not found by nodePath
<?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-12-27T08:53:36.908Z</itm>
<itm key="sourceEnv">web</itm>
<itm key="itemInformationType">attribute</itm>
</meta>
<responses>
<response action="create"
dataType="attribute"
key="product_id"
nodePath="RootNode/someNode">
<status>ERROR</status>
<description>Node with path RootNode/someNode not found</description>
</response>
</responses>
</pim>
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-12-27T08:55:28.589Z</itm>
<itm key="sourceEnv">web</itm>
<itm key="itemInformationType">attribute</itm>
</meta>
<responses>
<response action="create"
dataType="attribute"
key="not_exists"
nodePath="RootNode/someNod">
<status>ERROR</status>
<description>Attribute definition: 'not_exists' cannot be found</description>
</response>
</responses>
</pim>