Utilisation de REST avec des modèles de contenu

Vous pouvez utiliser le service REST de Web Content Manager pour créer, lire, mettre à jour et supprimer des modèles de contenu. Vous pouvez également définir des valeurs par défaut pour les objets qui sont créés à l'aide de ces modèles de contenu.

Créer

Vous pouvez créer un modèle de contenu en envoyant une demande POST à l'URI suivant avec une entrée Atom représentant le modèle de contenu :
/ContentTemplate
Par exemple:

POST /wps/mycontenthandler/wcmrest/ContentTemplate
Content-Type : application/atom+xml

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="http://www.ibm.com/xmlns/wcm/8.0">
    <title>SampleContentTemplateTitle</title>
    <wcm:name>SampleContentTemplateName</wcm:name>
    <summary xml:lang="fr-fr">SampleContentTemplateDescription</summary>
    <link rel="library" href="/wps/mycontenthandler/wcmrest/Library/91d0b849-7e9b-4053-a267-d4b84be29062" label="Library"/>
</entry>

HTTP/1.0 201 Created
Content-type: application/atom+xml; type=entry
Content-location: /wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/e15bb37f-6eba-42f4-8470-e54431b69fb3

<?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:d19db2ce-87dc-484f-937a-203139818fbd</id>
    <title xml:lang="fr-fr">SampleContentTemplateTitle</title>
    <summary xml:lang="fr-fr">SampleContentTemplateDescription</summary>
    <wcm:name>SampleContentTemplateName</wcm:name>
    <wcm:type>ContentTemplate</wcm:type>
    <updated>2015-03-19T04:02:33.655Z</updated>
    <wcm:created>2015-03-19T04:02:33.655Z</wcm:created>
    <author>
        <wcm:distinguishedName>uid=wpsadmin,cn=users,dc=test</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/!ut/um/users/profiles/Z9eAeO9PA3SGCJPO0JM4633DEJM46GHC4MM07LHO4JM4C2BCCJOO64JCAMHH613</uri>
        <name>wpsadmin</name>
    </author>
    <wcm:owner>
        <wcm:distinguishedName>uid=wpsadmin,cn=users,dc=test</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/!ut/um/users/profiles/Z9eAeO9PA3SGCJPO0JM4633DEJM46GHC4MM07LHO4JM4C2BCCJOO64JCAMHH613</uri>
        <name>wpsadmin</name>
    </wcm:owner>
    <wcm:lastModifier>
        <wcm:distinguishedName>uid=wpsadmin,cn=users,dc=test</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/!ut/um/users/profiles/Z9eAeO9PA3SGCJPO0JM4633DEJM46GHC4MM07LHO4JM4C2BCCJOO64JCAMHH613</uri>
        <name>wpsadmin</name>
    </wcm:lastModifier>
    <wcm:creator>
        <wcm:distinguishedName>uid=wpsadmin,cn=users,dc=test</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/!ut/um/users/profiles/Z9eAeO9PA3SGCJPO0JM4633DEJM46GHC4MM07LHO4JM4C2BCCJOO64JCAMHH613</uri>
        <name>wpsadmin</name>
    </wcm:creator>
    <link rel="self" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd" label="Read"/>
    <link rel="edit" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd" label="Edit"/>
    <link rel="delete" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd" label="Delete"/>
    <link rel="change-to-draft" href="/wps/mycontenthandler/!ut/p/wcmrest/item/d19db2ce-87dc-484f-937a-203139818fbd/change-to-draft" label="Change To Draft"/>
    <link rel="create-draft" href="/wps/mycontenthandler/!ut/p/wcmrest/item/d19db2ce-87dc-484f-937a-203139818fbd/create-draft" label="Create Draft"/>
    <link rel="access-control" href="/wps/mycontenthandler/!ut/ac/access:oid:Z6QReDe4BCI3I9CIPOAMM07N1P6MMG6O1DCMM47JPD2MM86GPC2JP47O9CG3J9C43" label="Access Control"/>
    <link rel="library" href="/wps/mycontenthandler/!ut/p/wcmrest/Library/91d0b849-7e9b-4053-a267-d4b84be29062" label="Library"/>
    <link rel="versions" href="/wps/mycontenthandler/!ut/p/wcmrest/item/d19db2ce-87dc-484f-937a-203139818fbd/versions" label="Versions"/>
    <link rel="elements" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd/Prototype/elements" label="Elements"/>
    <link rel="prototype" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd/Prototype" label="Prototype"/>
    <link rel="prototype-properties" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd/Prototype/properties" type="application/vnd.ibm.wcm+xml" label="Prototype Properties"/>
    <link rel="new-content" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd/new-content" label="New Content"/>
    <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 un modèle de contenu en envoyant une demande PUT à l'URI suivant avec une entrée Atom incluant les zones de l'objet qui doivent être modifiées.
