POST

Query Posts


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
Authentication

You can only call this method when authenticated as a Wix app or Wix user identity.

Permissions
Manage Forums
Read Forums
Learn more about app permissions.
Endpoint
POST
https://www.wixapis.com/forum/v1/posts/query

Body Params
pagingPaging

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


filterstruct

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


sortArray <PostsSort>

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


extraFieldsArray <string>

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

Response Object
postsArray <Post>

List of posts.


metaDataMetaData

Pagination.

Query Posts Example 1
Request
cURL
curl -X POST https://www.wixapis.com/forum/v1/posts/query -H 'Content-Type: application/json;charset=UTF-8' -H 'Authorization: <ACCESS_TOKEN>' -d '{ "paging": { "offset": 0, "limit": 1 }, "filter": { "likeCount": { "$eq": 0 } }, "sort": [ { "fieldName": "lastActivityDate", "order": "ASC" } ] }'
Response
JSON
{ "posts": [ { "id": "5cacd5fe04976c0015f35363", "categoryId": "5cacd5fe04976c0015f35362", "ownerId": "a27d2491-90b0-4a3a-87d9-7a9de00bf17a", "title": "Welcome to the Forum!", "contentText": "It’s good to have you here! Feel free to share anything - stories, ideas, pictures or whatever is on your mind.", "bestAnswerCommentId": "5ce7bb354f055300a4b7f945", "pinned": false, "closed": true, "commentCount": 3, "likeCount": 0, "viewCount": 11, "createdDate": "2019-04-09T17:27:26.171Z", "updatedDate": "2019-04-09T17:27:26.171Z", "lastActivityDate": "2019-05-24T11:55:29.339Z", "slug": "welcome-to-the-forum", "postType": "DISCUSSION", "commentInteraction": "REACTION", "markedComments": ["5ce7bb354f055300a4b7f945"], "recentActivity": { "entityId": "5ce7bb354f055300a4b7f945", "type": "COMMENT", "memberId": "0933513a-fcd7-459e-b76e-508d4806d908", "activityDate": "2022-05-20T11:33:34.147Z" }, "totalReactionCount": 1, "reactionCounts": [ { "reactionCode": ":like:", "count": 1 } ], "reactedIdentities": [ { "reactionCode": ":like:", "reactionIdentity": [ { "identityId": "0933513a-fcd7-459e-b76e-508d4806d908", "identityType": "MEMBER" } ] } ], "url": { "base": "https://wix.com", "path": "/forum/discussion-corner/welcome-to-the-forum" } } ], "metaData": { "count": 1, "offset": 0, "total": 1 } }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?