Utilisation de REST avec des taxonomies

Vous pouvez utiliser le service REST de Web Content Manager pour créer, lire, mettre à jour et supprimer des taxinomies.

Créer

Vous pouvez créer une taxonomie en envoyant une demande POST à l'URI suivant avec une entrée Atom représentant l'objet :
/Taxonomy
Par exemple:

HTTP/1.1 POST /wps/mycontenthandler/wcmrest/Taxonomy
Content-Type: application/atom+xml

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="http://www.ibm.com/xmlns/wcm/8.0">
    <wcm:name>Marketing Taxonomy</wcm:name>
    <title>Marketing Taxonomy</title>
    <link rel="library" href="/wps/mycontenthandler/!ut/p/digest!muAe8T8GIzS4EJeiF9a_sw/wcmrest/Library/94a8214d-322c-4724-acc3-b6c217d1bc5f" label="Library"/>
</entry>

HTTP/1.1 201 Created
Content-Type: application/atom+xml

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="http://www.ibm.com/xmlns/wcm/8.0">
    <id>wcmrest:501a4ab8-48c3-41fc-b1fd-6dbe0acba1d4</id>
    <wcm:name>Marketing Taxonomy</wcm:name>
    <title>Marketing Taxonomy</title>
    <wcm:type>Taxonomy</wcm:type>
    <updated>2014-06-27T00:52:59.022Z</updated>
    <wcm:created>2014-06-27T00:52:59.022Z</wcm:created>
    <author>
        <wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/um/users/profiles/Z9eAe5JOE3O46N1P0JM06J9OCJMG64BC6MM472RCCJMK62JD66J57OHDC3OC6N1</uri>
        <name>wpsadmin</name>
    </author>
    <wcm:owner>
        <wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/um/users/profiles/Z9eAe5JOE3O46N1P0JM06J9OCJMG64BC6MM472RCCJMK62JD66J57OHDC3OC6N1</uri>
        <name>wpsadmin</name>
    </wcm:owner>
    <wcm:lastModifier>
        <wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/um/users/profiles/Z9eAe5JOE3O46N1P0JM06J9OCJMG64BC6MM472RCCJMK62JD66J57OHDC3OC6N1</uri>
        <name>wpsadmin</name>
    </wcm:lastModifier>
    <wcm:creator>
        <wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/um/users/profiles/Z9eAe5JOE3O46N1P0JM06J9OCJMG64BC6MM472RCCJMK62JD66J57OHDC3OC6N1</uri>
        <name>wpsadmin</name>
    </wcm:creator>
    <link rel="self" href="/wps/mycontenthandler/wcmrest/Taxonomy/501a4ab8-48c3-41fc-b1fd-6dbe0acba1d4" xml:lang="fr-fr" label="Read"/>
    <link rel="edit" href="/wps/mycontenthandler/wcmrest/Taxonomy/501a4ab8-48c3-41fc-b1fd-6dbe0acba1d4" xml:lang="fr-fr" label="Edit"/>
    <link rel="delete" href="/wps/mycontenthandler/wcmrest/Taxonomy/501a4ab8-48c3-41fc-b1fd-6dbe0acba1d4" xml:lang="fr-fr" label="Delete"/>
    <link rel="change-to-draft" href="/wps/mycontenthandler/wcmrest/item/501a4ab8-48c3-41fc-b1fd-6dbe0acba1d4/change-to-draft" xml:lang="fr-fr" label="Change To Draft"/>
    <link rel="create-draft" href="/wps/mycontenthandler/wcmrest/item/501a4ab8-48c3-41fc-b1fd-6dbe0acba1d4/create-draft" xml:lang="fr-fr" label="Create Draft"/>
    <link rel="access-control" href="/wps/mycontenthandler/ac/access:oid:Z6QReDeL1C2JGH61JOGJMG6OPO6JMG6HHP6MM8CHHP8MMO64JOA6O4C3JO2MOGCK1" xml:lang="fr-fr" label="Access Control"/>
    <link rel="library" href="/wps/mycontenthandler/wcmrest/Library/94a8214d-322c-4724-acc3-b6c217d1bc5f" xml:lang="fr-fr" label="Library"/>
    <link rel="versions" href="/wps/mycontenthandler/wcmrest/item/501a4ab8-48c3-41fc-b1fd-6dbe0acba1d4/versions" xml:lang="fr-fr" label="Versions"/>
    <category scheme="wcmrest:workflowState" term="PUBLISHED" label="Published" xml:lang="fr-fr"/>
    <category scheme="wcmrest:favorite" term="false" xml:lang="fr-fr"/>
</entry>

Mettre à jour

Vous pouvez mettre à jour une taxonomie en envoyant une demande PUT à l'URI suivant :
/Taxonomy/taxonomy-id
Par exemple:

