commit c2b999e1a500668570c801b7794fd0b5095c4059
parent 59baf94133f32923a9ff04254c6220b128727702
Author: MTRNord <mtrnord1@gmail.com>
Date: Wed, 18 Mar 2015 19:14:14 +0100
update Api
Diffstat:
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/core/api/v1/api.php b/core/api/v1/api.php
@@ -162,6 +162,7 @@ $app->get('/posts/:id', function($task_id) {
$response["createdAt"] = $result["created_at"];
echoRespnse(200, $response);
} else {
+ echo $response;
$response["error"] = true;
$response["message"] = "The requested resource doesn't exists";
echoRespnse(404, $response);
@@ -203,12 +204,12 @@ $app->get('/tasks', 'authenticate', function() {
/**
- * Creating new task in db
+ * Creating new Post in db
* method POST
* params - name
- * url - /post/
+ * url - /addpost/
*/
-$app->post('/post', 'authenticate', function() use ($app) {
+$app->addPost('/addpost', 'authenticate', function() use ($app) {
// check for required params
verifyRequiredParams(array('task'));
@@ -234,10 +235,10 @@ $app->post('/post', 'authenticate', function() use ($app) {
});
/**
- * Updating existing task
+ * Updating existing Post
* method PUT
* params task, status
- * url - /tasks/:id
+ * url - /posts/:id
*/
$app->put('/posts/:id', 'authenticate', function($task_id) use($app) {
// check for required params
@@ -265,9 +266,9 @@ $app->put('/posts/:id', 'authenticate', function($task_id) use($app) {
});
/**
- * Deleting task. Users can delete only their tasks
+ * Deleting Posts. Users can delete only their tasks
* method DELETE
- * url /tasks
+ * url /posts
*/
$app->delete('/posts/:id', 'authenticate', function($task_id) use($app) {
global $user_id;