Setup
To use the Posts API, install the @wix/forum
package using npm or Yarn:
1npm install @wix/forum
or
1yarn add @wix/forum
Then import { posts }
from @wix/forum
:
1import { posts } from '@wix/forum'
Posts: Supported Filters and Sorting
The following table shows field support for filters and sorting for the Post object:
Field | Supported Filters | Sortable |
---|---|---|
id | $eq , $ne , $hasSome | Sortable |
categoryId | $eq , $ne | Sortable |
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 , $ne | Sortable |
commentingEnabled | $eq , $ne | |
commentCount | $eq , $ne , $lt , $lte , $gt , $gte | Sortable |
likeCount | $eq , $ne , $lt , $lte , $gt , $gte | Sortable |
viewCount | $eq , $ne , $lt , $lte , $gt , $gte | Sortable |
createdDate | $eq , $ne , $lt , $lte , $gt , $gte | Sortable |
updatedDate | $eq , $ne , $lt , $lte , $gt , $gte | |
lastActivityDate | $eq , $ne , $lt , $lte , $gt , $gte | Sortable |
slug | $eq , $ne , $contains , $hasSome , $urlized , $startsWith , $endsWith , $hasSome | Sortable |
Related content: API Query Language, queryPosts( )
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:function getPost(postId: string, options: GetPostOptions): Promise<Post>
Post ID.
Options specifying which additional fields to return.
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:function getPostBySlug(slug: string, options: GetPostBySlugOptions): Promise<PostResponse>
URL slug.
Options specifying which additional fields to return.
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:function queryPosts(options: QueryPostsOptions): Promise<QueryPostsResponse>
Options for sorting, filtering, paging, and specifying return fields.