Documentation

API /content/add

ThoughtFarmer REST API Method: /content/add

Adds content as a DetailPage to ThoughtFarmer. Returns newly created content when successful.

URL:
http://yourserver.com/api/content/add
http://yourserver.com/api/2.0/content/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 content to add
body string The body text of the content
culture string(5) The culture of the content 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 content under. If not supplied, then the content will be created under the place page of the user adding the content
pageType string
Page (default), Section, Calendar, PhotoGallery, NewsBlog, Forum, Group, Post, CalendarEvent, ForumTopic
layout string
LeftNavigation - For pageType Page
CompactDirectory, NavigationTwoColumn, NavigationOneColumn, Thumbnail - For pageType Section or Group
Day, Week, Month - For pageType CalendarEvent
News, Blog - For pageType NewsBlog
None - For the other pageType values
isPublished bool true, false. False will set the page to be Private. The default is true.
token string Required. A valid token authentication parameter

Optional parameters for just CalendarEvent
 
Parameter Type Description
startDate string
ISO 8601 date string representing the desired start date. If a valid date format not in ISO 8601 is used (with no timezone), then the logged in user's timezone will be used instead. If not supplied then the current time will be used.
endDate string ISO 8601 date string representing the desired end date. If a valid date format not in ISO 8601 is used (with no timezone),
then the logged in user's timezone will be used instead. If not supplied then the default event length of 1 hour will be used.
isAllDay bool true, false. True to set the event to an all day event.
eventType int Integer representing the eventType for the event. Can be taken from the column CustomEventTypeID  in the ThoughtFarmer table CustomEventTypeLocalized 


Response Status Codes:
200 - Update successful
401 - Token parameter is invalid
403 - No permissions to make update
404 - Parent id does not exist
500 - For any parameter validation errors

Example request
POST http://yourserver.com/api/content/add
POST Data title={title}&body={body}&culture={culture}&parentId={parentId}&pageType={pageType}&layout={layout}&isPublished={isPublished}&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"
}