This version is deprecated and will be removed in the future, please use v2 instead.

SocialPosts

Posts

Posts related to Social

These endpoints allow you to create, read, update and delete posts. Posts are the main content of a social network, can be created by any profile and can receive reactions and comments.

These endpoints support pagination and sorting. Read more about these features here.

The Post model

PropTypeDefault
id
integer
-
title
string
-
body
string
-
tags
Array<string>
-
media
string
-
created
string
-
updated
string
-
_count
object
-

Query parameters

Not all of the properties of a post are returned by default. You can use the following optional query parameters to include additional properties in the response.

PropTypeDefault
_author
boolean
false
_comments
boolean
false
_reactions
boolean
false
Example with all optional query parameters
{
  "id": 0,
  "title": "string",
  "body": "string",
  "tags": ["string"],
  "media": "https://url.com/image.jpg",
  "created": "2022-09-04T08:08:38.830Z",
  "updated": "2022-09-04T08:08:38.830Z",
  "author": {
    "name": "string",
    "email": "user@example.com",
    "avatar": "https://url.com/image.jpg",
    "banner": "https://url.com/image.jpg"
  },
  "reactions": [
    {
      "symbol": "string",
      "count": 0,
      "postId": 0,
      "message": "string"
    }
  ],
  "comments": [
    {
      "body": "string",
      "replyToId": null, // or number if comment is reply to another comment
      "id": 0,
      "postId": 0,
      "owner": "string",
      "created": "2022-09-04T08:17:59.383Z",
      "author": {
        "name": "string",
        "email": "user@example.com",
        "avatar": "https://url.com/image.jpg",
        "banner": "https://url.com/image.jpg"
      }
    }
  ],
  "_count": {
    "comments": 0,
    "reactions": 0
  }
}

Filtering

You can filter based on an entry in the tags array by using the _tag query flag. You may only filter by one tag at a time.

PropTypeDefault
_tag
string
-

An example query filtering for posts with the tag my_tag:

GET/social/posts?_tag=my_tag

All posts

GET/social/posts

Retrieve all posts.

If you want to get all posts by a specific profile, you can use the posts by profile endpoint.

Response
[
  {
    "id": 0,
    "title": "string",
    "body": "string",
    "tags": ["string"],
    "media": "https://url.com/image.jpg",
    "created": "2022-09-04T08:08:38.830Z",
    "updated": "2022-09-04T08:08:38.830Z",
    "_count": {
      "comments": 0,
      "reactions": 0
    }
  },
  {
    "id": 0,
    "title": "string",
    "body": "string",
    "tags": ["string"],
    "media": "https://url.com/image.jpg",
    "created": "2022-09-04T08:08:38.830Z",
    "updated": "2022-09-04T08:08:38.830Z",
    "_count": {
      "comments": 0,
      "reactions": 0
    }
  }
  // ...
]

Single post

GET/social/posts/<id>

Retrieve a single post by its id.

Use the _author, _comments and/or _reactions flags to get more data from this request.

Response
{
  "id": 0,
  "title": "string",
  "body": "string",
  "tags": ["string"],
  "media": "https://url.com/image.jpg",
  "created": "2022-09-04T08:08:38.830Z",
  "updated": "2022-09-04T08:08:38.830Z",
  "_count": {
    "comments": 0,
    "reactions": 0
  }
}

All posts from following

GET/social/posts/following

Retrieve all posts from profiles that the authenticated user is following.

The data returned is similar to the all posts endpoint and accepts the same optional query flags.


Create post

POST/social/posts

Create a new post. Only the title property is required, but we recommend at least including the body and media properties as well.

Please note that the media property must be a fully formed URL that links to a live and publicly accessible image. The API will check the provided URL and if it cannot be accessed publicly you will receive a 400 error response.

Request
{
  "title": "string", // Required
  "body": "string", // Optional
  "tags": ["string"], // Optional
  "media": "https://url.com/image.jpg" // Optional
}
Response
{
  "id": 0,
  "title": "string",
  "body": "string",
  "tags": ["string"],
  "media": "https://url.com/image.jpg",
  "created": "2022-09-04T16:21:02.042Z",
  "updated": "2022-09-04T16:21:02.042Z",
  "_count": {
    "comments": 0,
    "reactions": 0
  }
}

Update post

PUT/social/posts/<id>

Update a post based on its id. This endpoint returns the updated post.

Please note that the media property must be a fully formed URL that links to a live and publicly accessible image. The API will check the provided URL and if it cannot be accessed publicly you will receive a 400 error response.

Request
{
  "title": "string",
  "body": "string",
  "tags": ["string"],
  "media": "https://url.com/image.jpg"
}
Response
{
  "id": 0,
  "created": "2022-09-04T16:21:02.044Z",
  "updated": "2022-09-04T16:21:02.044Z",
  "title": "string",
  "body": "string",
  "tags": ["string"],
  "media": "https://url.com/image.jpg",
  "_count": {
    "comments": 0,
    "reactions": 0
  }
}

Delete post

DELETE/social/posts/<id>

Delete a post based on its id.

Returns an empty 204 response on success.


React to post

PUT/social/posts/<id>/react/<symbol>

React to a post with a symbol.

Returns the symbol, reaction count for that symbol, and the original post id.

The symbol parameter should be an actual emoji. For example, to react to a post with a 👍 emoji, you would use the following endpoint: /social/posts/<id>/react/👍

You do not need to include a body for this request.

Response
{
  "symbol": "string",
  "count": 0,
  "postId": 0
}

Comment on post

POST/social/posts/<id>/comment

This endpoint allows a comment to be made on a post. The optional replyToId property can be used to link this comment to an existing comment.

Request
{
  "body": "string", // Required
  "replyToId": 0 // Optional - Only required if replying to another comment
}
Response
{
  "body": "string",
  "replyToId": null, // or replyToId number if provided in request
  "id": 0,
  "postId": 0,
  "owner": "string",
  "created": "2022-09-04T16:29:07.175Z",
  "author": {
    "name": "string",
    "email": "user@example.com",
    "avatar": "https://url.com/image.jpg",
    "banner": "https://url.com/image.jpg"
  }
}

Delete comment from post

DELETE/social/posts/<id>/comment/<comment-id>

Deleting a comment will also delete all replies to that comment.

Delete a comment from a post.

Returns an empty 204 response on success.