From ce593b5a5c58b451d2c15a9220d8d883fb52312d Mon Sep 17 00:00:00 2001 From: Pierre Date: Tue, 16 Jan 2018 07:00:13 +0100 Subject: [PATCH] Can get informations about a single post --- RestControllers/postsController.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/RestControllers/postsController.php b/RestControllers/postsController.php index 53bdb94..74b18b5 100644 --- a/RestControllers/postsController.php +++ b/RestControllers/postsController.php @@ -69,6 +69,28 @@ class postsController { return $posts; } + /** + * Get informations about a single post + * + * @url POST /posts/get_single + */ + public function get_single_post(){ + + //Get the post ID + $postID = getPostPostIDWithAccess("postID"); + + //Get informations about the post + $postInfos = components()->posts->get_single($postID, true); + + //Check for errors + if(count($postInfos) == 0) + Rest_fatal_error(500, "Couldn't retrieve post informations !"); + + //Return informations about the post + return $postInfos; + + } + /** * Create a post *