Search Posts API

Overview

The Search Posts API allows you to search and sort relevant posts created in Social Plus. This API returns a sorted list of post objects that contain the relevant content.

API Endpoint

Search posts by query

get

Search posts by query as indicated in the request parameters.

Query parameters
querystringRequired

The search query string.

exactMatchbooleanOptional

Whether to use exact match for the query.

Default: true
targetTypestring · enumRequired

The type of target to search in. Must be "community" or "user".

Possible values:
postedUserIdstringRequired

User ID of the user who posted the post.

filterstring · enumOptional

Filter for posts.

Default: allPossible values:
types[]stringOptional

The types of posts to include (e.g., image, video).

tags[]stringOptional

Tags to filter posts.

targetIds[]stringOptional

Target IDs to search within.

options[limit]integer · max: 100Optional

The maximum number of posts to return.

Default: 20
options[token]stringOptional

Pagination token for fetching the next set of results.

options[sortBy]stringOptional

Field to sort by.

Default: createdAt
options[orderBy]string · enumOptional

Order of sorting.

Default: descPossible values:
Header parameters
AuthorizationstringRequired

Authorization header using the Bearer scheme. Example: 'Bearer {access_token}'

Example: Bearer {access_token}
Responses
200
A list of posts matching the query.
application/json
get
GET /api/v3/search/posts HTTP/1.1
Host: beta.amity.services
Authorization: text
Accept: */*
{
  "found": 1,
  "data": {
    "posts": [
      {}
    ],
    "postChildren": [
      {}
    ],
    "comments": [
      {}
    ],
    "users": [
      {}
    ],
    "files": [
      {}
    ],
    "communities": [
      {}
    ],
    "categories": [
      {}
    ],
    "communityUsers": [
      {}
    ],
    "feeds": [
      {}
    ],
    "videoStreamings": [
      {}
    ],
    "polls": [
      {}
    ]
  },
  "paging": {
    "next": "text"
  }
}

Example Curl


curl --location 'https://beta.amity.services/api/v3/search/posts?query=Amity&targetType=community&types[]=image&postedUserId=userId' \
--header 'Authorization: Bearer {access_token}'

Query Params Details

targetType can be the following values:

  • community: Search posts in all communities specified in targetIds.

  • user: Search all posts on the user feed specified in targetIds.

  • targetIds limited to 100 Ids per search.

filter can be the following values:

  • all: Search posts in all public communities

  • member: Search posts in all communities that the user has joined

  • notMember: Search posts in all public communities that the user has not joined

  • Currently, searching within a post’s metadata is not supported.

  • Posts created on a user feed within a network that has privacy enabled are not yet searchable.

Last updated

Was this helpful?