NAV navbar
logo

NodeRestApi Documentation

version v1
baseUri http://localhost:7010/{version}
protocols HTTP

Types

error

TYPE DEFINITION

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/api-doc/schemas/",
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "description": "Explanatory error message."
    }
  },
  "required": ["message"]
}

/auth


/register post

POST: /auth/register

Register user in the system


Possible Responses

200

Account confirmed successfully!


/register post

CURL EXAMPLE

curl -X POST "http://localhost:7010/{version}/auth/register" \
	-d @request_body

REQUEST BODY

{
  "email": "user@example.com",
  "name" : "John DOE",
  "username" : "jndoe",
  "password" : "p@ssword"
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/the-news/api-doc/schemas/",
  "type": "object",
  "properties": {
    "email": {
      "type": "string",
      "description": "User's email address",
      "format": "email"
    },
    "name" : {
      "type": "string",
      "description": "User's full name"
    },
     "username" : {
      "type": "string",
      "description": "User's unique username"
    },
    "password": {
      "type": "string",
      "description": "User's password",
      "minLength": 5
    }
  },
  "required": [ "email", "name", "username","password"]
}

RESPONSE BODY

200

{
  "message": "User registered successfully!"
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/the-news/api-doc/schemas/",
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "description": "Success message of the registration"
    }
  },
  "required": ["message"]
}


/account/confirm post

POST: /auth/account/confirm

Confirm the account of the new user registered Allowed roles: Guest.


Possible Responses

200

Account confirmed successfully!


/account/confirm post

CURL EXAMPLE

curl -X POST "http://localhost:7010/{version}/auth/account/confirm" \
	-d @request_body

REQUEST BODY

{
  "token": "$2a$08$k17epp5uIjryJzKVON67UuAHRGiPs5dvDMay71/EhOnO4sNnVGf2O"
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/api-doc/schemas/",
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "Token to validate the account of an user"
    }
  },
  "required": ["token"]
}

RESPONSE BODY

200

{
  "message": "Account confirmed successfully!"
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/the-news/api-doc/schemas/",
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "description": "Success message of the account's confirmation"
    }
  },
  "required": ["message"]
}


/login post

POST: /auth/login

Proceed a user authentication in order to get an access token for secured requests. Allowed roles: Guest.


Possible Responses

200

The user has been authenticated.


/login post

CURL EXAMPLE

curl -X POST "http://localhost:7010/{version}/auth/login" \
	-d @request_body

REQUEST BODY

{
  "email": "user@example.com",
  "password": "p@ssw0rd"
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/api-doc/schemas/",
  "type": "object",
  "properties": {
    "email": {
      "type": "string",
      "description": "Email address of the user",
      "format": "email"
    },
    "password": {
      "type": "string",
      "description": "Password of the user"
    }
  },
  "required": ["email", "password"]
}

RESPONSE BODY

200

{
  "expiresIn": 86400,
  "token": "eyJOeXAioiJKV1QiLAOKICJhbGcioiJIUzI1NiJ9.eyJpc3MioiJqb2UiLA0KICJleHAiojEzMDA4MTkz0DAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
  
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/api-doc/schemas/",
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "JWT Access token for secured requests."
    },
    "expiresIn": {
      "type": "number",
      "description": "Time to live of the token in second"
    }
  },
  "required": ["token", "expiresIn"]
}


/password/forgot post

POST: /auth/password/forgot

Ask for password resetting Allowed roles: Guest.


Possible Responses

200

Email containing the reset link sent successfully


/password/forgot post

CURL EXAMPLE

curl -X POST "http://localhost:7010/{version}/auth/password/forgot" \
	-d @request_body

REQUEST BODY

{
  "email": "user@example.com"
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/api-doc/schemas/",
  "type": "object",
  "properties": {
    "email": {
      "type": "string",
      "description": "User email address.",
      "format": "email"
    }
  },
  "required": ["email"]
}

RESPONSE BODY

200

{
  "message": "Kindly check your email for further instructions"
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/the-news/api-doc/schemas/",
  "type": "object",
  "properties": {
     "message": {
      "type": "string"
    }   
  },
  "required": [ "message"]
}


