Search.../
  1. REST
Generate a test token to explore our APIs

Query Posts

Developer Preview

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

Syntax

function QueryPosts(paging: _com_wixpress_npm_communities_forum_api_PostsPaging, filter: struct, sort: array<_com_wixpress_npm_communities_forum_api_PostsSort>, extraFields: array<_com_wixpress_npm_communities_forum_api_PostExtraField_Field>): QueryPosts<_com_wixpress_npm_communities_forum_api_QueryPostsResponse>

Query Posts Parameters

NAME
TYPE
DESCRIPTION
paging
object

Paging object (e.g., { limit: 10, offset: 100 } ).

filter
object

Filter object (e.g., { $and: [{ ownerId: { eq: 'ownerId' } }, { likeCount: { $gt: 0 }] } ).

sort
Array<object>

Array of sort objects (e.g., [{ fieldName: createdDate, order: Order.ASC }] ).

extraFields
Array<string>

Supported values: UNKNOWN, IMAGES, VIDEOS, URL.

Array of extra post fields to be added in the response.

Returns

Return Type:

object
NAME
TYPE
DESCRIPTION
posts
Array<object>

List of posts.

metaData
object

Pagination.

Was this helpful?

Request

curl

Copy Code
1curl -X POST https://www.wixapis.com/forum/v1/posts/query
2 -H 'Content-Type: application/json;charset=UTF-8'
3 -H 'Authorization: <ACCESS_TOKEN>'
4 -d '{
5 "paging": {
6 "offset": 0,
7 "limit": 1
8 },
9 "filter": {
10 "likeCount": {
11 "$eq": 0
12 }
13 },
14 "sort": [
15 {
16 "fieldName": "lastActivityDate",
17 "order": "ASC"
18 }
19 ]
20 }'

Response

json

1{
2 "posts": [ {
3 "id": "5cacd5fe04976c0015f35363",
4 "categoryId": "5cacd5fe04976c0015f35362",
5 "ownerId": "a27d2491-90b0-4a3a-87d9-7a9de00bf17a",
6 "title": "Welcome to the Forum!",
7 "contentText": "It’s good to have you here! Feel free to share anything - stories, ideas, pictures or whatever is on your mind.",
8 "bestAnswerCommentId": "5ce7bb354f055300a4b7f945",
9 "pinned": false,
10 "closed": true,
11 "commentCount": 3,
12 "likeCount": 0,
13 "viewCount": 11,
14 "createdDate": "2019-04-09T17:27:26.171Z",
15 "updatedDate": "2019-04-09T17:27:26.171Z",
16 "lastActivityDate": "2019-05-24T11:55:29.339Z",
17 "slug": "welcome-to-the-forum",
18 "postType": "DISCUSSION",
19 "commentInteraction": "REACTION",
20 "url": {
21 "base": "https://wix.com",
22 "path": "/forum/discussion-corner/welcome-to-the-forum"
23 }
24 }],
25 "metaData": {
26 "count": 1,
27 "offset": 0,
28 "total": 1
29 }
30}