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://YOUR-SITE.COM/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)

{
	"err_code": 0,
	"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)

{
	"err_code": 0,
	"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"
}

{
	"err_code": "invalid_media_file",
	"code": 500,
	"message": "Media file is missing or invalid",
	"data": []
}


{
	"err_code": "invalid_media_type",
	"code": 400,
	"message": "Media file type is missing or invalid",
	"data": []
}

{
	"err_code": "total_limit_exceeded",
	"code": 400,
	"message": "You cannot attach more than 10 images to a post",
	"data": []
}

{
	"err_code": "unknown_server_error",
	"code": 500,
	"message": "An error occurred while processing your request. Please try again later.",
	"data": []
}

Delete post media

Please use this (https://YOUR-SITE.COM/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,
    "valid": true,
    "data": [],
    "message": "Media deleted successfully"
}

Error responses

{
    "code": 401,
    "data": [],
    "message": "Unauthorized Access"
}

{
	"err_code": "invalid_media_type",
	"code": 400,
	"message": "Media file type is missing or invalid",
	"data": []
}

{
    "code": 500,
    "err_code": "unknown_server_error",
    "message": "An error occurred while processing your request. Please try again later.",
    "data": []
}

Publish Post / Reply

Please use this (https://YOUR-SITE.COM/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. image
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)

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,
	"err_code": "invalid_post_data",
	"message": "Invalid data for publication. Please check your details",
	"data": []
}