/password/reset post

POST: /auth/password/reset

Reset the password of the user Allowed roles: Guest.


Possible Responses

200

The password resetted successfully


/password/reset post

CURL EXAMPLE

curl -X POST "http://localhost:7010/{version}/auth/password/reset" \
	-d @request_body

REQUEST BODY

{
  "password": "p@ssw0rd",
  "email_token": "$2a$08$k17epp5uIjryJzKVON67UuAHRGiPs5dvDMay71/EhOnO4sNnVGf2O"
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/api-doc/schemas/",
  "type": "object",
  "properties": {
    "email_token": {
      "type": "string",
      "description": "User email token."
    },
    "password": {
      "type": "string",
      "description": "The new password of the user."
    }
  },
  "required": ["email_token", "password"]
}

RESPONSE BODY

200

{
  "message": "password has been reset."
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/the-news/api-doc/schemas/",
  "type": "object",
  "properties": {
     "message": {
      "type": "string",
       "description": "Success message of the password resetting"
    }   
  },
  "required": [ "message"]
}

/users


/users get

GET: /users (secured)

Retrieve a list of users.


Query Parameters

before

The value of the before cursor.

PropertyValue
requiredtrue
typestring

after

The value of the after cursor.

PropertyValue
requiredtrue
typestring

limit

Maximum number of item in the result set.

PropertyValue
requiredtrue
typeinteger

Possible Responses

200

A list of users.

400

The request completion failed. The description should provide detailed explanation of the reason.

403

The request is forbidden due to missing permissions.

404

The request URI does not match a resource in the API or Resource item not found.

422

The request is forbidden due to missing permissions.

500

A server internal prevents the error to complete.


/users get

CURL EXAMPLE

curl -X GET "http://localhost:7010/{version}/users" \
	-H "x-access-token: eyJOeXAioiJKV1QiLAOKICJhbGcioiJIUzI1NiJ9.eyJpc3MioiJqb2UiLA0KICJleHAiojEzMDA4MTkz0DAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
"

RESPONSE BODY

200

[
    {
      "_id": "5d31d9d0fd4fc002e68d8f93",
      "name" : "John DOE",
      "username" : "jndoe",
      "email" : "user@example.com",
      "gender": "M",
      "confirmed": true,
      "avatar": "https://api.starter.com/uploads/1557234445-user.png"
    },
    {
      "_id": "5caa22a898eb5b14af3e93ec",
      "name" : "Alice BOB",
      "username" : "alibob",
      "email" : "alibob@example.com",
      "gender": "F",
      "confirmed": true,
      "avatar": "https://api.starter.com/uploads/1557398373-user.png"
    }
]
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
   "id": "http://localhost/api-doc/schemas/",
    "type": "array",
    "description": "The list of users.",
    "items": {
      "type": "object",
      "properties": {
         "_id" : {
          "type": "string",
          "description": "User id"
        },
         "name": {
          "type": "string",
          "description": "User name"
        },
        "username" : {
          "type": "string",
          "description": "User name"
        },
         "email" : {
          "type": "string",
          "description": "User email address",
          "format": "email"
        },
        "gender": {
          "type": "string",
          "description": "User gender"
        },
        "confirmed": {
          "type": "boolean",
          "description": "Indciates if account is confirmed or not"
        },
        "avatar": {
          "type": "string",
          "description": "Path of the picture the user"
        }
      },
     "required": [ "_id", "name", "username", "email", "gender", "confirmed", "avatar"]
    }
    
}


/{id} put

PUT: /users/{id} (secured)

Update user info. Allowed roles: Member (owner).


URI Parameters

id

PropertyValue
requiredtrue
typestring

Possible Responses

200

The user info have been updated.

400

The request completion failed. The description should provide detailed explanation of the reason.

403

The request is forbidden due to missing permissions.

404

The request URI does not match a resource in the API or Resource item not found.

422

The request is forbidden due to missing permissions.

500

A server internal prevents the error to complete.


/{id} put

CURL EXAMPLE

