Fun with TDI (aka SDI) and AD/Domino/Cnx – Part 2 – Upload a file to Connections

- api ibm-connections tdi

Files can be directly uploaded to IBM Connections through the API via a HTTP request. This is documented in the IBM Connections 4.5 API Documentation i.e. when we want to update a file inside Connections we find some informations on how to this here.  

Unfortunately the documentation has no examples (as Carl Tyler nicely described in “The Domino Designer documentation team screwed us all”) and is far away from being perfect. Starting point for me was to use the SBT API Explorer on Greenhouse and/or a local Rest client (I’m using the Cocoa Rest client on my OS X machine).

So if you want to update a file inside Connections you have to do a PUT request on:

Easiest way to find the {person-id-of-owner} and the {document-id} is to open the file in the browser and do a right click on “Feed for…” and copy the link.

Now paste the link into a text file and you will find what you are looking for, i.e.

Now we have to use this link inside a HTTP Client Connector in the TDI CE, following screenshot shows you my upload connector:

A Cryptographic key prevents unauthorized access to Connections data, this cryptographic nonce (number used once) key has to be used for the PUT request. You can get this key via a URI (files_server/basic/api/nonce) but it’s much easier to use the HTTP Client Connector in CallReply Mode and get the key with the first call and then use this key for the Reply/PUT request.

First get the key in the Input Map (http.x-update-nonce):

and then use it in the Output Map:

I only added a Default Success Hook at the end which deletes the CSV file (or you can implement some error handling if needed).

In the next part later this week I will show you how you can create a comment to this file and update a Wiki page with the TDI script,  stay tuned.