/ContentTemplate/item-uuid
Par exemple:

PUT /wps/mycontenthandler/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd
Content-Type: application/atom+xml

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="wcm/namespace">
    <title>SampleContentTemplateTitleUpdated</title>
    <link rel="library" href="/wps/mycontenthandler/!ut/p/wcmrest/Library/91d0b849-7e9b-4053-a267-d4b84be29062"/>
    <wcm:name>SampleContentTemplateNameUpdated</wcm:name>
    <summary xml:lang="fr-fr">SampleContentTemplateDescriptionUpdated</summary>
</entry>

HTTP/1.0 200 OK
Content-type: application/atom+xml; type=entry

<?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:d19db2ce-87dc-484f-937a-203139818fbd</id>
    <title xml:lang="fr-fr">SampleContentTemplateTitleUpdated</title>
    <summary xml:lang="fr-fr">SampleContentTemplateDescriptionUpdated</summary>
    <wcm:name>SampleContentTemplateNameUpdated</wcm:name>
    <wcm:type>ContentTemplate</wcm:type>
    <updated>2015-03-19T04:06:49.462Z</updated>
    <wcm:created>2015-03-19T04:02:33.655Z</wcm:created>
    <wcm:lastModifier>
        <wcm:distinguishedName>uid=wpsadmin,cn=users,dc=test</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/!ut/um/users/profiles/Z9eAeO9PA3SGCJPO0JM4633DEJM46GHC4MM07LHO4JM4C2BCCJOO64JCAMHH613</uri>
        <name>wpsadmin</name>
    </wcm:lastModifier>
    <wcm:creator>
        <wcm:distinguishedName>uid=wpsadmin,cn=users,dc=test</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/!ut/um/users/profiles/Z9eAeO9PA3SGCJPO0JM4633DEJM46GHC4MM07LHO4JM4C2BCCJOO64JCAMHH613</uri>
        <name>wpsadmin</name>
    </wcm:creator>
    <link rel="self" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd" label="Read"/>
    <link rel="edit" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd" label="Edit"/>
    <link rel="delete" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd" label="Delete"/>
    <link rel="change-to-draft" href="/wps/mycontenthandler/!ut/p/wcmrest/item/d19db2ce-87dc-484f-937a-203139818fbd/change-to-draft" label="Change To Draft"/>
    <link rel="create-draft" href="/wps/mycontenthandler/!ut/p/wcmrest/item/d19db2ce-87dc-484f-937a-203139818fbd/create-draft" label="Create Draft"/>
    <link rel="access-control" href="/wps/mycontenthandler/!ut/ac/access:oid:Z6QReDe4BCI3I9CIPOAMM07N1P6MMG6O1DCMM47JPD2MM86GPC2JP47O9CG3J9C43" label="Access Control"/>
    <link rel="library" href="/wps/mycontenthandler/!ut/p/wcmrest/Library/91d0b849-7e9b-4053-a267-d4b84be29062" label="Library"/>
    <link rel="versions" href="/wps/mycontenthandler/!ut/p/wcmrest/item/d19db2ce-87dc-484f-937a-203139818fbd/versions" label="Versions"/>
    <link rel="elements" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd/Prototype/elements" label="Elements"/>
    <link rel="prototype" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd/Prototype" label="Prototype"/>
    <link rel="prototype-properties" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd/Prototype/properties" type="application/vnd.ibm.wcm+xml" label="Prototype Properties"/>
    <link rel="new-content" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd/new-content" label="New Content"/>
    <category scheme="wcmrest:workflowState" term="PUBLISHED" label="Published" xml:lang="fr-fr"/>
    <category scheme="wcmrest:favorite" term="false" xml:lang="fr-fr"/>
