Social
To get a list of social media posts use the following:
{
"action":"get_posts",
"limit":<number>,
"offset": <number>
}
A successful response will contain an array of posts in JSON format with each post item containing the following:
{
"media": <array of media>,
"post": {
"author":<string>,
"commentCount":<number>,
"created": <unix_timestamp>,
"edited":<unix_timestamp>,
"id":<number>,
"memberId":<number>,
"message":<string>,
"parentId":<number>
},
"reactions": <array of reactions>
}
Each media item will contain:
{
"id":<number>,
"imageData": <string: base 64 encoded image>,
"postId":<number>
}
Each reaction item will contain:
{ "id":<number>, "memberId":<number>, "postId":<number>, "reaction":<number: reaction type index> }
Create
A member can use the following POST request to create a social media post:
{ "action":"create_post", "memberId":<number: the members id>, "message":<string>, "images":<array of images> }
If this is a comment on a post, use the same data but add “parentId” with the id of the post that this is a comment for.
Update
A member can update their own post using the following request:
{ "action":"update_post", "id":<number: post id to update>, "memberId":<number: the members id>, "message":<string>, "images":<array of images> }
Delete
A member can delete their own post using the following POST request:
{
"action":"delete_post",
"postId":<number>
}
Reactions
Create
You can create a reaction to a post using the following:
{
"action":"create_post_reaction",
"postId":<number>,
"memberId":<number>,
"reaction":<number: type of reaction>
}
Get
{
"action": "get_post_reactions",
"postId":<number>
}
Comments
Get
{
"action":"get_post_comments",
"postId":<number>
}
Note: Use the create post action to create comments by specifying a parentId in the request body.