curl -X PUT "http://localhost:7010/{version}/users/{id}" \
	-H "x-access-token: eyJOeXAioiJKV1QiLAOKICJhbGcioiJIUzI1NiJ9.eyJpc3MioiJqb2UiLA0KICJleHAiojEzMDA4MTkz0DAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
" \
	-d @request_body

REQUEST BODY

{
  "name": "Petyr Baelish",
  "username": "petblish"
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
   "id": "http://localhost/the-news/api-doc/schemas/",
  "type": "object",
  "properties": {
    "name" : {
      "type": "string",
      "description": "User name"
    },
    "username": {
      "type": "string",
      "description": "User unique username"
    }
  }
}

RESPONSE BODY

200

{
  "_id": "5d31d9d0fd4fc002e68d8f93",
  "name" : "John DOE",
  "username" : "jndoe",
  "email" : "user@example.com",
  "gender": "M",
  "confirmed": true,
  "avatar": null
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/the-news/api-doc/schemas/",
  "type": "object",
  "properties": {
    "_id": {
      "type": "string",
      "description": "User id"
    },
    "email": {
      "type": "string",
      "description": "User email address",
      "format": "email"
    },
    "name" : {
      "type": "string",
      "description": "User name"
    },
    "username" : {
      "type": "string",
      "description": "User name"
    },
    "gender": {
      "type": "string",
      "description": "User gender"
    },
    "confirmed": {
      "type": "boolean",
      "description": "Indciates if account is confirmed or not"
    },
    "avatar": {
      "type": "null",
      "description": "Path of the picture the user"
     }
  },
  "required": [ "_id", "email", "name", "username", "gender", "confirmed", "avatar"]
}

/{id} get

GET: /users/{id} (secured)

Retrieve a given user. Allowed roles: Member (Owner).


URI Parameters

id

PropertyValue
requiredtrue
typestring

Possible Responses

200

The user.

400

The request completion failed. The description should provide detailed explanation of the reason.

403

The request is forbidden due to missing permissions.

404

The request URI does not match a resource in the API or Resource item not found.

422

The request is forbidden due to missing permissions.

500

A server internal prevents the error to complete.


/{id} get

CURL EXAMPLE

curl -X GET "http://localhost:7010/{version}/users/{id}" \
	-H "x-access-token: eyJOeXAioiJKV1QiLAOKICJhbGcioiJIUzI1NiJ9.eyJpc3MioiJqb2UiLA0KICJleHAiojEzMDA4MTkz0DAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
"

RESPONSE BODY

200

{
  "_id": "5d31d9d0fd4fc002e68d8f93",
  "name" : "John DOE",
  "username" : "jndoe",
  "email" : "user@example.com",
  "gender": "M",
  "confirmed": true,
  "avatar": null
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/the-news/api-doc/schemas/",
  "type": "object",
  "properties": {
    "_id": {
      "type": "string",
      "description": "User id"
    },
    "email": {
      "type": "string",
      "description": "User email address",
      "format": "email"
    },
    "name" : {
      "type": "string",
      "description": "User name"
    },
    "username" : {
      "type": "string",
      "description": "User name"
    },
    "gender": {
      "type": "string",
      "description": "User gender"
    },
    "confirmed": {
      "type": "boolean",
      "description": "Indciates if account is confirmed or not"
    },
    "avatar": {
      "type": "null",
      "description": "Path of the picture the user"
     }
  },
  "required": [ "_id", "email", "name", "username", "gender", "confirmed", "avatar"]
}

/{id} delete

DELETE: /users/{id} (secured)

Delete a given user. Allowed roles: Member (Owner).


URI Parameters

id

PropertyValue
requiredtrue
typestring

Possible Responses

200

The user.

400

The request completion failed. The description should provide detailed explanation of the reason.

403

The request is forbidden due to missing permissions.

404

The request URI does not match a resource in the API or Resource item not found.

422

The request is forbidden due to missing permissions.

500

A server internal prevents the error to complete.


/{id} delete

CURL EXAMPLE

curl -X DELETE "http://localhost:7010/{version}/users/{id}" \
	-H "x-access-token: eyJOeXAioiJKV1QiLAOKICJhbGcioiJIUzI1NiJ9.eyJpc3MioiJqb2UiLA0KICJleHAiojEzMDA4MTkz0DAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
