Utilisation de REST avec des projets
Vous pouvez utiliser les services REST pour Web Content Manager afin de créer et de gérer des projets.
Création d'un projet
/project/
Par exemple:
POST /wps/mycontenthandler/wcmrest/Project HTTP/1.0
Content-type : application/atom+xml
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="wcm/namespace">
<title>SampleProjectTitle</title>
<wcm:name>SampleProjectName</wcm:name>
<wcm:description>SampleProjectDescription</wcm:description>
</entry>
HTTP/1.0 Created
Content-type: application/atom+xml; type=entry
Content-location: /wps/mycontenthandler/!ut/p/wcmrest/Project/80d503aa-fec5-477c-a8b2-372897982af
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="wcm/namespace">
<id>80d503aa-fec5-477c-a8b2-372897982afe</id>
<title>SampleProjectTitle</title>
<link rel="edit" href="/wps/mycontenthandler/!ut/p/wcmrest/Project/80d503aa-fec5-477c-a8b2-372897982afe"/>
<link rel="add-item" href="/wps/mycontenthandler/!ut/p/wcmrest/Project/80d503aa-fec5-477c-a8b2-372897982afe/additem"/>
<link rel="remove-item" href="/wps/mycontenthandler/!ut/p/wcmrest/Project/80d503aa-fec5-477c-a8b2-372897982afe/removeitem"/>
<updated>2011-05-30T06:15:29.952Z</updated>
<author>
<wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
<uri>/wps/mycontenthandler/!ut/p/digest!6GVkh5Ul75Ln7DdEgvHm_g/um/users/profiles/Z9eAeH1C2JG561RC6JM47H9E4MMG6PHO6JM4C5JD0JMOC6BEEJS464JDG3I56K1</uri>
<name>wpsadmin</name>
</author>
<wcm:owner>
<wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
<uri>/wps/mycontenthandler/!ut/p/digest!6GVkh5Ul75Ln7DdEgvHm_g/um/users/profiles/Z9eAeH1C2JG561RC6JM47H9E4MMG6PHO6JM4C5JD0JMOC6BEEJS464JDG3I56K1</uri>
<name>wpsadmin</name>
</wcm:owner>
<wcm:name>SampleProjectName</wcm:name>
<wcm:description>SampleProjectDescription</wcm:description>
<wcm:type>Project</wcm:type>
</entry>Lecture d'un projet
/project/item-uuid
Par exemple:
GET /wps/mycontenthandler/wcmrest/Project/80d503aa-fec5-477c-a8b2-372897982afe HTTP/1.1
HTTP/1.0 200 OK
Content-type: application/atom+xml; type=entry
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="wcm/namespace">
<id>80d503aa-fec5-477c-a8b2-372897982afe</id>
<title>SampleProjectTitle</title>
<link rel="edit" href="/wps/mycontenthandler/!ut/p/wcmrest/Project/80d503aa-fec5-477c-a8b2-372897982afe"/>
<link rel="add-item" href="/wps/mycontenthandler/!ut/p/wcmrest/Project/80d503aa-fec5-477c-a8b2-372897982afe/additem"/>
<link rel="remove-item" href="/wps/mycontenthandler/!ut/p/wcmrest/Project/80d503aa-fec5-477c-a8b2-372897982afe/removeitem"/>
<updated>2011-05-30T06:15:29.952Z</updated>
<author>
<wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
<uri>/wps/mycontenthandler/!ut/p/digest!6GVkh5Ul75Ln7DdEgvHm_g/um/users/profiles/Z9eAeH1C2JG561RC6JM47H9E4MMG6PHO6JM4C5JD0JMOC6BEEJS464JDG3I56K1</uri>
<email></email>
<name>wpsadmin</name>
</author>
<wcm:owner>
<wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
<uri>/wps/mycontenthandler/!ut/p/digest!6GVkh5Ul75Ln7DdEgvHm_g/um/users/profiles/Z9eAeH1C2JG561RC6JM47H9E4MMG6PHO6JM4C5JD0JMOC6BEEJS464JDG3I56K1</uri>
<email></email>
<name>wpsadmin</name>
</wcm:owner>
<wcm:name>SampleProjectName</wcm:name>
<wcm:description>SampleProjectDescription</wcm:description>
<wcm:type>Project</wcm:type>
</entry>Suppression d'un projet
/project/item-uuid
Par exemple:
HTTP/1.1 DELETE http://host:port/wps/mycontenthandler/wcmrest/Project/35b9120a-17d0-4dcb-b0ba-b034e34b50a6 Accept-Type: application/atom+xml 200 OK
Mise à jour d'un projet
/project/item-uuid
Par exemple:
HTTP/1.1 PUT http://host:port/wps/mycontenthandler/wcmrest/Project/35b9120a-17d0-4dcb-b0ba-b034e34b50a6 Accept-Type: application/atom+xml 200 OK
Ajout d'un objet à un projet
Pour ajouter un objet à un projet, mettez-le à jour à l'aide d'une demande PUT qui spécifie un lien vers la relation "project" indiquant le projet auquel l'objet doit être ajouté. Par exemple:
HTTP/1.1 PUT
http://host:port/wps/mycontenthandler/!ut/p/digest!MetYLHV_M5sJbvslxI8twA/
wcmrest/LibraryTextComponent/fd34a8bf-7ca1-499c-80ab-acdc2f33cf3e</a>
Accept-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">
... data ...
<link rel="project" href="/wps/mycontenthandler/wcmrest/Project/77d08cf6-88f6-4577-a929-34d43a8e150e" />
... data...
</entry>
200 OKSuppression d'un objet d'un projet
Pour supprimer un objet d'un projet, mettez-le à jour à l'aide d'une demande PUT sans spécifier la relation de lien de projet. Par exemple:
HTTP/1.1 PUT http://host:port/wps/mycontenthandler/!ut/p/digest!MetYLHV_M5sJbvslxI8twA/ wcmrest/LibraryTextComponent/fd34a8bf-7ca1-499c-80ab-acdc2f33cf3e</a> Accept-Type: application/atom+xml 200 OK
Soumission d'un projet pour révision
/item/project-uuid/submit-for-review
Par exemple:
HTTP/1.1 POST http://host:port/wps/mycontenthandler/wcmrest/item/project-uuid/submit-for-review Accept-Type: application/atom+xml 201 Created
Retrait d'un project de la révision
/item/project-uuid/withdraw-from-review
Par exemple:
HTTP/1.1 POST http://host:port/wps/mycontenthandler/wcmrest/item/project-uuid/withdraw-from-review Accept-Type: application/atom+xml 201 Created
Une fois le projet retiré, son état redevient "actif".
Approbation d'un projet
/item/project-uuid/approve
Par exemple:
HTTP/1.1 POST http://host:port/wps/mycontenthandler/wcmrest/item/project-uuid/approve Accept-Type: application/atom+xml 201 Created
Une fois approuvé, le projet peut être publié.
Rejet d'un projet
/project/project-uuid/reject
Par exemple:
HTTP/1.1 POST http://host:port/wps/mycontenthandler/wcmrest/Project/PROJECT-UUID/reject Accept-Type: application/atom+xml 201 Created
Une fois le projet rejeté, son état redevient "actif".
Retrait de l'approbation d'un projet
/project/project-uuid/withdraw-approval
Par exemple:
HTTP/1.1 POST http://host:port/wps/mycontenthandler/wcmrest/Project/PROJECT-UUID/withdraw-approval Accept-Type : application/atom+xml 201 Created
Le retrait de l'approbation ne change pas l'état du projet, qui reste en révision.