Setup

To use the Posts API, install the @wix/forum package using npm or Yarn:

Copy
1
npm install @wix/forum

or

Copy
1
yarn add @wix/forum

Then import { posts } from @wix/forum:

Copy
1
import { posts } from '@wix/forum'
Was this helpful?
Yes
No

Posts: Supported Filters and Sorting

The following table shows field support for filters and sorting for the Post object:

FieldSupported FiltersSortable
id$eq, $ne, $hasSomeSortable
categoryId$eq, $neSortable
title$eq, $ne, $contains, $hasSome, $urlized, $startsWith, $endsWith, $hasSome
ownerId$eq, $ne
contentText$eq, $ne, $contains, $hasSome, $startsWith, $endsWith, $hasSome
bestAnswerCommentId$eq, $ne
pinned$eq, $neSortable
commentingEnabled$eq, $ne
commentCount$eq, $ne, $lt, $lte, $gt, $gteSortable
likeCount$eq, $ne, $lt, $lte, $gt, $gteSortable
viewCount$eq, $ne, $lt, $lte, $gt, $gteSortable
createdDate$eq, $ne, $lt, $lte, $gt, $gteSortable
updatedDate$eq, $ne, $lt, $lte, $gt, $gte
lastActivityDate$eq, $ne, $lt, $lte, $gt, $gteSortable
slug$eq, $ne, $contains, $hasSome, $urlized, $startsWith, $endsWith, $hasSomeSortable

Related content: API Query Language, queryPosts( )

Was this helpful?
Yes
No

getPost( )

Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Retrieves a single post by ID.

Permission Scopes

For app development, you must have one of the following permission scopes:
Read Forums
Learn more about permission scopes.
Copy
function getPost(postId: string, options: GetPostOptions): Promise<Post>
Method Parameters
postIdstringRequired

Post ID.


optionsGetPostOptions

Options specifying which additional fields to return.

Returns
Return Type:Promise<Post>
Was this helpful?
Yes
No

getPostBySlug( )

Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Retrieves a single post by URL slug.

Permission Scopes

For app development, you must have one of the following permission scopes:
Read Forums
Learn more about permission scopes.
Copy
function getPostBySlug(slug: string, options: GetPostBySlugOptions): Promise<PostResponse>
Method Parameters
slugstringRequired

URL slug.


optionsGetPostBySlugOptions

Options specifying which additional fields to return.

Returns
Return Type:Promise<PostResponse>
Was this helpful?
Yes
No

queryPosts( )

Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Returns a list of posts by query.

Paging

  • limit: default - 10, min - 0, max - 100
  • offset: default - 0, min - 0

Filterable fields:

  • id
  • categoryId
  • ownerId
  • title
  • contentText
  • bestAnswerCommentId
  • pinned
  • commentingEnabled
  • commentCount
  • likeCount
  • viewCount
  • createdDate
  • editedDate
  • lastActivityDate
  • slug

Sortable fields:

  • lastActivityDate
  • createdDate
  • commentCount
  • viewCount
  • likeCount
  • pinned

Permission Scopes

For app development, you must have one of the following permission scopes:
Read Forums
Learn more about permission scopes.
Copy
function queryPosts(options: QueryPostsOptions): Promise<QueryPostsResponse>
Method Parameters
optionsQueryPostsOptions

Options for sorting, filtering, paging, and specifying return fields.

Returns
Return Type:Promise<QueryPostsResponse>
Was this helpful?
Yes
No