"

RESPONSE BODY

200

{
  "message": " Element successfully deleted !"
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/the-news/api-doc/schemas/",
  "type": "object",
  "properties": {
     "message": {
      "type": "string"
    }   
  },
  "required": [ "message"]
}


/password put

PUT: /users/password (secured)

Update user password. Allowed roles: Member (owner).


Possible Responses

200

The user password have been updated.

400

The request completion failed. The description should provide detailed explanation of the reason.

403

The request is forbidden due to missing permissions.

404

The request URI does not match a resource in the API or Resource item not found.

422

The request is forbidden due to missing permissions.

500

A server internal prevents the error to complete.


/password put

CURL EXAMPLE

curl -X PUT "http://localhost:7010/{version}/users/password" \
	-H "x-access-token: eyJOeXAioiJKV1QiLAOKICJhbGcioiJIUzI1NiJ9.eyJpc3MioiJqb2UiLA0KICJleHAiojEzMDA4MTkz0DAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
" \
	-d @request_body

REQUEST BODY

{
  "uid": "5caa230498eb5b14af3e93ed",
  "password": "Qw3rTy$",
  "new_password": "@z3rTy$"
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
   "id": "http://localhost/the-news/api-doc/schemas/",
  "type": "object",
  "properties": {
    "uid" : {
      "type": "string",
      "description": "User unique ID"
    },
    "password": {
      "type": "string",
      "description": "The current password of the user"
    },
    "new_password": {
      "type": "string",
      "description": "The new password of the user"
    }
  }
}

RESPONSE BODY

200

{
  "_id": "5d31d9d0fd4fc002e68d8f93",
  "name" : "John DOE",
  "username" : "jndoe",
  "email" : "user@example.com",
  "gender": "M",
  "confirmed": true,
  "avatar": null
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/the-news/api-doc/schemas/",
  "type": "object",
  "properties": {
    "_id": {
      "type": "string",
      "description": "User id"
    },
    "email": {
      "type": "string",
      "description": "User email address",
      "format": "email"
    },
    "name" : {
      "type": "string",
      "description": "User name"
    },
    "username" : {
      "type": "string",
      "description": "User name"
    },
    "gender": {
      "type": "string",
      "description": "User gender"
    },
    "confirmed": {
      "type": "boolean",
      "description": "Indciates if account is confirmed or not"
    },
    "avatar": {
      "type": "null",
      "description": "Path of the picture the user"
     }
  },
  "required": [ "_id", "email", "name", "username", "gender", "confirmed", "avatar"]
}


/me get

GET: /users/me (secured)

Retrieve authenticated user. Allowed roles: Member (Owner).


Possible Responses

200

Authenticated user retrieved successfully.

400

The request completion failed. The description should provide detailed explanation of the reason.

403

The request is forbidden due to missing permissions.

404

The request URI does not match a resource in the API or Resource item not found.

422

The request is forbidden due to missing permissions.

500

A server internal prevents the error to complete.


/me get

CURL EXAMPLE

curl -X GET "http://localhost:7010/{version}/users/me" \
	-H "x-access-token: eyJOeXAioiJKV1QiLAOKICJhbGcioiJIUzI1NiJ9.eyJpc3MioiJqb2UiLA0KICJleHAiojEzMDA4MTkz0DAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
"

RESPONSE BODY

200

{
  "_id": "5d31d9d0fd4fc002e68d8f93",
  "name" : "John DOE",
  "username" : "jndoe",
  "email" : "user@example.com",
  "gender": "M",
  "confirmed": true,
  "avatar": null
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/the-news/api-doc/schemas/",
  "type": "object",
  "properties": {
    "_id": {
      "type": "string",
      "description": "User id"
    },
    "email": {
      "type": "string",
      "description": "User email address",
      "format": "email"
    },
    "name" : {
      "type": "string",
      "description": "User name"
    },
    "username" : {
      "type": "string",
      "description": "User name"
    },
    "gender": {
      "type": "string",
      "description": "User gender"
    },
    "confirmed": {
      "type": "boolean",
      "description": "Indciates if account is confirmed or not"
    },
    "avatar": {
      "type": "null",
      "description": "Path of the picture the user"
     }
  },
  "required": [ "_id", "email", "name", "username", "gender", "confirmed", "avatar"]
}

