Search Content API
The Search Content API enables searching and filtering across all content in ThoughtFarmer. It supports full-text search, filtering by content type, date ranges, ownership, tags, and more.
Endpoint
POST /api/search/content
Pagination
All search results are paginated. The default page size is defined by api.defaultPageSize (typically 10), with a maximum of 1000 items per page.
Parameters:
-
pageNumber- Page number to retrieve (default: 1) -
pageSize- Number of results per page (default: api.defaultPageSize, max: 1000)
Response includes:
-
items- Array of search results -
totalItems- Total number of matching items -
pageNumber- Current page number -
pageSize- Items per page
Search Parameters
Query and Search Type
forQuery (string) Full-text search query. Returns results as if searching from the ThoughtFarmer search page. When omitted, results are filtered using other criteria only.
{
"forQuery": "project update"
}
forSearchType (SearchType enum) Predefined content type filters that group related PageTypes. Equivalent to type filters on the ThoughtFarmer search page.
Values: None, Pages, Files, People, Groups, NewsBlog, Forums, Calendars, PhotoGalleries, Links, Polls, MailingLists, Comments, MicroBlogEntry, ShoutOut, Forms, Entries, EntryLists
Example: NewsBlog returns all blog pages, posts, post links, and external post links.
forArea (SearchArea enum) Scopes search to specific areas. For most use cases, use General (default) and rely on forSearchType or PageType filters instead.
Values: General, Forum, Groups, People, NewsBlog, TitleOnly, PhotoGallery, BestBets, Polls, ShoutOuts, UserName, GroupTitle, TemplateUsage, UserManagement
PageType Filtering
includePageTypes (array of PageType) Include only specific content types. See PageType Reference for complete list.
{
"includePageTypes": [11, "ForumTopic", 30]
}
excludePageTypes (array of PageType) Exclude specific content types.
{
"excludePageTypes": ["Section", 27]
}
Content Filtering
includeContentIds (array of integers) Return only content with these specific content IDs.
excludeContentIds (array of integers) Exclude content with these specific content IDs.
scope (integer) Limit results to a specific section and all its sub-pages. Provide the content ID of the section.
{
"scope": 12345
}
excludeTreePath (array of integers) Exclude all content within specified sections (by content ID).
User Filtering
forOwnedBy (array of integers) Filter by content owner user IDs.
forEditedBy (array of integers) Filter by users who have edited the content (user IDs).
forMentioned (array of integers) Find pages where specified users have been mentioned (user IDs).
forRequireAllUsersMentioned (boolean) When true, pages must mention ALL users in forMentioned (AND logic). When false, pages mention ANY of the users (OR logic). Default: false
{
"forMentioned": [101, 102, 103],
"forRequireAllUsersMentioned": true
}
Date Filtering
Posted Date (Published Date):
Option 1 - Relative range:
{
"forPostedDate": "Last30Days"
}
Option 2 - Custom date range:
{
"rangedPostedDateStart": "2025-01-01T00:00:00",
"rangedPostedDateEnd": "2025-03-31T23:59:59"
}
Published Date:
Option 1 - Relative range:
{
"forPublishedDate": "Last7Days"
}
Option 2 - Custom date range:
{
"rangedPublishedDateStart": "2025-01-01T00:00:00",
"rangedPublishedDateEnd": "2025-01-31T23:59:59"
}
DateFacetRange values: None, Last24Hours, Last7Days, Last30Days, Last3Months, Last6Months, LastYear, Over1Year
forAnniversary (DateFacetRange) Filter Profile pages by work anniversary date range.
Other Filters
forTags (array of integers) Filter by tag IDs. Tag IDs can be obtained from the /api/tagbundles endpoints.
{
"forTags": [5, 12, 24]
}
forFirstLetterOfTitle (string) Filter content by first letter of title.
{
"forFirstLetterOfTitle": "A"
}
forCulture (string) Filter by content culture/language (e.g., "en", "fr").
includeArchived (boolean) Include archived content in results. Default: false
includeInactiveUsers (boolean) Include inactive users in search results. Default: false
includeComments (boolean) Include comments in search results. Default: true
Sorting
sortType (SortType enum) Values: DateCreated, DateModified, DatePublished, LastName, Relevance, Title Default: Relevance
sortDirection (SortDirection enum) Values: Ascending, Descending Default: Descending
{
"sortType": "DatePublished",
"sortDirection": "Descending"
}
Examples
All blog posts from last 30 days
POST /api/search/content
{
"includePageTypes": ["Post", "PostLink", "ExternalPostLink"],
"forPostedDate": "Last30Days"
}
Content where specific user is mentioned
POST /api/search/content
{
"forMentioned": [12345]
}
Content created last quarter
POST /api/search/content
{
"rangedPublishedDateStart": "2025-01-01T00:00:00",
"rangedPublishedDateEnd": "2025-03-31T23:59:59"
}
Content owned by user in specific section
POST /api/search/content
{
"forOwnedBy": [12345],
"scope": 67890
}
Full-text search for documents
POST /api/search/content
{
"forQuery": "budget report",
"includePageTypes": [15],
"pageSize": 50
}
Forum discussions with specific tag
POST /api/search/content
{
"includePageTypes": ["ForumTopic"],
"forTags": [42],
"sortType": "DateModified",
"sortDirection": "Descending"
}
Deprecated Parameters
The following parameters are deprecated. Use alternative endpoints or relative date ranges instead:
-
forBirthdayDay,forBirthdayMonth,forBirthdayYear- Use/api/userssearch or/api/users/upcomingbirthdaysinstead -
forAnniversaryDay,forAnniversaryMonth,forAnniversaryYear- UseforAnniversarywith DateFacetRange instead
Related Documentation
- PageType Reference - Complete list of supported PageTypes
- Tag Bundles API - Available in Swagger documentation at
/swagger
Comments
0 comments
Please sign in to leave a comment.