</entry>

Lire

Vous pouvez lire un modèle de contenu en envoyant une demande GET à l'URI suivant :
/ContentTemplate/item-uuid
Par exemple:

GET /wps/mycontenthandler/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd

HTTP/1.0 200 OK
Content-type: application/atom+xml; type=entry

<?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:d19db2ce-87dc-484f-937a-203139818fbd</id>
    <title xml:lang="fr-fr">SampleContentTemplateTitleUpdated</title>
    <summary xml:lang="fr-fr">SampleContentTemplateDescriptionUpdated</summary>
    <wcm:name>SampleContentTemplateName</wcm:name>
    <wcm:type>ContentTemplate</wcm:type>
    <updated>2015-03-19T04:06:49.462Z</updated>
    <wcm:created>2015-03-19T04:02:33.655Z</wcm:created>
    <wcm:lastModifier>
        <wcm:distinguishedName>uid=wpsadmin,cn=users,dc=test</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/!ut/um/users/profiles/Z9eAeO9PA3SGCJPO0JM4633DEJM46GHC4MM07LHO4JM4C2BCCJOO64JCAMHH613</uri>
        <name>wpsadmin</name>
    </wcm:lastModifier>
    <wcm:creator>
        <wcm:distinguishedName>uid=wpsadmin,cn=users,dc=test</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/!ut/um/users/profiles/Z9eAeO9PA3SGCJPO0JM4633DEJM46GHC4MM07LHO4JM4C2BCCJOO64JCAMHH613</uri>
        <name>wpsadmin</name>
    </wcm:creator>
    <link rel="self" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd" label="Read"/>
    <link rel="edit" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd" label="Edit"/>
    <link rel="delete" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd" label="Delete"/>
    <link rel="change-to-draft" href="/wps/mycontenthandler/!ut/p/wcmrest/item/d19db2ce-87dc-484f-937a-203139818fbd/change-to-draft" label="Change To Draft"/>
    <link rel="create-draft" href="/wps/mycontenthandler/!ut/p/wcmrest/item/d19db2ce-87dc-484f-937a-203139818fbd/create-draft" label="Create Draft"/>
    <link rel="access-control" href="/wps/mycontenthandler/!ut/ac/access:oid:Z6QReDe4BCI3I9CIPOAMM07N1P6MMG6O1DCMM47JPD2MM86GPC2JP47O9CG3J9C43" label="Access Control"/>
    <link rel="library" href="/wps/mycontenthandler/!ut/p/wcmrest/Library/91d0b849-7e9b-4053-a267-d4b84be29062" label="Library"/>
    <link rel="versions" href="/wps/mycontenthandler/!ut/p/wcmrest/item/d19db2ce-87dc-484f-937a-203139818fbd/versions" label="Versions"/>
    <link rel="elements" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd/Prototype/elements" label="Elements"/>
    <link rel="prototype" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd/Prototype" label="Prototype"/>
    <link rel="prototype-properties" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd/Prototype/properties" type="application/vnd.ibm.wcm+xml" label="Prototype Properties"/>
    <link rel="new-content" href="/wps/mycontenthandler/!ut/p/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd/new-content" label="New Content"/>
    <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 un modèle de contenu en envoyant une demande DELETE à l'URI suivant :
/ContentTemplate/item-uuid
Par exemple:
DELETE /wps/mycontenthandler/wcmrest/ContentTemplate/d19db2ce-87dc-484f-937a-203139818fbd

Response:
Status Code :200
Status Message : OK