Documentation

API /document/add

ThoughtFarmer REST API Method: /document/add

Adds a document to a content page

URL:
http://yourserver.com/api/document/add
http://yourserver.com/api/2.0/document/add

Response Formats:
xml,json

HTTP Method(s):
POST

Requires Authentication:
true, user making call must pass a valid token parameter and user adding content must be able to add it under the parentId defined

Parameters:

Parameter Type Description
title string(255) Required. The title of the document to add
body string The body text of the document
culture string(5) The culture of the document to add. If not supplied or not valid, defaults to the culture of the user adding the content.
parentId int The parentId to create the document under. If not supplied, then the document will be created under the place page of the user adding the content
file byte[]
The file that this document page represents
token string Required. A valid token authentication parameter
Response Status Codes:
200 - Update successful
401 - Token parameter is invalid
403 - No permissions to add the document
404 - Parent id does not exist
405 - There must be one file attached to this request
500 - For any parameter validation errors

Example request
POST http://yourserver.com/api/document/add
POST Data title={title}&body={body}&culture={culture}&parentId={parentId}&pageType={pageType}&layout={layout}&token={token}
{
   "AbbreviatedTitle":[
      {
         "Key":"en",
         "Value":""
      }
   ],
   "ContentId":42750,
   "CreatorId":99,
   "DateModified":"\/Date(1351560561623-0700)\/",
   "DatePosted":"\/Date(1351560561623-0700)\/",
   "DatePublished":"\/Date(1351560561623-0700)\/",
   "GrandParentId":0,
   "IsPublished":true,
   "LastModifiedBy":"...",
   "Layout":2,
   "ModifiedId":99,
   "OwnerId":99,
   "PageType":1,
   "ParentId":11800,
   "PermissionIsEdit":true,
   "PermissionIsView":true,
   "Summary":[
      {
         "Key":"en",
         "Value":""
      }
   ],
   "Title":[
      {
         "Key":"en",
         "Value":"Page Title"
      }
   ],
   "TreePath":"...",
   "TreePathText":"Directory  People  David Root, Product Marketing  Page Title",
   "Body":"Page Body"
}