Fun with TDI (aka SDI) and AD/Domino/Cnx – Part 3 – Comment&Wiki page update
After adding the CSV file in part 2 we now want to add a comment to this file to inform the users what was changed.
Create a Comment
The atom entry document for the comment was already created in the previous steps of the TDI script and is called atom-entry-comment and looks like this. The part in red will be the actual comment:
<?xml version='1.0′ encoding='UTF-8′?><entry xml:base='http://kbild.belsoft.com' xmlns='http://www.w3.org/2005/Atom' xmlns:td='urn:ibm.com/td'><category term='comment' scheme='tag:ibm.com,2006:td/type' label='comment'></category><content type='text'><span style="color: #800000;">Folgende Benutzer wurden hinzugefügt oder angepasst: 
Klaus Bild</span></content></entry>
Now we just have to post it to the correct file. You can find the How-to on the Connections API Wiki , again we are using a HTTP Client Connector and we just have to post the comment to the correct URI. This time we have to do a post to:
-
/files/basic/api/myuserlibrary/document/{document-id}/feed
(if the authenticated user is the owner of the file)
-
/files/basic/api/userlibrary/{person-id-of-owner}/document/{document-id}/feed
The Connector looks like this:
It’s important that you set Content Type to **application/atom+xml;type=entry;charset=UTF-8 **to support special characters in you atom document. This time no security key is needed to post the content and we just have to send our atom feed document as http.body:
The result looks like this:
Update a Wiki page
Now we want to create a Wiki page update which lists all actual employees, I have to say this is were the fun started for me as admin. Again you can find a How-to in the Connections API Wiki but this time we want to send html text inside the atom entry document. To make a long story short CDATA came for the rescue and after playing around with the atom document I finally figured out how it has to look like to be accepted by the Connections API:
<?xml version=”1.0″ encoding=”UTF-8″?><entry xmlns=”http://www.w3.org/2005/Atom”><content type=”text/html”>
<![CDATA[<?xml version=”1.0″ encoding=”UTF-8″?>
<div><p dir=”ltr”><strong style=”color: rgb(0, 128, 0);”>Alle Nummern direkt aus dem AD via TDI sortiert nach Nummer</strong></p><table border=”0″ cellpadding=”5″ cellspacing=”0″ dir=”ltr” style=”border-collapse: collapse; width: 400px;” width=”246″><colgroup><col style=”width: 92px;” /><col style=”width: 70px;” /><col style=”width: 165px;” /></colgroup><tbody><tr height=”14″ style=”height: 18px;”><td style=”height: 18px; border: 2px solid rgb(105, 105, 105); width: 150px;”><strong>Name</strong></td><td style=”height: 18px; border: 2px solid rgb(105, 105, 105); width: 0px;”><strong>Kürzel</strong></td><td style=”border: 2px solid rgb(105, 105, 105); height: 18px;”><strong>Nummer</strong></td></tr>
<tr><td style=”border: 2px solid rgb(0, 100, 0); height: 18px; width: 90px;”>Klaus Bild</td><td style=”border: 2px solid rgb(0, 100, 0); height: 18px; width: 0px;”>KBD</td><td style=”border: 2px solid rgb(0, 100, 0); height: 18px;”>+41 44 533 01 62</td></tr>
</tbody></table></div> ]]></content><category scheme=”tag:ibm.com,2006:td/type” term=”page” label=”page” /></entry>
The part in green is added inside the Prolog of the AL, red is executed as employee iterator and the blue part is added inside the epilog.
This time we have to PUT this atom document to following URI:
-
/basic/api/wiki/{wiki-id}/page/{page-label}/entry
i.e.
https://greenhouse.lotus.com/wikis/basic/api/wiki/Wdf50a8fc5854_406d_b783_5934abea09c1/page/E-fon%20Telefonliste/entry
The Connector looks like this:
Again it’s important that you set Content Type to **application/atom+xml;type=entry;charset=UTF-8 **and no security key is needed to PUT the content, we just have to send our atom feed document as http.body:
The result looks like this:
This was the last part of this TDI example.
Do you have remarks, want to suggest additional examples or have question? Then just leave a comment and let me know 🙂