Quickr: Usando REST e ATOM
Documento em Rascunho (Draft)
Getting the list of libraries - Quickr/Portal
Request
- GET /dm/atom/introspection
Return
<?xml version="1.0" encoding="utf-8"?> <service> <workspace title="Teamspace Documents"> <collection title="Architecture Documents" href="http://quickrserver/library/5d06ab0044ed8129bd5ebd4caeec5df1/feed"> <accept>application/*,image/*,*/*</accept> </collection> <collection title="Design Documents" href="http://quickrserver/library/3c06ab0044ed8129bd5ebd4cbeec5dc4/feed"> <accept>application/*,image/*,*/*</accept> </collection> </workspace> </service>
http://www.ibm.com/developerworks/lotus/library/quickr-rest/
Getting the list of folders and documents - Quickr/Portal
Request
/dm/atom/library/5d06ab0044ed8129bd5ebd4caeec5df1/feed
http://www.ibm.com/developerworks/lotus/library/quickr-rest/
Retrieving the list of places - Quickr/Domino
Request
/myqcs/rest/places/feed
Return
<?xml version="1.0" encoding="utf-8"?> <feed xml:base="http://mikebook.cn.ibm.com" xmlns="http://www.w3.org/2005/Atom" xmlns:td="urn:ibm.com/td"> <id>http://mikebook.cn.ibm.com/myqcs/rest/places/feed</id> <title type="text">Quickr Place Collection</title> <link rel="alternate" type="text/html" href="http://mikebook.cn.ibm.com/AdminConsole"/> <link rel="self" type="application/atom+xml" href="http://mikebook.cn.ibm.com/myqcs/rest/places/feed?page=1&pagesize=20&sortby=&sortorder=1&total=1"/> <author> <name>qp</name> </author> <generator version="1.0" uri="http://mikebook.cn.ibm.com/LotusQuickr">Quickr 8.1</generator> <entry xmlns:td="urn:ibm.com/td"> <id>6B6E24213DA1364C882573A70002B497</id> <title>Mike Place</title> <published>2007-12-03T23:43:24Z</published> <updated>2007-12-03T23:29:36Z</updated> <link rel="alternate" type="text/html" href="http://mikebook.cn.ibm.com/mikeplace"/> <link rel="self" type="application/atom+xml" href="http://mikebook.cn.ibm.com/myqcs/rest/place/ 6B6E24213DA1364C882573A70002B497/entry"/> <td:locked>0</td:locked> <td:alert>0</td:alert> <td:size>2540</td:size> <td:policyname>Policy1</td:policyname> <td:lastmodified>2007-12-03T23:29:36Z</td:lastmodified> </entry> </feed>
Retrieving the information of an individual place
GET /myqcs/rest/place/6B6E24213DA1364C882573A70002B497/entry
Listing 2. Atom entry document for the individual place information
<?xml version="1.0" encoding="utf-8"?> <entry xml:base="http://mikebook.cn.ibm.com" xmlns="http://www.w3.org/2005/Atom" xmlns:td="urn:ibm.com/td"> <id>6B6E24213DA1364C882573A70002B497</id> <link href="/myqcs/rest/place/6B6E24213DA1364C882573A70002B497/entry" rel="self" /> <link href="http://mikebook.cn.ibm.com/mikeplace" rel="alternate"/> <link href="/myqcs/rest/place/6B6E24213DA1364C882573A70002B497/entry" rel="current"/> <link href="/myqcs/rest/place/6B6E24213DA1364C882573A70002B497/entry" rel="edit"/> <updated>2007-12-03T23:29:36Z</updated> <author> <name></name> <email></email> </author> <td:loginuser> <name>qp</name> <email></email> </td:loginuser> <title>Mike Place</title> <td:placename>mikeplace</td:placename> <td:logincounts>0</td:logincounts> <td:placesize>2540</td:placesize> <td:lastaccessed></td:lastaccessed> <td:numdocs>3</td:numdocs> <td:numdrafts>0</td:numdrafts> <td:numattachs>0</td:numattachs> <td:numcustomforms>0</td:numcustomforms> <td:numofflineinstalls>0</td:numofflineinstalls> <td:nummanagers>1</td:nummanagers> <td:numauthors>0</td:numauthors> <td:numreaders>0</td:numreaders> <td:lastweekuses>0</td:lastweekuses> <td:lastweekreads>0</td:lastweekreads> <td:lastweekwrites>0</td:lastweekwrites> <td:lastmonthuses>0</td:lastmonthuses> <td:lastmonthreads>0</td:lastmonthreads> <td:lastmonthwrites>0</td:lastmonthwrites> <td:servername>mikebook.cn.ibm.com</td:servername> <td:islocked>0</td:islocked> <td:sizePolicyStatus>ok</td:sizePolicyStatus> <td:sizePolicyAction>unlock</td:sizePolicyAction> <td:agePolicyStatus>ok</td:agePolicyStatus> <td:agePolicyAction>unlock</td:agePolicyAction> <td:policy> <td:policyName>Policy1</td:policyName> <td:policyID>A54BE63EA15F4898882573A70003B39D</td:policyID> <td:policySize> <td:max>1</td:max> <td:warn>1</td:warn> </td:policySize> <td:policyAge> <td:max>1</td:max> <td:warn>1</td:warn> </td:policyAge> </td:policy> </entry>
Locking a place
Request
PUT /myqcs/rest/place/6B6E24213DA1364C882573A70002B497/entry
Listing 3. Atom Put operations for locking a place
HTTP Request: Method:POST URL: http://mikebook.cn.ibm.com/myqcs/rest/place/6B6E24213DA1364C882573A70002B497/entry Content-Type:application/x-www-form-urlencoded x-method-override: PUT
<?xml version='1.0' encoding='UTF-8'?> <entry xmlns='http://www.w3.org/2005/Atom'> <td:lock xmlns='urn:ibm.com/td'>true</td:lock> </entry>
Atencao para as seguintes entradas
x-method-override: PUT
<td:lock xmlns='urn:ibm.com/td'>true</td:lock>
Listando as policies
The URL for creating a policy operations look like this one: http://mikebook.cn.ibm.com/myqcs/rest/policy/feed
http://www.ibm.com/developerworks/lotus/library/quickr-admin/
Assigning a policy to a place
http://mikebook.cn.ibm.com/myqcs/rest/place/6B6E24213DA1364C882573A70002B497/entry
The APP Put operations are used to assign the policy
Listing 5. Atom Put operations for assigning a policy to a place
POST http://mikebook.cn.ibm.com/myqcs/rest/place/ 6B6E24213DA1364C882573A70002B497/entry HTTP/1.0 Accept: */* Accept-Language: zh-cn x-method-override: PUT Content-Type: application/x-www-form-urlencoded Pragma: no-cache Host: mikebook.cn.ibm.com Content-Length: 331 Authorization: Basic cXA6cXA=
<?xml version='1.0' encoding='UTF-8'?> <entry xmlns='http://www.w3.org/2005/Atom> <published>2007-12-04T01:02:26Z</published> <updated>2007-12-04T01:02:26Z</updated> <td:policy_uuid xmlns='urn:ibm.com/td'>A54BE63EA15F4898882573A70003B39D</td:policy_uuid> <td:policy_title xmlns='urn:ibm.com/td'>Policy1</td:policy_title> </entry>
Return Members
GET /lotus/mycontenthandler/!ut/p/ai/applications/<placeid>/members
Listing 1. Sample Application-Members Entry extract
<atom:entry>
<atom:id>ai:applications/1F_18M131M41OUAC0II8RDHR42007</atom:id>
<atom:title xml:lang=en>My Application Title</atom:title>
...
<atom:link ca:rel="application-members"
href="/lotus/mycontenthandler/!
ut/p/ai/applications/<placeid>/members"
rel="related" type=......" />
...
</atom:entry>
Listing 2. Structure of Members feed <atom:feed ....> <atom:author> <atom:name>IBM WebSphere Portal/6.1.0.3</atom:name> </atom:author> <atom:title>IBM WebSphere Portal Application Infrastructure Feed</atom:title> <atom:link href="/lotus/mycontenthandler/!ut/p/ai/applications/1F_18M131M41OUAC0II8RDHR42007/members" rel="self"... /> <atom:id>ai:applications/1F_18M131M41OUAC0II8RDHR42007/members</atom:id> <atom:updated>2010-06-19T22:20:06.171Z</atom:updated> <opensearch:totalResults>12</opensearch:totalResults>
Table 2. Elements of Members feed ATOM document atom:author Author of the ATOM document atom:title Title of the document. Includes a link to the document itself. atom:id ID of the document. This can be used as a Piece Of Content (POC) URL to access the feed. atom:updated Date the feed is updated. opensearch:totalResults Number of results in the entire feed. If the feed is split into pages, then this number is the total entries across all pages, not just the current page.
memberUrl = this.serverRoot + “/mycontenthander/!ut/p/ai/applications” + this.placeId + “/members”
Outros
/dm/atom/libraries/feed?pagesize=1000
/myqcs/rest/place/" + sId + "/members"
/myqcs/rest/places/feed?libID=