Adding an attachment to a wiki page
Added by IBM contributorRajmeet S Bal | Edited by IBM contributorPaul Bastide on August 13, 2015
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars2 comments

You can use the Wikis API with the GET method to add an attachment to a wiki page.

 

Input
Method URI Description
POST /wikis/{auth}/api/wiki/{wiki-id}/page/{page-id}/feed?category=attachment
Name Type Optional Description
auth
enumerated No The authorization protocol being used by your application to access Connections Cloud.
Authorized values:
  • basic
  • oauth
Name Type Optional Description
Slug
string No Contains the file path and label of the resource to be added to the collection. You can include non-ASCII characters in this header, but they must be properly encoded according to the RFC 2047.
X-Update-Nonce
string Yes String. Represents a unique data string generated by the server upon request that you can provide to secure the request. Use /wikis/basic/api/nonce API to get nonce.
Authorization
enumerated No The authentication mechanism selected by your application to access the API.
Basic is the Base64 encoding of the IBM Connections Cloud username and password: Base64(username:password). For example, Base64(twatson@us.ibm.com:password).
Bearer is the oauth 2.0 access token that is generated when the user grants your application access to IBM Connections Cloud services.
See the reference topic "OAuth 2.0 APIs for web server flow" for more information.
Authorized values:
  • bearer
  • basic
Output
Content Type: application/atom+xml
Code Description
201
Indicates that the file entry was successfully created. If an error occurs, this header contains one of the error codes.
401
Unauthorized.
403
Forbidden.
404
Not Found.
409
Conflict.
415
Unsupported Media Type.
Examples
curl -u "<EMAIL>:<PASSWORD>" -X POST -H "X-Update-Nonce: <NONCE>" -H "Content-Type: <CONTENT_TYPE>" -H "Slug: <FILENAME>" --data "@<FILE>" "https://<SERVER>/wikis/basic/api/wiki/<WIKI>/page/<WIKIPAGE>/feed?category=attachment"
<no request body>

Response returned by the server
<?xml version="1.0" encoding="UTF-8"?><entry xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:snx="http://www.ibm.com/xmlns/prod/sn" xmlns:td="urn:ibm.com/td" xmlns="http://www.w3.org/2005/Atom"><id>urn:lsid:ibm.com:td:76a7dfd1-5b81-414c-b9d3-7cbbacbc8bec</id><td:uuid>76a7dfd1-5b81-414c-b9d3-7cbbacbc8bec</td:uuid><td:label>text.txt</td:label><link href="https://<SERVER>/wikis/basic/api/wiki/ac1c6882-860a-4c09-b77d-7414562bc3fe/page/58545790-ebc3-4977-89ee-70e3793eee1f/attachment/76a7dfd1-5b81-414c-b9d3-7cbbacbc8bec/entry" rel="self"></link><link href="https://<SERVER>/wikis/basic/api/wiki/ac1c6882-860a-4c09-b77d-7414562bc3fe/page/58545790-ebc3-4977-89ee-70e3793eee1f/attachment/76a7dfd1-5b81-414c-b9d3-7cbbacbc8bec/media/text.txt" rel="alternate"></link><link href="https://<SERVER>/wikis/basic/api/wiki/ac1c6882-860a-4c09-b77d-7414562bc3fe/page/58545790-ebc3-4977-89ee-70e3793eee1f/attachment/76a7dfd1-5b81-414c-b9d3-7cbbacbc8bec/entry" rel="edit"></link><link href="https://<SERVER>/wikis/basic/api/wiki/ac1c6882-860a-4c09-b77d-7414562bc3fe/page/58545790-ebc3-4977-89ee-70e3793eee1f/attachment/76a7dfd1-5b81-414c-b9d3-7cbbacbc8bec/media" rel="edit-media"></link><link href="https://<SERVER>/wikis/basic/api/wiki/ac1c6882-860a-4c09-b77d-7414562bc3fe/page/58545790-ebc3-4977-89ee-70e3793eee1f/attachment/76a7dfd1-5b81-414c-b9d3-7cbbacbc8bec/media/text.txt" rel="enclosure" type="text/plain" title="text.txt" length="9"></link><category term="attachment" scheme="tag:ibm.com,2006:td/type" label="attachment"></category><summary type="text"></summary><td:documentUuid>58545790-ebc3-4977-89ee-70e3793eee1f</td:documentUuid><td:libraryId>ac1c6882-860a-4c09-b77d-7414562bc3fe</td:libraryId><author><name>John Doe0</name><snx:userid>20000395</snx:userid><snx:orgId>20000393</snx:orgId><snx:orgName>IBM Connections Developers</snx:orgName><email></email><snx:userState>active</snx:userState></author><td:modifier><name>John Doe0</name><snx:userid>20000395</snx:userid><snx:orgId>20000393</snx:orgId><snx:orgName>IBM Connections Developers</snx:orgName><email></email><snx:userState>active</snx:userState></td:modifier><title type="text">text.txt</title><published>2015-08-13T12:30:58.243Z</published><updated>2015-08-13T12:30:58.243Z</updated><td:created>2015-08-13T12:30:58.243Z</td:created><td:modified>2015-08-13T12:30:58.243Z</td:modified><td:lastAccessed></td:lastAccessed><content type="text/plain" src="https://<SERVER>/wikis/basic/api/wiki/ac1c6882-860a-4c09-b77d-7414562bc3fe/page/58545790-ebc3-4977-89ee-70e3793eee1f/attachment/76a7dfd1-5b81-414c-b9d3-7cbbacbc8bec/media"></content></entry>
Paul Bastide commented on Aug 13, 2015

Re: Adding an attachment to a wiki page

added

Srinivas Medoju commented on Aug 11, 2015

Re: Adding an attachment to a wiki page

example of creating an attachment is much more appreciated.