/tasks


/tasks get

GET: /tasks (secured)

Retrieve a list of tasks.


Query Parameters

before

The value of the before cursor.

PropertyValue
requiredtrue
typestring

after

The value of the after cursor.

PropertyValue
requiredtrue
typestring

limit

Maximum number of item in the result set.

PropertyValue
requiredtrue
typeinteger

Possible Responses

200

A list of tasks.

400

The request completion failed. The description should provide detailed explanation of the reason.

403

The request is forbidden due to missing permissions.

404

The request URI does not match a resource in the API or Resource item not found.

422

The request is forbidden due to missing permissions.

500

A server internal prevents the error to complete.


/tasks get

CURL EXAMPLE

curl -X GET "http://localhost:7010/{version}/tasks" \
	-H "x-access-token: eyJOeXAioiJKV1QiLAOKICJhbGcioiJIUzI1NiJ9.eyJpc3MioiJqb2UiLA0KICJleHAiojEzMDA4MTkz0DAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
"

RESPONSE BODY

200

[
    {
      "_id": "5d31c351df1c9dfd93d25786",
      "title": "Test Application",
      "description": "QA testing on the whole application",
      "status": "Pending",
      "date": "2019-05-30 09:30:00",
      "is_important": true,
      "user": "5cee861d04d9f4214dc8dce6",
      "created_at": "2019-07-19 14:19:13.463",
      "updated_at": "2019-07-19 14:19:13.463"
    },
    {
      "_id": "5caa22a898eb5b14af3e93ec",
      "title": "Learn a Tutorial",
      "description": "Learn tutorial on microservice architectures",
      "status": "Completed",
      "date": "2019-05-30 09:30:00",
      "is_important": false,
      "user": "5cee861d04d9f4214dc8dce6",
      "created_at": "2019-07-19 14:19:13.463",
      "updated_at": "2019-07-19 14:19:13.463"
    }
]
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
   "id": "http://localhost/api-doc/schemas/",
    "type": "array",
    "description": "The list of task.",
    "items": {
      "type": "object",
      "properties": {
         "_id": {
          "type": "string",
          "description": "ID of the task"
        },
        "title": {
          "type": "string",
          "description": "Task title"
        },
        "description" : {
          "type": "string",
          "description": "Task description"
        },
         "status" : {
          "type": "string",
           "description": "Task status. Possible value: `Pending`, `Completed`, ``"
        },
        "date": {
          "type": "string",
          "description": "Time to execute the task"
        },
        "is_important": {
          "type": "boolean",
          "description": "Indicate the task importance"
        },
        "user": {
          "type": "string",
          "description": "Id of the creator of the task"
        },
        "created_at": {
          "type": "string",
          "description": "Task creation date"
        },
        "updated_at": {
          "type": "string",
          "description": "Task update date"
        }
      },
     "required": [ "_id", "title", "description", "status", "date", "is_important", "user", "created_at", "updated_at" ]
    }
    
}


/create post

POST: /tasks/create (secured)

Create a new task


Possible Responses

200

The task created successfully!

400

The request completion failed. The description should provide detailed explanation of the reason.

403

The request is forbidden due to missing permissions.

404

The request URI does not match a resource in the API or Resource item not found.

422

The request is forbidden due to missing permissions.

500

A server internal prevents the error to complete.


/create post

CURL EXAMPLE

curl -X POST "http://localhost:7010/{version}/tasks/create" \
	-H "x-access-token: eyJOeXAioiJKV1QiLAOKICJhbGcioiJIUzI1NiJ9.eyJpc3MioiJqb2UiLA0KICJleHAiojEzMDA4MTkz0DAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
" \
	-d @request_body

REQUEST BODY

