Skip to content

Commit a8ca258

Browse files
add auth info to readme
1 parent 36525f5 commit a8ca258

File tree

1 file changed

+37
-10
lines changed

1 file changed

+37
-10
lines changed

README.md

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,22 +62,49 @@ Test the API using Swagger UI (`/` route), Postman, cURL or your preferred HTTP
6262

6363
<br/>
6464

65-
<br></br>
65+
#### Authorization
66+
``Protected`` endpoints require the following header:
67+
`Authorization: Bearer <access_token>`
68+
69+
``Refresh protected`` endpoints requires the following header:
70+
`Authorization: Bearer <refresh_token>`
71+
72+
#### Authentication
73+
- [POST] `/auth/register` - Register a new user.
74+
```
75+
{
76+
"email": "[email protected]",
77+
"password": "your_password"
78+
}
79+
```
80+
81+
- [POST] `/auth/login` - Login a user and get access and refresh tokens.
82+
```
83+
{
84+
"email": "[email protected]",
85+
"password": "your_password"
86+
}
87+
```
88+
89+
- [POST] `/auth/refresh` (Refresh protected) - Get new access token using a refresh token.
90+
91+
<br/>
92+
6693
#### Category
6794
- [GET] `/categories` - Get all categories
6895
- [GET] `/category/(int: category_id)` - Get category with category_id
6996
- [GET] `/category/(int: category_id)/subcategories` - Get subcategories within a category_id.
70-
- [DELETE] `/category/(int: category_id)` - Delete category with category_id
97+
- [DELETE] `/category/(int: category_id)` (Protected) - Delete category with category_id
7198

72-
- [POST] `/category/create` - Create a new category
99+
- [POST] `/category/create` (Protected) - Create a new category
73100
```
74101
{
75102
"name": "name",
76103
"subcategories": [<subcategory ids>] //optional
77104
}
78105
```
79106

80-
- [PUT] `/category/(int: category_id)/update` - Update category with category_id
107+
- [PUT] `/category/(int: category_id)/update` (Protected) - Update category with category_id
81108
```
82109
{
83110
"name": "name",
@@ -91,9 +118,9 @@ Test the API using Swagger UI (`/` route), Postman, cURL or your preferred HTTP
91118
- [GET] `/subcategories` - Get all subcategories
92119
- [GET] `/subcategory/(int: subcategory_id)` - Get subcategory with subcategory_id
93120
- [GET] `/subcategory/(int: subcategory_id)/categories` - Get categories related to subcategory_id
94-
- [DELETE] `/subcategory/(int: subcategory_id)` - Delete subcategory with subcategory_id
121+
- [DELETE] `/subcategory/(int: subcategory_id)` (Protected) - Delete subcategory with subcategory_id
95122

96-
- [POST] `/subcategory/create` - Create a new subcategory
123+
- [POST] `/subcategory/create` (Protected) - Create a new subcategory
97124
```
98125
{
99126
"name": "name",
@@ -102,7 +129,7 @@ Test the API using Swagger UI (`/` route), Postman, cURL or your preferred HTTP
102129
}
103130
```
104131

105-
- [PUT] `/subcategory/(int: subcategory_id)/update` - Update subcategory with subcategory_id
132+
- [PUT] `/subcategory/(int: subcategory_id)/update` (Protected) - Update subcategory with subcategory_id
106133
```
107134
{
108135
"name": "name",
@@ -118,9 +145,9 @@ Test the API using Swagger UI (`/` route), Postman, cURL or your preferred HTTP
118145
- [GET] `/products` - Get all products
119146
- [GET] `/product/(int: product_id)` - Get product with product_id
120147
- [GET] `/product/(int: product_id)/subcategories` - Get subcategories related to product_id
121-
- [DELETE] `/product/(int: product_id)` - Delete product with product_id
148+
- [DELETE] `/product/(int: product_id)` (Protected) - Delete product with product_id
122149

123-
- [POST] `/product/create` - Create a new product
150+
- [POST] `/product/create` (Protected) - Create a new product
124151
```
125152
{
126153
"name": "name",
@@ -129,7 +156,7 @@ Test the API using Swagger UI (`/` route), Postman, cURL or your preferred HTTP
129156
}
130157
```
131158

132-
- [PUT] `/product/(int: product_id)/update` - Update product with product_id
159+
- [PUT] `/product/(int: product_id)/update` (Protected) - Update product with product_id
133160
```
134161
{
135162
"name": "name",

0 commit comments

Comments
 (0)