Create and update Keywords XML format

The endpoint should be the following:

  • method: POST

  • path: /common/keywords/persist

Request

  • The request should be in OMN XML format;

Usecase

Request body

Create a root Keyword

<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
    <kwds>
        <kwd>
            <name>
                <itm>rootKeyword</itm>
                <itm loc="en_GB">rootKeyword-en</itm>
                <itm loc="de_DE">rootKeyword-de</itm>
            </name>
        </kwd>
    </kwds>
</pim>
<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
    <kwds>
        <kwd parentPath="/">
            <name>
                <itm>rootKeyword</itm>
                <itm loc="en_GB">rootKeyword-en</itm>
                <itm loc="de_DE">rootKeyword-de</itm>
            </name>
        </kwd>
    </kwds>
</pim>

Create a sub Keyword

<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
    <kwds>
        <kwd parentPath="/rootKeyword">
            <name>
                <itm>keyword1</itm>
                <itm loc="en_GB">keyword1-en</itm>
                <itm loc="de_DE">keyword1-de</itm>
            </name>
        </kwd>
    </kwds>
</pim>
<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
    <kwds>
        <kwd parentId="12345">
            <name>
                <itm>keyword1</itm>
                <itm loc="en_GB">keyword1-en</itm>
                <itm loc="de_DE">keyword1-de</itm>
            </name>
        </kwd>
    </kwds>
</pim>

Update a Keyword

<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
    <kwds>
        <kwd id="12345">
            <name>
                <itm>keyword1</itm>
                <itm loc="en_GB">keyword1-en</itm>
                <itm loc="de_DE">keyword1-de</itm>
            </name>
        </kwd>
    </kwds>
</pim>
<?xml version="1.0" encoding="UTF-8"?>
<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
    <kwds>
        <kwd path="/kwd1/kwd11">
            <name>
                <itm>kwd11</itm>
                <itm loc="en_GB">new-name-en</itm>
                <itm loc="de_DE">new-name-de</itm>
            </name>
        </kwd>
    </kwds>
</pim>

Response

  • It should be in OMN XML format;

  • It should contain "responses" tag. You can check it here: OMN XML: General.

Usecase

Response body

Success creation in parent

<?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-07-06T11:39:54.776Z</itm>
        <itm key="sourceEnv">web</itm>
    </meta>
    <responses>
        <response dataType="keyword" id="52730" action="create" path="/Root/user-">
            <status>SUCCESS</status>
            <description>The keyword has been created successfully</description>
        </response>
    </responses>
</pim>

Success creation in root

<?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-07-06T11:42:19.832Z</itm>
        <itm key="sourceEnv">web</itm>
    </meta>
    <responses>
        <response dataType="keyword" id="52731" action="create" path="/root2">
            <status>SUCCESS</status>
            <description>The keyword has been created successfully</description>
        </response>
    </responses>
</pim>

Success update

<?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-14T14:34:40.177Z</itm>
        <itm key="sourceEnv">web</itm>
    </meta>
    <responses>
        <response dataType="keyword" id="12345" path="/rootKeyword/keyword1" action="update">
            <status>SUCCESS</status>
            <description>The keyword has been saved successfully</description>
        </response>
    </responses>
</pim>

Error: no keyword by 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-07-06T11:45:41.247Z</itm>
        <itm key="sourceEnv">web</itm>
    </meta>
    <responses>
        <response dataType="keyword" id="111" action="update">
            <status>ERROR</status>
            <description>Entity class com.meylemueller.obj.isy.KeywordEntity with identity=111 not found</description>
        </response>
    </responses>
</pim>

Error: no keyword by path

<?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-07-06T11:49:25.214Z</itm>
        <itm key="sourceEnv">web</itm>
    </meta>
    <responses>
        <response dataType="keyword" action="update" path="/111">
            <status>ERROR</status>
            <description>No keyword by path '/111'</description>
        </response>
    </responses>
</pim>

Error: keyword is not available for update

<?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-07-06T11:50:01.107Z</itm>
        <itm key="sourceEnv">web</itm>
    </meta>
    <responses>
        <response dataType="keyword" id="39400" action="update" path="/Root">
            <status>ERROR</status>
            <description>The keyword is not available by access rights</description>
        </response>
    </responses>
</pim>

Error: parent keyword is not available

<?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-07-06T11:50:27.170Z</itm>
        <itm key="sourceEnv">web</itm>
    </meta>
    <responses>
        <response dataType="keyword" action="create" path="/Root">
            <status>ERROR</status>
            <description>Parent keyword is not available by access rights</description>
        </response>
    </responses>
</pim>

Error: value is duplicated on the same level

<?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-07-06T11:51:21.269Z</itm>
        <itm key="sourceEnv">web</itm>
    </meta>
    <responses>
        <response dataType="keyword" action="create">
            <status>ERROR</status>
            <description>Keyword value 'child2-1' for language 'de_DE' is duplicated. Unique keyword values under one parent should be provided</description>
        </response>
    </responses>
</pim>
HTTP response codes
200 - Persist successful
401 - Not authorized
404 - Not found
400 - Invalid input
500 - Internal server error

Welcome to the AI Chat!

Write a prompt to get started...