Use REST with projects
We can use the REST services for Web Content Manager to create and work with projects.
Create a project
To create a project, issue a POST request containing the appropriate data to the following URI.
/project/
For example:POST /wps/mycontenthandler/wcmrest/Project HTTP/1.0 Content-type : application/atom+xml <entry xmlns="http://www.w3.org/2005/Atom" xmlns: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="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>
Read a project
To read a project, issue a GET request containing the appropriate data to the following URI.
/project/{item-uuid}
For example: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="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>
Delete a project
To delete a project, issue a DELETE request containing the appropriate data to the following URI.
/project/{item-uuid}
For example:HTTP/1.1 DELETE http://host:port/wps/mycontenthandler/wcmrest/Project/35b9120a-17d0-4dcb-b0ba-b034e34b50a6 Accept-Type: application/atom+xml 200 OK
Update a project
To update a project, issue a PUT request containing the appropriate data to the following URI.
/project/{item-uuid}
For example:<
HTTP/1.1 PUT http://host:port/wps/mycontenthandler/wcmrest/Project/35b9120a-17d0-4dcb-b0ba-b034e34b50a6 Accept-Type: application/atom+xml 200 OK
Add an item to a project
To add an item to a project, update the item using a PUT request specifying a link with relation "project" specifying the project to add the item to. For example:
<
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/8.0"> ... data ... <link rel="project" href="/wps/mycontenthandler/wcmrest/Project/77d08cf6-88f6-4577-a929-34d43a8e150e" /> ... data... </entry> 200 OKIf using REST inside a Portal project context, posting to the create-draft link relation will create the draft in a project.
Remove an item from a project
To remove an item from a project, update the item using a PUT request without specifying the project link relation. For example:
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
Submit a project for review
Editors of a project can submit a project for review by issuing a POST request containing the appropriate data to the following URI:
<
/project/{project-uuid}/submit-for-review
For example:>HTTP/1.1 POST http://host:port/wps/mycontenthandler/wcmrest/Project/PROJECT-UUID/submit-for-review Accept-Type: application/atom+xml 201 Created
Withdraw a project from review
Editors of a project can withdraw a project from review by issuing a POST request containing the appropriate data to the following URI:
/project/{project-uuid}/withdraw-from-review
For example:HTTP/1.1 POST http://host:port/wps/mycontenthandler/wcmrest/Project/PROJECT-UUID/withdraw-from-review Accept-Type: application/atom+xml 201 CreatedWhen withdrawn, the project returns to an active state.
Approve a project
Approvers of a project can approve a project by issuing a POST request containing the appropriate data to the following URI:
/project/{project-uuid}/approve
For example:HTTP/1.1 POST http://host:port/wps/mycontenthandler/wcmrest/Project/PROJECT-UUID/approve Accept-Type: application/atom+xml 201 CreatedWhen approved, the project is ready to be published.
Reject a project
Approvers of a project can reject project approval by issuing a POST request containing the appropriate data to the following URI:
/project/{project-uuid}/reject
For example:HTTP/1.1 POST http://host:port/wps/mycontenthandler/wcmrest/Project/PROJECT-UUID/reject Accept-Type: application/atom+xml 201 CreatedWhen rejected, the project returns to an active state.
Withdraw approval for a project
Approvers of a project can withdraw approval for a project by issuing a POST request containing the appropriate data to the following URI:
/project/{project-uuid}/withdraw-approval
For example:HTTP/1.1 POST http://host:port/wps/mycontenthandler/wcmrest/Project/PROJECT-UUID/withdraw-approval Accept-Type: application/atom+xml 201 CreatedWithdrawing approval does not change the state of the project, which remains in review.