You can interact with the Blogify API routes locally by accessing localhost:1337/docs
. Before exploring the routes, ensure that you have authenticated a user. Follow the steps below to authenticate a user in the Swagger Docs UI:
-
Create a User:
- Use the
Create User
endpoint to register a new user. Provide the necessary information such as email, password, and name.
- Use the
-
Create a Session:
- After creating a user, use the
Create Session
endpoint to log in and obtain an access token. Copy theaccessToken
from the response.
- After creating a user, use the
-
Authenticate User in Swagger Docs UI:
- Open
localhost:1337/docs
in your browser. - Locate the "Authorize" button in the Swagger Docs UI.
- Paste the copied
accessToken
into the "Value" field and click "Authorize."
- Open
Now, you are authenticated, and you can explore and interact with the Blogify API routes in the Swagger Docs UI. Ensure to include the access token in the authorization header for endpoints that require authentication.
Feel free to test, create, update, and delete users and blogs using the provided routes, and enjoy a seamless experience with the Blogify API!
Method: POST
Endpoint: {{endpoint}}/api/users
Request Body:
{
"email": "{{email}}",
"password": "{{password}}",
"passwordConfirmation": "{{password}}",
"name": "{{name}}"
}
Method: PUT
Endpoint: {{endpoint}}/api/users
Request Body:
{
"email": "ikboljonme@gmail.com",
"password": "1221qwwq",
"passwordConfirmation": "1221qwwq",
"name": "Ikboljon"
}
Headers:
x-refresh: {{refreshToken}}
Method: POST
Endpoint: {{endpoint}}/api/sessions
Request Body:
{
"email": "{{email}}",
"password": "{{password}}"
}
Method: GET
Endpoint: {{endpoint}}/api/sessions
Headers:
x-refresh: {{refreshToken}}
Method: DELETE
Endpoint: {{endpoint}}/api/sessions
Headers:
x-refresh: {{refreshToken}}
Method: POST
Endpoint: {{endpoint}}/api/blogs
Request Body:
{
"title": "Canon 1214444DSLR Camera with 18-55mm Lens",
"description": "Designed for first-time DSLR owners who want impressive results straight out of the box, capture those magic moments no matter your level with the EOS 1500D. With easy-to-use automatic shooting modes, a large 24.1 MP sensor, Canon Camera Connect app integration, and built-in feature guide, EOS 1500D is always ready to go."
}
Headers:
x-refresh: {{refreshToken}}
Method: GET
Endpoint: {{endpoint}}/api/blogs/{{blogId}}
Headers:
x-refresh: {{refreshToken}}
Method: GET
Endpoint: {{endpoint}}/api/blogs
Headers:
x-refresh: {{refreshToken}}
Method: DELETE
Endpoint: {{endpoint}}/api/blogs/{{blogId}}
Headers:
x-refresh: {{refreshToken}}
Method: PUT
Endpoint: {{endpoint}}/api/blogs/{{blogId}}
Request Body:
{
"title": "Updated",
"description": "Designed for first-time DSLR owners who want impressive results straight out of the box, capture those magic moments no matter your level with the EOS 1500D. With easy-to-use automatic shooting modes, a large 24.1 MP sensor, Canon Camera Connect app integration, and built-in feature guide, EOS 1500D is always ready to go."
}
Headers:
x-refresh: {{refreshToken}}
Method: POST
Endpoint: {{endpoint}}/api/blogs/{{blogId}}/like
Headers:
x-refresh: {{refreshToken}}
Method: POST
Endpoint: {{endpoint}}/api/blogs/{{blogId}}/unlike
Headers:
x-refresh: {{refreshToken}}
Method: POST
Endpoint: {{endpoint}}/api/blogs/{{blogId}}/read
Headers:
x-refresh: {{refreshToken}}
Explore the metrics route to gather essential information about the performance and status of the Blogify API.
- Method: GET
- Endpoint:
{{endpoint}}/api/metrics
This endpoint allows you to retrieve various metrics related to the Blogify API's performance.
Upon a successful request, you can expect a response containing relevant metrics data. The details of the response will vary based on the current state and usage of the API.