Create content library document

Use this interface to create a content library document.

Service URL:

/rest/api/v1.3/clDocs

Request Method:

POST

Request Header:

Authorization=<AUTH_TOKEN>

Content-Type=application/json

Sample Request Body:

{
  "documentPath": "/contentlibrary/abn/wsrest_cl.htm",
  "content": "<html dir=\"ltr\">\r\n <head>\r\n  <title><\/title>\r\n <\/head>\r\n <body>\r\n  <p>test document<\/p>\r\n  <p><img src=\"wsrest_cl.images/testcreate-1.png\" alt=\"\" /><\/p>\r\n <\/body>\r\n<\/html>\n\n"
}

Sample Response in case of success:

RESPONSE NOTE: Content Library saves files with an .html extension with an .htm extension. Therefore, the response will have links to the document with an .htm extension.

{
  "documentPath": "/contentlibrary/abn/wsrest_cl.htm",
  "content": null,
  "links": [
    {
      "rel": "self",
      "href": "/rest/api/v1.3/clDocs",
      "method": "POST"
    },
    {
      "rel": "getDocumentContent",
      "href": "/rest/api/v1.3/clDocs/contentlibrary/abn/wsrest_cl.htm",
      "method": "GET"
    },
    {
      "rel": "deleteDocument",
      "href": "/rest/api/v1.3/clDocs/contentlibrary/abn/wsrest_cl.htm",
      "method": "DELETE"
    },
    {
      "rel": "setDocumentContent",
      "href": "/rest/api/v1.3/clDocs/contentlibrary/abn/wsrest_cl.htm",
      "method": "POST"
    }
  ]
}

Sample Response in case of failure:

{
   "type": "",
   "title": "Document already exists",
   "errorCode": "DOCUMENT_ALREADY_EXISTS",
   "detail": "/contentlibrary/abn/wsrest_cl.htm",
   "errorDetails": []
}