View file api_docs/endpoints/thread_data/includes/fetch-data.phtml

File size: 4.51Kb
<div class="content__inner">
	<h2>Fetch thread data</h2>
	<p>
	    Please use this <strong>(<?php echo cl_link("mobile_api/thread_data"); ?>)</strong> API for accessing endpoint of post thread data
	</p>
	<h3>
		Description of the data structure
	</h3>
	<br>

	<p>
		1. The `post` variable contains the post data of the thread (The main post on the thread page)
	</p>
	<p>
		2. The variable `next` contains the responses to the thread (Each post data in this array can also contain `replys` variable with first few replys to it)
	</p>
	<p>
		3. A variable named `prev` contains the parent chain of the current thread (Only if there are parent posts)
	</p>
	<p>
		4. If the variable `can_reply` has a value (false), it means that the current user cannot reply to this post
	</p>
	<h4 class="table-title">GET parameters</h4>
	<table class="table table-bordered">
	    <thead>
	    <tr>
	        <th width="15%">Field</th>
	        <th width="25%">Value</th>
	        <th width="45%">Remarks</th>
	    </tr>
	    </thead>
	    <tbody>
	        <tr>
	            <td>session_id</td>
	            <td>​Access token ID</td>
	            <td>
	                E.g. de25cc16eb00960f076...
	            </td>
	        </tr>
	        <tr>
	            <td>thread_id</td>
	            <td>Thread int ID</td>
	            <td>
	                E.g. 123456 (ID of any post to view replies and all details)
	            </td>
	        </tr>
	    </tbody>
	</table>
	<h4 class="table-title">Success response</h4>
	<div class="code-holder">
	    <div class="code-holder-inner">
	<pre><code class="json">{
		"code": 200,
		"data": {
			"can_reply": true,
			"post":{
				"id": 41,
				"user_id": 7,
				"text": "werwe",
				"type": "text",
				"replys_count": "1",
				"reposts_count": "0",
				"likes_count": "0",
				"status": "active",
				"thread_id": 40,
				"target": "pub_reply",
				"og_data": "",
				"time": "24 seconds ago",
				"advertising": false,
				"time_raw": "1605613164",
				"og_text": "werwe",
				"og_image": "statics/img/logo.png",
				"url": "http://colibri.loc/thread/41",
				"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",…},
				"owner":{"id": 7, "url": "http://colibri.loc/@dan_kassing", "avatar": "http://colibri.loc/upload/default/avatar.png",…},
				"offset_id": 41
			},
			"next":[
				{
					"id": 42,
					"user_id": 7,
					"text": "werwe",
					"type": "text",
					"replys_count": "0",
					"reposts_count": "0",
					"likes_count": "0",
					"status": "active",
					"thread_id": 41,
					"target": "pub_reply",
					"og_data": "",
					"time": "18 seconds ago",
					"replys":[],
					"advertising": false,
					"time_raw": "1605613170",
					"og_text": "werwe",
					"og_image": "statics/img/logo.png",
					"url": "http://colibri.loc/thread/42",
					"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",…},
					"owner":{"id": 7, "url": "http://colibri.loc/@dan_kassing", "avatar": "http://colibri.loc/upload/default/avatar.png",…},
					"offset_id": 42
				}
			],
			"prev":[
				{
					"id": 40,
					"user_id": 7,
					"text": "erter",
					"type": "text",
					"replys_count": "1",
					"reposts_count": "0",
					"likes_count": "0",
					"status": "active",
					"thread_id": 0,
					"target": "publication",
					"og_data": "",
					"time": "28 minutes ago",
					"advertising": false,
					"time_raw": "1605611503",
					"og_text": "erter",
					"og_image": "statics/img/logo.png",
					"url": "http://colibri.loc/thread/40",
					"can_delete": true,
					"media":[],
					"is_owner": true,
					"has_liked": false,
					"has_saved": false,
					"has_reposted": false,
					"reply_to":[],
					"owner":{"id": 7, "url": "http://colibri.loc/@dan_kassing", "avatar": "http://colibri.loc/upload/default/avatar.png",…},
					"offset_id": 40
				}
			]
		}
	}
	</code></pre>
	    </div>
	</div>
	<h4 class="table-title">Error responses</h4>
	<div class="code-holder">
	    <div class="code-holder-inner">
	<pre><code class="json">{
	    "code": 401,
	    "data": [],
	    "message": "Unauthorized Access"
	}

	{
		"code": 400,
		"message": "Thread ID is missing or invalid. Please check your details",
		"data": []
	}
	</code></pre>
	    </div>
	</div>
</div>