Utilisation de REST avec des éléments de flux de travaux
Vous pouvez utiliser le service REST de Web Content Manager pour créer, lire, mettre à jour et supprimer des objets de flux de travaux.
Créer
Vous pouvez créer un élément de flux de travaux en envoyant une demande POST à l'URI suivant avec une entrée Atom représentant l'élément de flux de travaux :
/Workflow
Remarque : Un lien de bibliothèque est nécessaire pour spécifier l'emplacement de création du flux de travaux.
Par exemple:
HTTP/1.1 POST /wps/mycontenthandler/wcmrest/Workflow
Content-Type: application/atom+xml
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="http://www.ibm.com/xmlns/wcm/8.0">
<wcm:name>MyWorkflow</wcm:name>
<link rel="library" href="/wps/mycontenthandler/wcmrest/Library/be3ca1cd-f482-4715-9972-8e683fd0be85"/>
<content type="application/vnd.ibm.wcm+xml">
<wcm:workflow xmlns="http://www.ibm.com/xmlns/wcm/8.0" xmlns:atom="http://www.w3.org/2005/Atom">
<option name="REQUIRE_COMMENT_ON_APPROVAL" enabled="true"/>
<option name="ALLOW_VALIDATION_FAILURES" enabled="true"/>
<stages>
<stage href="/wps/mycontenthandler/wcmrest/WorkflowStage/434ec120-aaa1-4ad0-a7fd-62a060206fc9"/>
<stage href="/wps/mycontenthandler/wcmrest/WorkflowStage/9fca54fb-fcaf-4e99-bc03-8f496510fd4e"/>
<stage href="/wps/mycontenthandler/wcmrest/WorkflowStage/4d0ff502-0cf4-4a94-9757-f37675202f44"/>
<reject href="/wps/mycontenthandler/wcmrest/WorkflowStage/4d0ff502-0cf4-4a94-9757-f37675202f44"/>
<project-exit href="/wps/mycontenthandler/wcmrest/WorkflowStage/9fca54fb-fcaf-4e99-bc03-8f496510fd4e"/>
</stages>
<draftCreation>ALLOW_EXCLUSIVE_DRAFTS_ONLY</draftCreation>
</wcm:workflow>
</content>
</entry>
HTTP/1.1 201 Created
Content-Type: application/atom+xml
Content-Location: /wps/mycontenthandler/wcmrest/Workflow/b9c05b29-66ac-48fa-9ed7-43e3912f3c54
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="http://www.ibm.com/xmlns/wcm/8.0">
<id>wcmrest:b9c05b29-66ac-48fa-9ed7-43e3912f3c54</id>
<title xml:lang="fr-fr">MyWorkflow</title>
<summary xml:lang="fr-fr"></summary>
<wcm:name>MyWorkflow</wcm:name>
<wcm:type>Workflow</wcm:type>
<updated>2014-06-03T02:03:24.406Z</updated>
<wcm:created>2014-06-03T02:03:24.406Z</wcm:created>
... some content elided...
<link rel="self" href="/wps/mycontenthandler/wcmrest/Workflow/b9c05b29-66ac-48fa-9ed7-43e3912f3c54" xml:lang="fr-fr" label="Read"/>
<link rel="edit" href="/wps/mycontenthandler/wcmrest/Workflow/b9c05b29-66ac-48fa-9ed7-43e3912f3c54" xml:lang="fr-fr" label="Edit"/>
<link rel="delete" href="/wps/mycontenthandler/wcmrest/Workflow/b9c05b29-66ac-48fa-9ed7-43e3912f3c54" xml:lang="fr-fr" label="Delete"/>
<link rel="create-draft" href="/wps/mycontenthandler/wcmrest/item/b9c05b29-66ac-48fa-9ed7-43e3912f3c54/create-draft" xml:lang="fr-fr" label="Create Draft"/>
<link rel="change-to-draft" href="/wps/mycontenthandler/wcmrest/item/b9c05b29-66ac-48fa-9ed7-43e3912f3c54/change-to-draft" xml:lang="fr-fr" label="Change To Draft"/>
<link rel="access-control" href="/wps/mycontenthandler/ac/access:oid:Z6QReDe2BE66OK62JCIJMO6M9O6MMG6OHP2MM4753PEJMG6J9P6JS46IHP6JHL6K1" xml:lang="fr-fr" label="Access Control"/>
<link rel="library" href="/wps/mycontenthandler/wcmrest/Library/be3ca1cd-f482-4715-9972-8e683fd0be85" xml:lang="fr-fr" label="Library"/>
<link rel="versions" href="/wps/mycontenthandler/wcmrest/item/b9c05b29-66ac-48fa-9ed7-43e3912f3c54/versions" xml:lang="fr-fr" label="Versions"/>
<link rel="edit-media" href="/wps/mycontenthandler/wcmrest/Workflow/b9c05b29-66ac-48fa-9ed7-43e3912f3c54" type="application/vnd.ibm.wcm+xml" xml:lang="fr-fr" label="Edit Media"/>
<category scheme="wcmrest:workflowState" term="PUBLISHED" label="Published" xml:lang="fr-fr"/>
<category scheme="wcmrest:favorite" term="false" xml:lang="fr-fr"/>
<content type="application/vnd.ibm.wcm+xml">
<wcm:workflow xmlns="http://www.ibm.com/xmlns/wcm/8.0" xmlns:atom="http://www.w3.org/2005/Atom">
<option name="REQUIRE_COMMENT_ON_APPROVAL" enabled="true"/>
<option name="ALLOW_VALIDATION_FAILURES" enabled="true"/>
<option name="ALLOW_WORKFLOW_IN_PROJECTS" enabled="false"/>
<stages>
<stage href="/wps/mycontenthandler/wcmrest/WorkflowStage/434ec120-aaa1-4ad0-a7fd-62a060206fc9"/>
<stage href="/wps/mycontenthandler/wcmrest/WorkflowStage/9fca54fb-fcaf-4e99-bc03-8f496510fd4e"/>
<stage href="/wps/mycontenthandler/wcmrest/WorkflowStage/4d0ff502-0cf4-4a94-9757-f37675202f44"/>
<reject href="/wps/mycontenthandler/wcmrest/WorkflowStage/4d0ff502-0cf4-4a94-9757-f37675202f44"/>
<project-exit href="/wps/mycontenthandler/wcmrest/WorkflowStage/9fca54fb-fcaf-4e99-bc03-8f496510fd4e"/>
</stages>
<draftCreation>ALLOW_EXCLUSIVE_DRAFTS_ONLY</draftCreation>
</wcm:workflow>
</content>
</entry>
Mettre à jour
Vous pouvez mettre à jour un élément de flux de travaux en envoyant une demande PUT à l'URI suivant avec une entrée Atom incluant les zones de l'objet à changer.
/Workflow/itemuuid
Par exemple:
HTTP/1.1 PUT /wps/mycontenthandler/wcmrest/Workflow/b9c05b29-66ac-48fa-9ed7-43e3912f3c54
Content-Type: application/atom+xml
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="http://www.ibm.com/xmlns/wcm/8.0">
<wcm:name>MyWorkflow With A New Name</wcm:name>
... some content elided ...
<content type="application/vnd.ibm.wcm+xml">
<wcm:workflow xmlns="http://www.ibm.com/xmlns/wcm/8.0" xmlns:atom="http://www.w3.org/2005/Atom">
<stages>
<stage href="/wps/mycontenthandler/wcmrest/WorkflowStage/9fdaec77-e342-43a1-beb7-1c7ab21ee35f"/>
<stage href="/wps/mycontenthandler/wcmrest/WorkflowStage/8eba94a5-dda2-46c4-a9f9-bba5ebac05a2"/>
<stage href="/wps/mycontenthandler/wcmrest/WorkflowStage/9fbbe443-63f5-49ad-905d-aa54102f377a"/>
</stages>
<draftCreation>ALLOW_MULTIPLE_DRAFTS</draftCreation>
</wcm:workflow>
</content>
</entry>
HTTP/1.1 200 OK
Content-Type: application/atom+xml
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="http://www.ibm.com/xmlns/wcm/8.0">
<wcm:name>MyWorkflow With A New Name</wcm:name>
... some content elided ...
<content type="application/vnd.ibm.wcm+xml">
<wcm:workflow xmlns="http://www.ibm.com/xmlns/wcm/8.0" xmlns:atom="http://www.w3.org/2005/Atom">
<stages>
<stage href="/wps/mycontenthandler/wcmrest/WorkflowStage/9fdaec77-e342-43a1-beb7-1c7ab21ee35f"/>
<stage href="/wps/mycontenthandler/wcmrest/WorkflowStage/8eba94a5-dda2-46c4-a9f9-bba5ebac05a2"/>
<stage href="/wps/mycontenthandler/wcmrest/WorkflowStage/9fbbe443-63f5-49ad-905d-aa54102f377a"/>
</stages>
<draftCreation>ALLOW_MULTIPLE_DRAFTS</draftCreation>
</wcm:workflow>
</content>
</entry>
Lire
Vous pouvez lire un élément de flux de travaux en envoyant une demande GET à l'URI suivant :
/Workflow/itemuuid
Par exemple:
HTTP/1.1 GET /wps/mycontenthandler/wcmrest/Workflow/b9c05b29-66ac-48fa-9ed7-43e3912f3c54
Accept: application/atom+xml
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="http://www.ibm.com/xmlns/wcm/8.0">
<id>wcmrest:b9c05b29-66ac-48fa-9ed7-43e3912f3c54</id>
<title xml:lang="fr-fr">Workflow Create Test</title>
<summary xml:lang="fr-fr"></summary>
<wcm:name>Workflow Create Test</wcm:name>
<wcm:type>Workflow</wcm:type>
<updated>2014-06-03T02:03:24.406Z</updated>
<wcm:created>2014-06-03T02:03:24.406Z</wcm:created>
<author>
<wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
<uri>/wps/mycontenthandler/um/users/profiles/Z9eAeI1E83S86KPDCMMCC1JP4MMG6G9P6JM8CMPD6MMCCOHOE3Q0713D23S06O1</uri>
<name>wpsadmin</name>
</author>
<wcm:owner>
<wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
<uri>/wps/mycontenthandler/um/users/profiles/Z9eAeI1E83S86KPDCMMCC1JP4MMG6G9P6JM8CMPD6MMCCOHOE3Q0713D23S06O1</uri>
<name>wpsadmin</name>
</wcm:owner>
<wcm:lastModifier>
<wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
<uri>/wps/mycontenthandler/um/users/profiles/Z9eAeI1E83S86KPDCMMCC1JP4MMG6G9P6JM8CMPD6MMCCOHOE3Q0713D23S06O1</uri>
<name>wpsadmin</name>
</wcm:lastModifier>
<wcm:creator>
<wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
<uri>/wps/mycontenthandler/um/users/profiles/Z9eAeI1E83S86KPDCMMCC1JP4MMG6G9P6JM8CMPD6MMCCOHOE3Q0713D23S06O1</uri>
<name>wpsadmin</name>
</wcm:creator>
<link rel="self" href="/wps/mycontenthandler/wcmrest/Workflow/b9c05b29-66ac-48fa-9ed7-43e3912f3c54" xml:lang="fr-fr" label="Read"/>
<link rel="edit" href="/wps/mycontenthandler/wcmrest/Workflow/b9c05b29-66ac-48fa-9ed7-43e3912f3c54" xml:lang="fr-fr" label="Edit"/>
<link rel="delete" href="/wps/mycontenthandler/wcmrest/Workflow/b9c05b29-66ac-48fa-9ed7-43e3912f3c54" xml:lang="fr-fr" label="Delete"/>
<link rel="create-draft" href="/wps/mycontenthandler/wcmrest/item/b9c05b29-66ac-48fa-9ed7-43e3912f3c54/create-draft" xml:lang="fr-fr" label="Create Draft"/>
<link rel="change-to-draft" href="/wps/mycontenthandler/wcmrest/item/b9c05b29-66ac-48fa-9ed7-43e3912f3c54/change-to-draft" xml:lang="fr-fr" label="Change To Draft"/>
<link rel="access-control" href="/wps/mycontenthandler/ac/access:oid:Z6QReDe2BE66OK62JCIJMO6M9O6MMG6OHP2MM4753PEJMG6J9P6JS46IHP6JHL6K1" xml:lang="fr-fr" label="Access Control"/>
<link rel="library" href="/wps/mycontenthandler/wcmrest/Library/be3ca1cd-f482-4715-9972-8e683fd0be85" xml:lang="fr-fr" label="Library"/>
<link rel="versions" href="/wps/mycontenthandler/wcmrest/item/b9c05b29-66ac-48fa-9ed7-43e3912f3c54/versions" xml:lang="fr-fr" label="Versions"/>
<link rel="edit-media" href="/wps/mycontenthandler/wcmrest/Workflow/b9c05b29-66ac-48fa-9ed7-43e3912f3c54" type="application/vnd.ibm.wcm+xml" xml:lang="fr-fr" label="Edit Media"/>
<category scheme="wcmrest:workflowState" term="PUBLISHED" label="Published" xml:lang="fr-fr"/>
<category scheme="wcmrest:favorite" term="false" xml:lang="fr-fr"/>
<content type="application/vnd.ibm.wcm+xml">
<wcm:workflow xmlns="http://www.ibm.com/xmlns/wcm/8.0" xmlns:atom="http://www.w3.org/2005/Atom">
<option name="REQUIRE_COMMENT_ON_APPROVAL" enabled="true"/>
<option name="ALLOW_VALIDATION_FAILURES" enabled="true"/>
<option name="ALLOW_WORKFLOW_IN_PROJECTS" enabled="false"/>
<stages>
<stage href="/wps/mycontenthandler/wcmrest/WorkflowStage/434ec120-aaa1-4ad0-a7fd-62a060206fc9"/>
<stage href="/wps/mycontenthandler/wcmrest/WorkflowStage/9fca54fb-fcaf-4e99-bc03-8f496510fd4e"/>
<stage href="/wps/mycontenthandler/wcmrest/WorkflowStage/4d0ff502-0cf4-4a94-9757-f37675202f44"/>
<reject href="/wps/mycontenthandler/wcmrest/WorkflowStage/4d0ff502-0cf4-4a94-9757-f37675202f44"/>
<project-exit href="/wps/mycontenthandler/wcmrest/WorkflowStage/9fca54fb-fcaf-4e99-bc03-8f496510fd4e"/>
</stages>
<draftCreation>ALLOW_EXCLUSIVE_DRAFTS_ONLY</draftCreation>
</wcm:workflow>
</content>
</entry>
Supprimer
Vous pouvez supprimer un élément de flux de travaux en envoyant une demande DELETE à l'URI suivant :
/Workflow/itemuuid
Par exemple:
HTTP/1.1 DELETE /wps/mycontenthandler/wcmrest/Workflow/b9c05b29-66ac-48fa-9ed7-43e3912f3c54 HTTP/1.1 200 OK