This is a simple blogging service provide REST API for consumer to build their own blogging platform on demand.
Key | Value | Type |
---|---|---|
blog-server | www.blog-api.com | string |
username | user | string |
password | pass | string |
limit | 20 | string |
Users
directory contains all the user related APIs. For authentication these apis requrie BasicAuth
Create user use JSON
payload to create a user
Endpoint:
Method: POST
Type: RAW
URL: {{blog-server}}/v1/users
Body:
{
"name": "Captain Jack Sparrow",
"bio": "Captain Jack Sparrow is a fictional character and the main protagonist of the Pirates of the Caribbean film series. The character was created by screenwriters Ted Elliott and Terry Rossio and is portrayed by Johnny Depp"
}
More example Requests/Responses:
{
"message": "Unauthorized attempt"
}
Status Code: 401
{
"message": "Invalid request body"
}
Status Code: 400
Body:
{
"name": "",
"bio": ""
}
{
"errors": {
"bio": [
"Bio can not be empty"
],
"name": [
"Name can not be empty"
]
},
"message": "Validation error"
}
Status Code: 422
Body:
{
"name": "Tom Hanks",
"bio": "Thomas Jeffrey Hanks is an American actor and filmmaker. Known for both his comedic and dramatic roles, Hanks is one of the most popular and recognizable film stars worldwide, and is widely regarded as an American cultural icon."
}
{
"data": {
"id": 1,
"name": "Tom Hanks",
"bio": "Thomas Jeffrey Hanks is an American actor and filmmaker. Known for both his comedic and dramatic roles, Hanks is one of the most popular and recognizable film stars worldwide, and is widely regarded as an American cultural icon."
},
"message": "User created successfully"
}
Status Code: 201
Fetch a single user using id
Endpoint:
Method: GET
Type:
URL: {{blog-server}}/v1/users/{{id}}
More example Requests/Responses:
{
"data": {
"id": 1,
"name": "Tom Hanks",
"bio": "Thomas Jeffrey Hanks is an American actor and filmmaker. Known for both his comedic and dramatic roles, Hanks is one of the most popular and recognizable film stars worldwide, and is widely regarded as an American cultural icon."
}
}
Status Code: 200
{
"message": "Invalid user id"
}
Status Code: 400
{
"message": "Unauthorized attempt"
}
Status Code: 401
Fetch list of users using pagination
Endpoint:
Method: GET
Type:
URL: {{blog-server}}/v1/users
Query params:
Key | Value | Description |
---|---|---|
page | 1 | |
limit | 20 |
More example Requests/Responses:
Query:
Key | Value | Description |
---|---|---|
page | 1 | Page numer is a integer which represents the page your are requesting |
limit | 20 | Limit it the maximum number of users listing in the result. |
{
"data": [
{
"id": 1,
"name": "Tom Hanks",
"bio": "Thomas Jeffrey Hanks is an American actor and filmmaker. Known for both his comedic and dramatic roles, Hanks is one of the most popular and recognizable film stars worldwide, and is widely regarded as an American cultural icon."
},
{
"id": 2,
"name": "Captain Jack Sparrow",
"bio": "Captain Jack Sparrow is a fictional character and the main protagonist of the Pirates of the Caribbean film series. The character was created by screenwriters Ted Elliott and Terry Rossio and is portrayed by Johnny Depp"
}
]
}
Status Code: 200
{
"message": "Invalid user id"
}
Status Code: 400
{
"message": "Unauthorized attempt"
}
Status Code: 401
Update user use JSON
payload to create a user
Endpoint:
Method: PUT
Type: RAW
URL: {{blog-server}}/v1/users/{{id}}
Body:
{
"name": "Captain Jack Sparrow",
"bio": "Captain Jack Sparrow is a fictional character and the main protagonist of the Pirates of the Caribbean film series. The character was created by screenwriters Ted Elliott and Terry Rossio and is portrayed by Johnny Depp"
}
More example Requests/Responses:
Body:
{
"name": "Captain Jack Sparrow",
"bio": "Captain Jack Sparrow is a fictional character and the main protagonist of the Pirates of the Caribbean film series. The character was created by screenwriters Ted Elliott and Terry Rossio and is portrayed by Johnny Depp"
}
{
"data": {
"id": 1,
"name": "Captain Jack Sparrow",
"bio": "Captain Jack Sparrow is a fictional character and the main protagonist of the Pirates of the Caribbean film series. The character was created by screenwriters Ted Elliott and Terry Rossio and is portrayed by Johnny Depp"
},
"message": "User updated successfully"
}
Status Code: 200
Body:
{
"name": "",
"bio": ""
}
{
"errors": {
"bio": [
"Bio can not be empty"
],
"name": [
"Name can not be empty"
]
},
"message": "Validation error"
}
Status Code: 422
{
"message": "Invalid request body"
}
Status Code: 400
{
"message": "Unauthorized attempt"
}
Status Code: 401
Body:
{
"name": "Captain Jack Sparrow",
"bio": "Captain Jack Sparrow is a fictional character and the main protagonist of the Pirates of the Caribbean film series. The character was created by screenwriters Ted Elliott and Terry Rossio and is portrayed by Johnny Depp"
}
{
"message": "Invalid user id"
}
Status Code: 400
Delete a single user using id
Endpoint:
Method: DELETE
Type:
URL: {{blog-server}}/v1/users/{{id}}
More example Requests/Responses:
{
"message": "User deleted successfully"
}
Status Code: 200
{
"message": "Invalid user id"
}
Status Code: 400
{
"message": "Unauthorized attempt"
}
Status Code: 401
Articles
directory contains all the article related APIs. Use JWT
toekn for authentications for articles API.
Create article endpoint is accept form-data to create an article with binary data like file
Endpoint:
Method: POST
Type: FORMDATA
URL: {{blog-server}}/v1/articles
Headers:
Key | Value | Description |
---|---|---|
ExampleHeader1 | ExampleHeader1Value | |
ExampleHeader2 | ExampleHeader2Value |
Body:
Key | Value | Description |
---|---|---|
author_id | 1 | Accept author_id as the primary id of author |
title | This is title one | The title field must be between 1-255 chars |
body | This is body one | The body field must be between 1-2000 chars |
More example Requests/Responses:
Headers:
Key | Value | Description |
---|---|---|
ExampleHeader1 | ExampleHeader1Value | |
ExampleHeader2 | ExampleHeader2Value | |
Content-Type | application/x-www-form-urlencoded |
Body:
Key | Value | Description |
---|---|---|
author_id | 1 | Accept author_id as the primary id of author |
{
"errors": {
"title": [
"Title can not be empty"
],
"body": [
"Body can not be empty"
]
},
"message": "Validation error"
}
Status Code: 422
{
"message": "Unauthorized attempt"
}
Status Code: 401
Headers:
Key | Value | Description |
---|---|---|
ExampleHeader1 | ExampleHeader1Value | |
ExampleHeader2 | ExampleHeader2Value |
Body:
Key | Value | Description |
---|---|---|
author_id | 1 | Accept author_id as the primary id of author |
title | This is title one | The title field must be between 1-255 chars |
body | This is body one | The body field must be between 1-2000 chars |
{
"data": {
"id": 1,
"author_id": 1,
"title": "This is title one",
"body": "This is body one"
},
"message": "Article created successfully"
}
Status Code: 201
List articles endpoint provide article listing with filtering, patination
Endpoint:
Method: GET
Type:
URL: {{blog-server}}/v1/articles
Query params:
Key | Value | Description |
---|---|---|
page | {{id}} | Page is a unsigned integer which represents the page numer |
limit | {{limit}} | Limit represents maximum numer of results in the response |
user_id | {{user_id}} | Filter the articles using author_id |
More example Requests/Responses:
Headers:
Key | Value | Description |
---|---|---|
Authorization | Bearer inalid_token | Providing invalid token cause 401 |
Query:
Key | Value | Description |
---|---|---|
page | {{id}} | Page is a unsigned integer which represents the page numer |
limit | {{limit}} | Limit represents maximum numer of results in the response |
user_id | {{user_id}} | Filter the articles using author_id |
{
"message": "Unauthorized token"
}
Status Code: 401
Headers:
Key | Value | Description |
---|---|---|
Authorization | Bearer {{jwt_token}} | Providing valid token won't cause 401 |
Query:
Key | Value | Description |
---|---|---|
page | {{id}} | Page is a unsigned integer which represents the page numer |
limit | {{limit}} | Limit represents maximum numer of results in the response |
user_id | {{user_id}} | Filter the articles using author_id |
{
"data": [
{
"id": 3,
"user_id": 10,
"title": "Article 13",
"body": "This is article three"
},
{
"id": 2,
"user_id": 10,
"title": "Article 2",
"body": "This is article two"
},
{
"id": 1,
"user_id": 10,
"title": "Article 1",
"body": "This is article one"
}
]
}
Status Code: 200
Headers:
Key | Value | Description |
---|---|---|
Authorization | Bearer {{jwt_token}} | Providing valid token won't cause 401 |
Query:
Key | Value | Description |
---|---|---|
page | {{id}} | Page is a unsigned integer which represents the page numer |
limit | {{limit}} | Limit represents maximum numer of results in the response |
{
"data": [
{
"id": 3,
"user_id": 10,
"title": "Article 13",
"body": "This is article three"
},
{
"id": 2,
"user_id": 10,
"title": "Article 2",
"body": "This is article two"
},
{
"id": 1,
"user_id": 10,
"title": "Article 1",
"body": "This is article one"
}
]
}
Status Code: 200
Create user use JSON
payload to create a user
Endpoint:
Method: POST
Type: URLENCODED
URL: {{blog-server}}/v2/users
Body:
Key | Value | Description |
---|---|---|
name | Tom Hanks | |
bio | Thomas Jeffrey Hanks is an American actor and filmmaker. Known for both his comedic and dramatic roles, Hanks is one of the most popular and recognizable film stars worldwide, and is widely regarded as an American cultural icon. |
More example Requests/Responses:
Body:
Key | Value | Description |
---|---|---|
name | ||
bio |
{
"errors": {
"bio": [
"Bio can not be empty"
],
"name": [
"Name can not be empty"
]
},
"message": "Validation error"
}
Status Code: 422
Body:
Key | Value | Description |
---|---|---|
name | Tom Hanks | |
bio | Thomas Jeffrey Hanks is an American actor and filmmaker. Known for both his comedic and dramatic roles, Hanks is one of the most popular and recognizable film stars worldwide, and is widely regarded as an American cultural icon. |
{
"data": {
"id": 1,
"name": "Tom Hanks",
"bio": "Thomas Jeffrey Hanks is an American actor and filmmaker. Known for both his comedic and dramatic roles, Hanks is one of the most popular and recognizable film stars worldwide, and is widely regarded as an American cultural icon."
},
"message": "User created successfully"
}
Status Code: 201
{
"message": "Unauthorized attempt"
}
Status Code: 401
Use urlencoded data to update user partially
Endpoint:
Method: PATCH
Type: URLENCODED
URL: {{blog-server}}/v2/users/1
Body:
Key | Value | Description |
---|---|---|
name | Mr. Tom Hanks |
More example Requests/Responses:
{
"message": "Unauthorized attempt"
}
Status Code: 401
Body:
Key | Value | Description |
---|---|---|
name | Mr. Tom Hanks |
{
"data": {
"id": 1,
"name": "Mr. Tom Hanks",
"bio": "Thomas Jeffrey Hanks is an American actor and filmmaker. Known for both his comedic and dramatic roles, Hanks is one of the most popular and recognizable film stars worldwide, and is widely regarded as an American cultural icon."
},
"message": "User partial update successful"
}
Status Code: 206
System health check endpoint provide system health status for probe
Endpoint:
Method: GET
Type:
URL: {{blog-server}}/
More example Requests/Responses:
{
"system": "Failed"
}
Status Code: 500
{
"system": "OK"
}
Status Code: 200
Generated at 2022-01-25 15:47:32 by docgen