How it works?
In order to create a post or reply to it using api, you need to know how it works in the backend.
The post and the answer to it are absolutely the same thing, except that the answer is attributed to some post. As for his media structure and behavior, it is the same as a regular post.
Just sending texts and media files at one time to create a post will not work, since it is created step by step.
Description of how the system works when creating a media post, that is (Image / Video) post. (Not gif)
- 1. First you upload media files (Video/Images)
- 2. Then just publish the post or answer using the endpoints described below
Description of how the system works when creating a (GIF/Text) post
- 1. By creating a simple text post or a GIF image, we can send all with one request as shown below.
Upload post media
Please use this (https://trendram.xyz/mobile_api/upload_post_media) API endpoint for uploading post multimedia files
Post parameters
Field | Value | Remarks |
---|---|---|
session_id | Access token ID | E.g. de25cc16eb00960f076... |
type | Media file type (image/video) | E.g. image |
file | Media file (Image/Video) | E.g. some-selfy-picture.jpeg |
Success response (Image uplaod)
{
"message": "Media file uploaded successfully",
"code": 200,
"data": {
"media_id": 4,
"url": "An absolute URL of new uploded media file",
"type": "Image/Video"
}
}
Success response (Video uplaod)
{
"message": "Media file uploaded successfully",
"code": 200,
"data": {
"media_id": 18,
"type": "Video",
"source": "An absolute URL of new uploded video file",
"poster": "An absolute URL of auto generated video thumbnail file"
}
}
Error responses
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
{
"code": 500,
"message": "Media file is missing or invalid",
"data": []
}
{
"code": 400,
"message": "Media file type is missing or invalid",
"data": []
}
{
"code": 400,
"message": "You cannot attach more than 10 images to a post",
"data": []
}
{
"code": 500,
"message": "An error occurred while processing your request. Please try again later.",
"data": []
}
Delete post media
Please use this (https://trendram.xyz/mobile_api/delete_post_media) API endpoint for deleteing post multimedia files
Post parameters
Field | Value | Remarks |
---|---|---|
session_id | Access token ID | E.g. de25cc16eb00960f076... |
type | Media file type (Image/Video) | E.g. image |
media_id | Media file ID | E.g. 45 |
Success response
{
"code": 200,
"data": [],
"message": "Media deleted successfully"
}
Error responses
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
{
"code": 400,
"message": "Media file type is missing or invalid",
"data": []
}
{
"code": 500,
"message": "An error occurred while processing your request. Please try again later.",
"data": []
}
Publish Post / Reply
Please use this (https://trendram.xyz/mobile_api/publish_post) API endpoint for pulishing port or it's reply
Post parameters
Field | Value | Remarks |
---|---|---|
session_id | Access token ID | E.g. de25cc16eb00960f076... |
post_text | Post text message (Max. 600 chars) | E.g. `Hello world!` |
thread_id | Thered int. ID | Required only for reply |
gif_src | Gif image source URL | Only if the post does not contain other media files (Video or Image) |
og_data | Extracted OG data from URL | Only if the post does not contain other media files (Video or Image or GIF) |
poll_data | Poll JSON data | Json array with poll option objects. E.g. [{"value": "Option 1"}, {"value": "Option 2"}, {..}] From 2 to 4 options |
privacy | Publication privacy settings (Ignored for replies to posts) | One of those values (everyone, followers, mentioned) |
Success response
{
"posts_total": 4048,
"data": {
"id": 13,
"user_id": 7,
"text": "video",
"type": "text",
"replys_count": "0",
"reposts_count": "0",
"likes_count": "0",
"status": "active",
"thread_id": 0,
"target": "publication",
"og_data": "",
"time": "just now",
"advertising": false,
"time_raw": "1605602544",
"og_text": "video",
"og_image": "statics/img/logo.png",
"url": "http://colibri.loc/thread/13",
"can_delete": true,
"media": [],
"is_owner": true,
"has_liked": false,
"has_saved": false,
"has_reposted": false,
"reply_to": {
"id": 7,
"url": "http://colibri.loc/@dan_kassing",
"avatar": "http://colibri.loc/upload/default/avatar.png",
"username": "@dan_kassing",
"name": "Dan Kassing",
"gender": "M",
"is_owner": true,
"thread_url": "http://colibri.loc/thread/36"
},
"offset_id": 13,
"owner":{
"id": 7,
"url": "http://colibri.loc/@dan_kassing",
"avatar": "http://colibri.loc/upload/default/avatar.png",
"username": "@dan_kassing",
"name": "Dan Kassing",
"verified": "2"
}
},
"code": 200,
"message": "Post published successfully"
}
Error responses
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
{
"code": 400,
"message": "Invalid data for publication. Please check your details",
"data": []
}
Change post privacy
Please use this (https://trendram.xyz/mobile_api/change_post_privacy) API endpoint for changing post privacy
You will need this endpoint if you want to change the privacy of the post, that is, the option "Who can reply"
However, keep in mind that this option is only available for Posts that do not have a parent chain. That is, the post should be the original post and not the answer.
Post parameters
Field | Value | Remarks |
---|---|---|
session_id | Access token ID | E.g. de25cc16eb00960f076... |
post_id | Publication int ID | E.g. 11 |
privacy | Publication privacy settings (Ignored for replies to posts) |
One of those values (everyone, followers, mentioned)
|
Success response
{
"code": 200,
"message": "Post privacy changed successfully",
"data": []
}
Error responses
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
{
"code": 400,
"message": "Post ID is missing or invalid. Please check your details",
"data": []
}