Utilisation de REST avec des actions de flux de travaux personnalisées
Vous pouvez utiliser le service REST de Web Content Manager pour créer, lire, mettre à jour et supprimer des actions de flux de travaux personnalisés.
Localisation des actions installées
Pour créer une action de flux de travaux personnalisée, vous devez d'abord identifier l'action installée qui est exécutée par cette action de flux de travaux. Il existe deux manières de localiser des actions installées.
- Répertoriez toutes les actions de flux de travaux personnalisées en envoyant une demande GET à l'URI suivant :Remarque : Chaque entrée comporte un lien avec la relation "alternate". Ce lien peut être utilisé pour spécifier l'action à utiliser lors de la création d'une action de flux de travaux personnalisée.
/CustomWorkflowAction/available-actions
Par exemple:HTTP/1.1 GET /wps/mycontenthandler/wcmrest/CustomWorkflowAction/available-actions HTTP 200 OK <?xml version="1.0" encoding="UTF-8"?> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="http://www.ibm.com/xmlns/wcm/8.0"> <id>wcmrest:CustomWorkflowAction/available-actions</id> <title xml:lang="fr-fr">All Custom Workflow Actions</title> <updated>2014-06-26T01:17:46.022Z</updated> <entry> <title xml:lang="fr-fr">ML Localize</title> <summary xml:lang="fr-fr">Notifies the base locale owner of changes to localized copies and performs automatic localization of modified base locale documents</summary> <wcm:name>com.ibm.workplace.wcm.ml.workflowactions.LocalizeMLCustomWorkflowAction</wcm:name> <link rel="alternate" href="/wps/mycontenthandler/wcmrest/CustomWorkflowActionFactory/MLCustomWorkflowActionFactory/actions/com.ibm.workplace.wcm.ml.workflowactions.LocalizeMLCustomWorkflowAction" label="Read"/> </entry> <entry> <title xml:lang="fr-fr">ML Regionalize</title> <summary xml:lang="fr-fr"> Notifies the base locale owner of changes to regionalized copies and performs automatic regionalization of modified base locale documents </summary> <wcm:name>com.ibm.workplace.wcm.ml.workflowactions.RegionalizeMLCustomWorkflowAction</wcm:name> <link rel="alternate" href="/wps/mycontenthandler/wcmrest/CustomWorkflowActionFactory/MLCustomWorkflowActionFactory/actions/com.ibm.workplace.wcm.ml.workflowactions.RegionalizeMLCustomWorkflowAction" label="Read"/> </entry> <entry> <title xml:lang="fr-fr">Legacy ML Sync Publish Implementation</title> <summary xml:lang="fr-fr"> Ensures that ML versions of the same document are published at the same time. This is the legacy implementation of synchronized publishing, you are recommended to use the new Projects-based synchronized publishing instead </summary> <wcm:name>com.ibm.workplace.wcm.ml.workflowactions.SyncPublishMLCustomWorkflowAction</wcm:name> <link rel="alternate" href="/wps/mycontenthandler/wcmrest/CustomWorkflowActionFactory/MLCustomWorkflowActionFactory/actions/com.ibm.workplace.wcm.ml.workflowactions.SyncPublishMLCustomWorkflowAction" label="Read"/> </entry> <entry> <title xml:lang="fr-fr">ML Sync Expire</title> <summary xml:lang="fr-fr"> Ensures that ML versions of the same document are expired at the same time </summary> <wcm:name>com.ibm.workplace.wcm.ml.workflowactions.SyncExpireMLCustomWorkflowAction</wcm:name> <link rel="alternate" href="/wps/mycontenthandler/wcmrest/CustomWorkflowActionFactory/MLCustomWorkflowActionFactory/actions/com.ibm.workplace.wcm.ml.workflowactions.SyncExpireMLCustomWorkflowAction" label="Read"/> </entry> <entry> <title xml:lang="fr-fr">ML Sync Delete</title> <summary xml:lang="fr-fr">Ensures that ML versions of the same document are deleted at the same time</summary> <wcm:name>com.ibm.workplace.wcm.ml.workflowactions.SyncDeleteMLCustomWorkflowAction</wcm:name> <link rel="alternate" href="/wps/mycontenthandler/wcmrest/CustomWorkflowActionFactory/MLCustomWorkflowActionFactory/actions/com.ibm.workplace.wcm.ml.workflowactions.SyncDeleteMLCustomWorkflowAction" label="Read"/> </entry> <entry> <title xml:lang="fr-fr">Update ML Conf File Cache</title> <summary xml:lang="fr-fr">Update the ML Configuration File cache when a Configuration File is updated</summary> <wcm:name>com.ibm.workplace.wcm.ml.workflowactions.UpdateMLConfFileCacheCustomWorkflowAction</wcm:name> <link rel="alternate" href="/wps/mycontenthandler/wcmrest/CustomWorkflowActionFactory/MLCustomWorkflowActionFactory/actions/com.ibm.workplace.wcm.ml.workflowactions.UpdateMLConfFileCacheCustomWorkflowAction" label="Read"/> </entry> <entry> <title xml:lang="fr-fr">ML Workflow Switcher</title> <summary xml:lang="fr-fr">Used to switch a document back to its original workflow (as assigned by the ML Workflow engine)</summary> <wcm:name>com.ibm.workplace.wcm.ml.workflowactions.WorkflowSwitcherWorkflowAction</wcm:name> <link rel="alternate" href="/wps/mycontenthandler/wcmrest/CustomWorkflowActionFactory/MLCustomWorkflowActionFactory/actions/com.ibm.workplace.wcm.ml.workflowactions.WorkflowSwitcherWorkflowAction" label="Read"/> </entry> <entry> <title xml:lang="fr-fr">ML Next Stage</title> <summary xml:lang="fr-fr">Used to move a document to the next stage in the workflow</summary> <wcm:name>com.ibm.workplace.wcm.ml.workflowactions.NextStageWorkflowAction</wcm:name> <link rel="alternate" href="/wps/mycontenthandler/wcmrest/CustomWorkflowActionFactory/MLCustomWorkflowActionFactory/actions/com.ibm.workplace.wcm.ml.workflowactions.NextStageWorkflowAction" label="Read"/> </entry> </feed> Répertorier toutes les fabriques d'actions de flux de travaux personnalisées installées, puis les actions personnalisées qui sont gérées par ces fabriques.
La liste des fabriques d'actions de flux de travaux personnalisées disponibles peut être obtenue en envoyant une demande GET à l'URI suivant. Chaque entrée contenue dans le flux renvoyé fournit une description de la fabrique et un lien vers toutes les actions personnalisées associées à la fabrique qui utilise la relation de lien "actions".
/CustomWorkflowActionFactory
Par exemple:
La liste des actions associées à une fabrique d'actions de flux de travaux personnalisées est obtenue en envoyant une demande GET à l'URI suivant.HTTP/1.1 GET /wps/mycontenthandler/wcmrest/CustomWorkflowActionFactory HTTP 200 OK <?xml version="1.0" encoding="UTF-8"?> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="http://www.ibm.com/xmlns/wcm/8.0"> <id>wcmrest:CustomWorkflowActionFactory</id> <title xml:lang="fr-fr">Custom Workflow Action Factories</title> <updated>2014-06-26T01:26:38.340Z</updated> <entry> <id>wcmrest:MLCustomWorkflowActionFactory</id> <title xml:lang="fr-fr">ML Custom Workflow Action Factory</title> <wcm:name>MLCustomWorkflowActionFactory</wcm:name> <link rel="actions" href="/wps/mycontenthandler/wcmrest/CustomWorkflowActionFactory/MLCustomWorkflowActionFactory/actions"/> <content/> </entry> </feed>Remarque : Chaque entrée comporte un lien avec la relation "alternate". Ce lien permet de spécifier l'action lors de la création d'une action de flux de travaux personnalisée./CustomWorkflowActionFactory/name-of-the-factory/actions
Par exemple:HTTP/1.1 GET /wps/mycontenthandler/wcmrest/CustomWorkflowActionFactory/MLCustomWorkflowActionFactory/actions HTTP 200 OK <?xml version="1.0" encoding="UTF-8"?> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="http://www.ibm.com/xmlns/wcm/8.0"> <id>wcmrest:CustomWorkflowActionFactory/MLCustomWorkflowActionFactory/actions</id> <title xml:lang="fr-fr">ML Custom Workflow Action Factory</title> <updated>2014-06-26T01:30:16.491Z</updated> <entry> <title xml:lang="fr-fr">ML Localize</title> <summary xml:lang="fr-fr"> Notifies the base locale owner of changes to localized copies and performs automatic localization of modified base locale documents </summary> <wcm:name>com.ibm.workplace.wcm.ml.workflowactions.LocalizeMLCustomWorkflowAction</wcm:name> <link rel="alternate" href="/wps/mycontenthandler/wcmrest/CustomWorkflowActionFactory/MLCustomWorkflowActionFactory/actions/com.ibm.workplace.wcm.ml.workflowactions.LocalizeMLCustomWorkflowAction" label="Read"/> </entry> ... some entries omitted ... </feed>
Créer
Vous pouvez créer des actions de flux de travaux personnalisées en envoyant une demande POST à l'URI suivant :
/CustomWorkflowAction
Par exemple:
HTTP/1.1 POST /wps/mycontenthandler/wcmrest/CustomWorkflowAction
<?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">
<title>MLS Next Stage Workflow Action</title>
<wcm:name>MLS Next Stage Workflow Action</wcm:name>
<link rel="library" href="/wps/mycontenthandler/!ut/p/digest!muAe8T8GIzS4EJeiF9a_sw/wcmrest/Library/03da7ddc-1bc9-47cd-ab69-b06f23a3f284" />
<content type="application/vnd.ibm.wcm+xml">
<wcm:customAction xmlns="http://www.ibm.com/xmlns/wcm/8.0">
<action href="/wps/mycontenthandler/wcmrest/CustomWorkflowActionFactory/MLCustomWorkflowActionFactory/actions/com.ibm.workplace.wcm.ml.workflowactions.NextStageWorkflowAction"/>
</wcm:customAction>
</content>
</entry>
HTTP/1.1 201 Created
<?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:33b378f9-78be-4457-a5ec-20c9f2848000</id>
<title xml:lang="fr-fr">MLS Next Stage Workflow Action</title>
<summary xml:lang="fr-fr"></summary>
<wcm:name>MLS Next Stage Workflow Action</wcm:name>
<wcm:type>CustomWorkflowAction</wcm:type>
... some content elided ...
<content type="application/vnd.ibm.wcm+xml">
<wcm:customAction xmlns="http://www.ibm.com/xmlns/wcm/8.0" xmlns:atom="http://www.w3.org/2005/Atom">
<dateType>CUSTOM_ACTION_DATE</dateType>
<action href="/wps/mycontenthandler/wcmrest/CustomWorkflowActionFactory/MLCustomWorkflowActionFactory/actions/com.ibm.workplace.wcm.ml.workflowactions.NextStageWorkflowAction"/>
</wcm:customAction>
</content>
</entry>
Mettre à jour
Vous pouvez mettre à jour une action de flux de travaux personnalisée en envoyant une demande PUT à l'URI suivant :
/CustomWorkflowAction/action-id
Par exemple:
HTTP/1.1 PUT /wps/mycontenthandler/wcmrest/CustomWorkflowAction/abc4c24a-3540-4ae3-8ba6-f2f82a977046
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">
... some content elided ...
<content type="application/vnd.ibm.wcm+xml">
<wcm:customAction xmlns="http://www.ibm.com/xmlns/wcm/8.0" xmlns:atom="http://www.w3.org/2005/Atom">
<dateType>SPECIFIED_DATE</dateType>
<date>2014-06-26T01:48:00.000Z</date>
<action href="/wps/mycontenthandler/wcmrest/CustomWorkflowActionFactory/MLCustomWorkflowActionFactory/actions/com.ibm.workplace.wcm.ml.workflowactions.NextStageWorkflowAction"/>
</wcm:customAction>
</content>
</entry>
HTTP/1.1 200 OK
Lire
Vous pouvez lire des actions de flux de travaux personnalisées en envoyant une demande GET à l'URI suivant :
/CustomWorkflowAction/action-id
Par exemple:
HTTP/1.1 GET /wps/mycontenthandler/wcmrest/CustomWorkflowAction/33b378f9-78be-4457-a5ec-20c9f2848000
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:33b378f9-78be-4457-a5ec-20c9f2848000</id>
<title xml:lang="fr-fr">My Test Action</title>
<summary xml:lang="fr-fr"></summary>
<wcm:name>My Test Action</wcm:name>
<wcm:type>CustomWorkflowAction</wcm:type>
<updated>2014-06-26T01:48:54.966Z</updated>
<wcm:created>2014-06-26T01:48:54.965Z</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/CustomWorkflowAction/33b378f9-78be-4457-a5ec-20c9f2848000" xml:lang="fr-fr" label="Read"/>
<link rel="edit" href="/wps/mycontenthandler/wcmrest/CustomWorkflowAction/33b378f9-78be-4457-a5ec-20c9f2848000" xml:lang="fr-fr" label="Edit"/>
<link rel="delete" href="/wps/mycontenthandler/wcmrest/CustomWorkflowAction/33b378f9-78be-4457-a5ec-20c9f2848000" xml:lang="fr-fr" label="Delete"/>
<link rel="create-draft" href="/wps/mycontenthandler/wcmrest/item/33b378f9-78be-4457-a5ec-20c9f2848000/create-draft" xml:lang="fr-fr" label="Create Draft"/>
<link rel="change-to-draft" href="/wps/mycontenthandler/wcmrest/item/33b378f9-78be-4457-a5ec-20c9f2848000/change-to-draft" xml:lang="fr-fr" label="Change To Draft"/>
<link rel="access-control" href="/wps/mycontenthandler/ac/access:oid:Z6QReDeJPC4MPS6OHPIJMS6OHOAMMG6K9DEJM4CL9P6MM86GPOI3J96O1DG3O06G1" xml:lang="fr-fr" label="Access Control"/>
<link rel="library" href="/wps/mycontenthandler/wcmrest/Library/f68ddb0c-c06b-43a9-84fd-d43552980e46" xml:lang="fr-fr" label="Library"/>
<link rel="versions" href="/wps/mycontenthandler/wcmrest/item/33b378f9-78be-4457-a5ec-20c9f2848000/versions" xml:lang="fr-fr" label="Versions"/>
<link rel="edit-media" href="/wps/mycontenthandler/wcmrest/CustomWorkflowAction/33b378f9-78be-4457-a5ec-20c9f2848000" 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:customAction xmlns="http://www.ibm.com/xmlns/wcm/8.0" xmlns:atom="http://www.w3.org/2005/Atom">
<dateType>CUSTOM_ACTION_DATE</dateType>
<action href="/wps/mycontenthandler/wcmrest/CustomWorkflowActionFactory/MLCustomWorkflowActionFactory/actions/com.ibm.workplace.wcm.ml.workflowactions.NextStageWorkflowAction"/>
</wcm:customAction>
</content>
</entry>
Supprimer
Vous pouvez supprimer une action personnalisée en envoyant une demande DELETE à l'URI suivant :
/CustomWorkflowAction/action-id
Par exemple:
HTTP/1.1 DELETE /wps/mycontenthandler/wcmrest/CustomWorkflowAction/abc4c24a-3540-4ae3-8ba6-f2f82a977046 HTTP/1.1 200 OK