HTTP/1.1 PUT /wps/mycontenthandler/wcmrest/Taxonomy/501a4ab8-48c3-41fc-b1fd-6dbe0acba1d4
Content-Type: application/atom+xml

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="http://www.ibm.com/xmlns/wcm/8.0">
    <wcm:name>Marketing Taxonomy Has Been Changed</wcm:name>
    ... some content elided ...
</entry>

HTTP/1.1 200 OK

Lire

Vous pouvez lire une taxonomie en envoyant une demande GET à l'URI suivant :
/Taxonomy/taxonomy-id
Par exemple:

HTTP/1.1 GET /wps/mycontenthandler/wcmrest/Taxonomy/501a4ab8-48c3-41fc-b1fd-6dbe0acba1d4
Accept: application/atom+xml

HTTP/1.1 200 OK

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="http://www.ibm.com/xmlns/wcm/8.0">
    <id>wcmrest:501a4ab8-48c3-41fc-b1fd-6dbe0acba1d4</id>
    <wcm:name>Marketing Taxonomy</wcm:name>
    <title>Marketing Taxonomy</title>
    <wcm:type>Taxonomy</wcm:type>
    <updated>2014-06-27T00:52:59.022Z</updated>
    <wcm:created>2014-06-27T00:52:59.022Z</wcm:created>
    <author>
        <wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/um/users/profiles/Z9eAe5JOE3O46N1P0JM06J9OCJMG64BC6MM472RCCJMK62JD66J57OHDC3OC6N1</uri>
        <name>wpsadmin</name>
    </author>
    <wcm:owner>
        <wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/um/users/profiles/Z9eAe5JOE3O46N1P0JM06J9OCJMG64BC6MM472RCCJMK62JD66J57OHDC3OC6N1</uri>
        <name>wpsadmin</name>
    </wcm:owner>
    <wcm:lastModifier>
        <wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/um/users/profiles/Z9eAe5JOE3O46N1P0JM06J9OCJMG64BC6MM472RCCJMK62JD66J57OHDC3OC6N1</uri>
        <name>wpsadmin</name>
    </wcm:lastModifier>
    <wcm:creator>
        <wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/um/users/profiles/Z9eAe5JOE3O46N1P0JM06J9OCJMG64BC6MM472RCCJMK62JD66J57OHDC3OC6N1</uri>
        <name>wpsadmin</name>
    </wcm:creator>
    <link rel="self" href="/wps/mycontenthandler/wcmrest/Taxonomy/501a4ab8-48c3-41fc-b1fd-6dbe0acba1d4" xml:lang="fr-fr" label="Read"/>
    <link rel="edit" href="/wps/mycontenthandler/wcmrest/Taxonomy/501a4ab8-48c3-41fc-b1fd-6dbe0acba1d4" xml:lang="fr-fr" label="Edit"/>
    <link rel="delete" href="/wps/mycontenthandler/wcmrest/Taxonomy/501a4ab8-48c3-41fc-b1fd-6dbe0acba1d4" xml:lang="fr-fr" label="Delete"/>
    <link rel="change-to-draft" href="/wps/mycontenthandler/wcmrest/item/501a4ab8-48c3-41fc-b1fd-6dbe0acba1d4/change-to-draft" xml:lang="fr-fr" label="Change To Draft"/>
    <link rel="create-draft" href="/wps/mycontenthandler/wcmrest/item/501a4ab8-48c3-41fc-b1fd-6dbe0acba1d4/create-draft" xml:lang="fr-fr" label="Create Draft"/>
    <link rel="access-control" href="/wps/mycontenthandler/ac/access:oid:Z6QReDeL1C2JGH61JOGJMG6OPO6JMG6HHP6MM8CHHP8MMO64JOA6O4C3JO2MOGCK1" xml:lang="fr-fr" label="Access Control"/>
    <link rel="library" href="/wps/mycontenthandler/wcmrest/Library/94a8214d-322c-4724-acc3-b6c217d1bc5f" xml:lang="fr-fr" label="Library"/>
    <link rel="versions" href="/wps/mycontenthandler/wcmrest/item/501a4ab8-48c3-41fc-b1fd-6dbe0acba1d4/versions" xml:lang="fr-fr" label="Versions"/>
    <category scheme="wcmrest:workflowState" term="PUBLISHED" label="Published" xml:lang="fr-fr"/>
    <category scheme="wcmrest:favorite" term="false" xml:lang="fr-fr"/>
</entry>

Supprimer

Vous pouvez supprimer une taxonomie en envoyant une demande DELETE à l'URI suivant :
/Taxonomy/taxonomy-id
Dans cet exemple, vous pouvez remplacer le type PublishAction par ExpireAction ou VersionAction lorsque vous utilisez ces types d'action de flux de travaux.
HTTP/1.1 DELETE /wps/mycontenthandler/wcmrest/Taxonomy/7b40f5b6-bf52-4b9e-8062-b0755aaf1f80

HTTP/1.1 200 OK