{
	  "title": "Test Application",
	  "description": "QA testing on the whole application",
	  "status": "Pending",
	  "date": "2019-05-30 09:30:00",
	  "is_important": true,
	  "user": "5cee861d04d9f4214dc8dce6"
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/the-news/api-doc/schemas/",
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "description": "Task title"
    },
    "description" : {
      "type": "string",
      "description": "Task description"
    },
     "status" : {
      "type": "string",
       "description": "Task status. Possible value: `Pending`, `Completed`, ``"
    },
    "date": {
      "type": "string",
      "description": "Time to execute the task"
    },
    "is_important": {
      "type": "boolean",
      "description": "Indicate the task importance"
    },
    "user": {
      "type": "string",
      "description": "Id of the creator of the task"
    }
  },
  "required": [ "title", "description", "status", "date", "is_important", "user"]
}

RESPONSE BODY

200

{
  "_id": "5d31c351df1c9dfd93d25786",
	  "title": "Test Application",
	  "description": "QA testing on the whole application",
	  "status": "Pending",
	  "date": "2019-05-30 09:30:00",
	  "is_important": true,
	  "user": "5cee861d04d9f4214dc8dce6",
  "created_at": "2019-07-19 14:19:13.463",
  "updated_at": "2019-07-19 14:19:13.463"
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/the-news/api-doc/schemas/",
  "type": "object",
  "properties": {
    "_id": {
      "type": "string",
      "description": "ID of the task"
    },
    "title": {
      "type": "string",
      "description": "Task title"
    },
    "description" : {
      "type": "string",
      "description": "Task description"
    },
     "status" : {
      "type": "string",
       "description": "Task status. Possible value: `Pending`, `Completed`, ``"
    },
    "date": {
      "type": "string",
      "description": "Time to execute the task"
    },
    "is_important": {
      "type": "boolean",
      "description": "Indicate the task importance"
    },
    "user": {
      "type": "string",
      "description": "Id of the creator of the task"
    },
    "created_at": {
      "type": "string",
      "description": "Task creation date"
    },
    "updated_at": {
      "type": "string",
      "description": "Task update date"
    }
  },
  "required": [ "_id", "title", "description", "status", "date", "is_important", "user", "created_at", "updated_at" ]
}


/{id} put

PUT: /tasks/{id} (secured)

Update a task


URI Parameters

id

PropertyValue
requiredtrue
typestring

Possible Responses

200

The task upated successfully!

400

The request completion failed. The description should provide detailed explanation of the reason.

403

The request is forbidden due to missing permissions.

404

The request URI does not match a resource in the API or Resource item not found.

422

The request is forbidden due to missing permissions.

500

A server internal prevents the error to complete.


/{id} put

CURL EXAMPLE

curl -X PUT "http://localhost:7010/{version}/tasks/{id}" \
	-H "x-access-token: eyJOeXAioiJKV1QiLAOKICJhbGcioiJIUzI1NiJ9.eyJpc3MioiJqb2UiLA0KICJleHAiojEzMDA4MTkz0DAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
" \
	-d @request_body

REQUEST BODY

{
	  "title": "Test Application",
	  "description": "QA testing on the whole application",
	  "status": "Completed",
	  "date": "2019-05-30 09:30:00",
	  "is_important": false
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/the-news/api-doc/schemas/",
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "description": "Task title"
    },
    "description" : {
      "type": "string",
      "description": "Task description"
    },
     "status" : {
      "type": "string",
       "description": "Task status. Possible value: `Pending`, `Completed`, ``"
    },
    "date": {
      "type": "string",
      "description": "Time to execute the task"
    },
    "is_important": {
      "type": "boolean",
      "description": "Indicate the task importance"
    }
  }
}

RESPONSE BODY

200

