Documentation

/content [POST]

ThoughtFarmer REST API Method: /content [POST]

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

URL:
http://yourserver.com/api/content

Response Formats:
JSON, XML

HTTP Method(s):
POST

Requires Authentication:
true, user making call must pass a valid token parameter and user adding content must be able to edit the parent page.

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
isPublished bool true, false. False will set the page to be Private. The default is true.
token string Required. A valid token authentication parameter

Parameters for 'CalendarEvent' page type:
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.
eventTypeId int The id of the eventType. Can be taken from the column CustomEventTypeID  in the ThoughtFarmer table CustomEventTypeLocalized 

Parameters for 'MailingList' page type:
Parameter Type Description
mailingListEmail string
Required. Email address for the mailing list.

Response Status Codes:
200 Success
400 Validation failed
403 Insufficient permissions
404 Parent page not found
501 Page type unsupported

Example request
POST http://yourserver.com/api/content
  Authorization: {token}
Content-Type: application/json
{
    "title": "Content title",
    "body": "Content body",
    "culture": "en",
    "parentId": 3918,
    "pageType": "Group",
    "isPublished": true
}
{
    "body": [
        {
            "key": "en",
            "value": ""
        }
    ],
    "allowFiles": true,
    "layout": 2,
    "pageType": "Page",
    "grandParentId": 0,
    "abbreviatedTitle": [
        {
            "key": "en",
            "value": ""
        }
    ],
    "contentId": 9597,
    "summary": [
        {
            "key": "en",
            "value": ""
        }
    ],
    "creatorId": 189,
    "dateModified": "2016-02-23T21:48:56.59",
    "datePosted": "2016-02-23T21:48:56.59",
    "datePublished": "2016-02-23T21:48:56.59",
    "modifiedId": 189,
    "ownerId": 189,
    "parentId": 1073,
    "title": [
        {
            "key": "en",
            "value": "Test content create via API"
        }
    ],
    "treePath": "<a href=\"http://localhost:3000/\">Home</a>  <a href=\"http://localhost:3000/people/\">Find Person</a>  <a href=\"http://localhost:3000/content/1073\">Mr. asdfasfd Criddle</a>  <a href=\"http://localhost:3000/content/9597\" id=\"pageTitle\">Test content create via API</a>",
    "treePathText": "Home &rsaquo; Find Person &rsaquo; Mr. asdfasfd Criddle &rsaquo; Test content create via API",
    "lastModifiedBy": "Added <abbr class=\"timeago\" title=\"2016-02-23T21:48:56Z\">1 second ago</abbr> by <a href=\"http://localhost:3000/content/1073\" title=\"Mr. asdfasfd Criddle\">Mr. asdfasfd Criddle</a>",
    "permissionIsEdit": true,
    "permissionIsView": true,
    "isPublished": true
}