Blog API is a authenication based api
Request : POST
Body:
{
"username":"hasan",
"password":"khan"
}
Response:
{
"responseStatus": "SUCCESS",
"response": {
"username": "hasan",
"password": "khan"
}
}
Request : POST
Body:
{
"username":"hasan",
"password":"khan"
}
Response:
{
"responseStatus": "SUCCESS",
"response": {
"token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJtYWhpMSIsImV4cCI6MTYyMzA1NzYzOSwiaWF0IjoxNjIzMDM5NjM5fQ.JkztnEKU3Yp6JaYHUHw4afyIlivqFT1TP-2ctlW7x7BcJv3oB-PdOke90kfb4fCsBlOEuQJpyEoek989ZLvJyA"
}
}
Request : POST
Header:
Authorization: "Bearer {{token}}"
Body:
{"title":"Test title","body":"test body"}
NOTE: title and body are required and can not be empty.
Response:
{
"responseStatus": "SUCCESS",
"response": [
{
"id": 1,
"title": "Test title",
"body": "test body",
"author": "hasan",
"createdAt": 1623019961875
}
]
}
Request : POST
Header:
Authorization: "Bearer <your token here>"
Body:
{"title":"update Test title","body":"update test body"} // for updating both
Option: {"title":"update Test title"} // for updating title
Option: {"body":"update test body"} // for updating body
Response:
{
"responseStatus": "SUCCESS",
"response": {
"id": 2,
"title": "update Test title",
"body": "update test body",
"author": "hasan",
"createdAt": 1623020834461,
"updatedAt": 1623020844738
}
}
Request : GET
Header:
Authorization: "Barer <your token here>"
Response:
{
"responseStatus": "SUCCESS",
"response": "Deleted."
}