{
  "_id": "5d31c351df1c9dfd93d25786",
	  "title": "Test Application",
	  "description": "QA testing on the whole application",
	  "status": "Pending",
	  "date": "2019-05-30 09:30:00",
	  "is_important": true,
	  "user": "5cee861d04d9f4214dc8dce6",
  "created_at": "2019-07-19 14:19:13.463",
  "updated_at": "2019-07-19 14:19:13.463"
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/the-news/api-doc/schemas/",
  "type": "object",
  "properties": {
    "_id": {
      "type": "string",
      "description": "ID of the task"
    },
    "title": {
      "type": "string",
      "description": "Task title"
    },
    "description" : {
      "type": "string",
      "description": "Task description"
    },
     "status" : {
      "type": "string",
       "description": "Task status. Possible value: `Pending`, `Completed`, ``"
    },
    "date": {
      "type": "string",
      "description": "Time to execute the task"
    },
    "is_important": {
      "type": "boolean",
      "description": "Indicate the task importance"
    },
    "user": {
      "type": "string",
      "description": "Id of the creator of the task"
    },
    "created_at": {
      "type": "string",
      "description": "Task creation date"
    },
    "updated_at": {
      "type": "string",
      "description": "Task update date"
    }
  },
  "required": [ "_id", "title", "description", "status", "date", "is_important", "user", "created_at", "updated_at" ]
}

/{id} delete

DELETE: /tasks/{id} (secured)

Delete a task


URI Parameters

id

PropertyValue
requiredtrue
typestring

Possible Responses

200

The task deleted successfully!

400

The request completion failed. The description should provide detailed explanation of the reason.

403

The request is forbidden due to missing permissions.

404

The request URI does not match a resource in the API or Resource item not found.

422

The request is forbidden due to missing permissions.

500

A server internal prevents the error to complete.


/{id} delete

CURL EXAMPLE

curl -X DELETE "http://localhost:7010/{version}/tasks/{id}" \
	-H "x-access-token: eyJOeXAioiJKV1QiLAOKICJhbGcioiJIUzI1NiJ9.eyJpc3MioiJqb2UiLA0KICJleHAiojEzMDA4MTkz0DAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
"

RESPONSE BODY

200

{
  "message": "Task deleted successfully!"
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/the-news/api-doc/schemas/",
  "type": "object",
  "properties": {
     "message": {
      "type": "string"
    }   
  },
  "required": [ "message"]
}

/{id} get

GET: /tasks/{id} (secured)

Get one task


URI Parameters

id

PropertyValue
requiredtrue
typestring

Possible Responses

200

The task fetched successfully!

400

The request completion failed. The description should provide detailed explanation of the reason.

403

The request is forbidden due to missing permissions.

404

The request URI does not match a resource in the API or Resource item not found.

422

The request is forbidden due to missing permissions.

500

A server internal prevents the error to complete.


/{id} get

CURL EXAMPLE

curl -X GET "http://localhost:7010/{version}/tasks/{id}" \
	-H "x-access-token: eyJOeXAioiJKV1QiLAOKICJhbGcioiJIUzI1NiJ9.eyJpc3MioiJqb2UiLA0KICJleHAiojEzMDA4MTkz0DAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
"

RESPONSE BODY

200

{
  "_id": "5d31c351df1c9dfd93d25786",
	  "title": "Test Application",
	  "description": "QA testing on the whole application",
	  "status": "Pending",
	  "date": "2019-05-30 09:30:00",
	  "is_important": true,
	  "user": "5cee861d04d9f4214dc8dce6",
  "created_at": "2019-07-19 14:19:13.463",
  "updated_at": "2019-07-19 14:19:13.463"
}
Type
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://localhost/the-news/api-doc/schemas/",
  "type": "object",
  "properties": {
    "_id": {
      "type": "string",
      "description": "ID of the task"
    },
    "title": {
      "type": "string",
      "description": "Task title"
    },
    "description" : {
      "type": "string",
      "description": "Task description"
    },
     "status" : {
      "type": "string",
       "description": "Task status. Possible value: `Pending`, `Completed`, ``"
    },
    "date": {
      "type": "string",
      "description": "Time to execute the task"
    },
    "is_important": {
      "type": "boolean",
      "description": "Indicate the task importance"
    },
    "user": {
      "type": "string",
      "description": "Id of the creator of the task"
    },
    "created_at": {
      "type": "string",
      "description": "Task creation date"
    },
    "updated_at": {
      "type": "string",
      "description": "Task update date"
    }
  },
  "required": [ "_id", "title", "description", "status", "date", "is_important", "user", "created_at", "updated_at" ]
}