Search code examples
wikiibm-connections

How to add tags to a wiki page in IBM Connections without deleting the page content


I am trying to add tags to an existing wiki page in IBM Connections. If I implement a POST call according to API documentation, the tags are added correctly but the content of the wiki page is cleared.

Here is the format of my POST command:

Set oHttp = CreateObject("MSXML2.XMLHTTP")
sUrl = "https://my-connect-server/wikis/basic/api/wiki/%WIKIID%/page/%PAGEID%/entry?tag=%TAG%"
Call oHttp.Open("POST", sUrl, False)
Call oHttp.setRequestHeader("X-Method-Override", "PUT")
Call oHttp.send

Of course %WIKIID%, %PAGEID% and %TAG% are replaced with valid values.

How do I need to modify this call so that only the tags are added? In the API documentation it says that I shall include the keyword 'tag' in the URL but the example given does not. I tried several ways of including 'tag' in the URL but always get a response 'not found'.


Solution

  • You should include a body where c7bc7e9d-5658-44a0-8013-4e12d742b121 is the page id you are updating.

    <entry xmlns="http://www.w3.org/2005/Atom">
    <category term="document" label="document" scheme="tag:ibm.com,2006:td/type"></category>
    <id>urn:lsid:ibm.com:td:c7bc7e9d-5658-44a0-8013-4e12d742b121</id>
    </entry>
    

    Template of request

    curl -u "<USERID?EMAIL>:<PASSWORD>" -X POST -H "X-Method-Override: PUT" -H "X-Update-Nonce: <NONCE>" -H "Content-Type: application/atom+xml; charset=utf-8"  --data "<entry xmlns=\"http://www.w3.org/2005/Atom\"><category term=\"document\" label=\"document\" scheme=\"tag:ibm.com,2006:td/type\"></category><id>urn:lsid:ibm.com:td:<PAGEID></id></entry>" "https://<SERVER>/wikis/basic/api/wiki/<WIKI_ID_OR_LABEL>/page/<PAGE_ID_OR_LABEL>/entry?tag=<TAG>"
    

    I've added the same update to the documentation.