Set titles and descriptions of resources
Portal Model REST services allow us to set titles and descriptions of resources.
To set titles and descriptions of a resource, take the following steps:
Use the update parameter with either of the merge or replace modes:
- Obtain the URI of resource for which to modify titles and descriptions.
- Perform an HTTP PUT request to the URI obtained by the previous step, with a feed in the message body containing titles and descriptions to set.
- Check for response 200 OK from the server.
- update=merge
- Use the merge mode to modify only the titles or descriptions of the resource. In this case, we need to send only the titles or descriptions to modify.
- update=replace
- Use the replace mode to replace the complete entry of the resource. In this case, we need to send the complete resource.
Example: Feed to modify titles and description for a content node:
<?xml version="1.0" encoding="UTF-8"?> <atom:feed xmlns:atom="http://www.w3.org/2005/Atom" xml:base="http://wps128.boeblingen.de.ibm.com:10040/wps/mycontenthandler" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:portal="http://www.ibm.com/xmlns/prod/websphere/portal/v6.0.1/portal-model" xmlns:model="http://www.ibm.com/xmlns/prod/websphere/portal/v6.0.1/portal-model-elements" xmlns:base="http://www.ibm.com/xmlns/prod/websphere/portal/v6.0/ibm-portal-composite-base"> <atom:author> <atom:name>HCL WebSphere Portal/6.1</atom:name> </atom:author> <atom:title>HCL WebSphere Portal Model Feed</atom:title> <atom:id>cm:oid:6_000000000000000000000000A0</atom:id> <atom:link href="?uri=cm:oid:6_000000000000000000000000A0&mode=download&levels=1&rep=compact" rel="self" type="application/atom+xml"/> <atom:updated>2008-02-26T06:36:02.239Z</atom:updated> <atom:entry> <atom:title>Content Root</atom:title> <atom:id portal:uniquename="wps.content.root">cm:oid:6_000000000000000000000000A0</atom:id> <atom:published>2002-05-31T22:00:00.000Z</atom:published> <atom:updated>2008-02-26T06:36:02.239Z</atom:updated> <atom:content type="application/xml"> <model:content-label> <model:title> <base:nls-string xml:lang="de">Mein neuer Titel</base:nls-string> <base:nls-string xml:lang="en">My new title</base:nls-string> </model:title> <model:description> <base:nls-string xml:lang="de">Meine neue Beschreibung</base:nls-string> <base:nls-string xml:lang="en">My new description</base:nls-string> </model:description> </model:content-label> </atom:content> </atom:entry> </atom:feed>