Skip to content

Latest commit

 

History

History
2579 lines (1363 loc) · 38.4 KB

README.md

File metadata and controls

2579 lines (1363 loc) · 38.4 KB

API documentation

Indices


Authentication

Route for user register, logging, reset passowrd etc

1. Get logged in user profile

get logged in user via token

Endpoint:

Method: GET
Type: RAW
URL: {{URL}}/api/v1/auth/me

Headers:

Key Value Description
Content-Type application/json JSON content type

Body:

{
    "name": "test",
    "description": "ModernTech has one goal, and that is to make you a rockstar developer and/or designer with a six figure salary. We teach both development and UI/UX",
    "website": "https://moderntech.com",
    "phone": "(222) 222-2222",
    "email": "enroll@moderntech.com",
    "address": "220 Pawtucket St, Lowell, MA 01854",
    "careers": ["Web Development", "UI/UX", "Android Development"],
    "housing": false,
    "jobAssistance": true,
    "jobGuarantee": false,
    "acceptGi": true
}

2. Logout user

Clears token cookie

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/auth/logout

3. Register user

Add a user to database with encrypted password

Endpoint:

Method: POST
Type: RAW
URL: {{URL}}/api/v1/auth/register

Headers:

Key Value Description
Content-Type application/json JSON content type

Body:

{
    "name": "Natasha hailey",
    "email": "nat@gmail.com",
    "password": "123456",
    "role": "user"
}

4. Reset password

Reset password using a random token via email

Endpoint:

Method: PATCH
Type: RAW
URL: {{URL}}/api/v1/auth/resetpassword/6d8614f2b6e603a06f7141211eb875e518c3821f

Headers:

Key Value Description
Content-Type application/json JSON content type

Body:

{
    "password": "12345678"
}

5. Update password

Update logged in user password, passing currentPassword and newPassword in the body

Endpoint:

Method: PATCH
Type: RAW
URL: {{URL}}/api/v1/auth/updatepassword

Headers:

Key Value Description
Content-Type application/json JSON content type

Body:

{
    "currentPassword": "123456",
    "newPassword": "1234567"
}

6. Update user details

updates name and email of a user

Endpoint:

Method: PATCH
Type: RAW
URL: {{URL}}/api/v1/auth/updatedetails

Headers:

Key Value Description
Content-Type application/json JSON content type

Body:

{
    "email": "john@gmail.com",
    "name": "John Doe"
}

7. forgotpassword

send token for forgetpassword

Endpoint:

Method: POST
Type: RAW
URL: {{URL}}/api/v1/auth/forgotpassword

Headers:

Key Value Description
Content-Type application/json JSON content type

Body:

{
    "email": "kevin@gmail.com"
}

8. login user

login user and sends back a token

Endpoint:

Method: POST
Type: RAW
URL: {{URL}}/api/v1/auth/login

Headers:

Key Value Description
Content-Type application/json JSON content type

Body:

{
    "email": "publisher@gmail.com",
    "password": "123456"
}

Bootcamps

1. Create a bootcamp

Add new bootcamp to database, must be publisher or admin

Endpoint:

Method: POST
Type: RAW
URL: {{URL}}/api/v1/bootcamps

Headers:

Key Value Description
Content-Type application/json JSON content type

Body:

{
    "name":"ModernTech Bootcamp",
    "description": "ModernTech has one goal, and that is to make you a rockstar developer and/or designer with a six figure salary. We teach both development and UI/UX",
    "website": "https://moderntech.com",
    "phone": "(222) 222-2222",
    "email": "enroll@moderntech.com",
    "address": "220 Pawtucket St, Lowell, MA 01854",
    "careers": ["Web Development", "UI/UX", "Android Development"],
    "housing": false,
    "jobAssistance": true,
    "jobGuarantee": false,
    "acceptGi": true
}

2. Delete a bootcamp

Delete a bootcamp from database

Endpoint:

Method: DELETE
Type: 
URL: {{URL}}/api/v1/bootcamps/60d32aed202924274054e4bd

3. Fetch a single bootcamp

Fetch a single bootcamp with ID

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/bootcamps/60811f14cdea3c17814e2661

4. Fetch all bootcamps

Fetch all bootcamps with sorting,pagination and filtering

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/bootcamps

5. Get Bootcamps by distance

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/bootcamps/radius/02118/30

6. Update a bootcamp

Update a single bootcamp in database

Endpoint:

Method: PATCH
Type: RAW
URL: {{URL}}/api/v1/bootcamps/608125b274703a19cdeaaae2

Headers:

Key Value Description
Content-Type application/json JSON content type

Body:

{
    "housing": true
}

Courses

1. Create bootcamp course

Create a course for a specific bootcamp

Endpoint:

Method: POST
Type: RAW
URL: {{URL}}/api/v1/bootcamps/60cc446a8dfb5b11c1191d0d/courses

Headers:

Key Value Description
Content-Type application/json JSON content type

Body:

{
    "title": "Test course 2",
    "description": "This is a dummy course",
    "weeks": 6,
    "tuition": 20000,
    "minimumSkill": "intermediate",
    "scholarshipsAvailable": false
}

2. Delete a course

Delete a course by id

Endpoint:

Method: DELETE
Type: RAW
URL: {{URL}}/api/v1/courses/60c73c98ca3b821e27fe5d55

3. Fetch all courses

Get all courses or of a bootcamp

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/courses

Query params:

Key Value Description
tuition[lt] 10000

4. Get a single course

Get a single course by ID

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/courses/5d725a4a7b292f5f8ceff789

5. Get courses of bootcamp

get all courses of a particular bootcamp

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/bootcamps/5d713995b721c3bb38c1f5d0/courses

6. Update a course

Update a course by id

Endpoint:

Method: PUT
Type: RAW
URL: {{URL}}/api/v1/courses/60cc44ed8dfb5b11c1191d0e

Headers:

Key Value Description
Content-Type application/json JSON content type

Body:

{
    "weeks": 16,
    "minimumSkill": "advanced"
}

Reviews

manage bootcamp reviews

1. Add review for bootcamp

post reviews for a specific bootcamp

Endpoint:

Method: POST
Type: RAW
URL: {{URL}}/api/v1/bootcamps/60d2e58504c33d3131f7f67b/reviews

Headers:

Key Value Description
Content-Type application/json JSON content type

Body:

{
    "title": "cool bootcamp",
    "text": "dsjfsd dsfsdjfsd sdfjdsifejif",
    "rating": 10
}

2. Add review for bootcamp

Submit review for a specific bootcamp

Endpoint:

Method: POST
Type: RAW
URL: {{URL}}/api/v1/bootcamps/60d2e58504c33d3131f7f67b/reviews

Headers:

Key Value Description
Content-Type application/json JSON content type

Body:

{
    "title": "cool bootcamp",
    "text": "dsjfsd dsfsdjfsd sdfjdsifejif",
    "rating": 10
}

3. Delete review

Rempve review from database

Endpoint:

Method: DELETE
Type: RAW
URL: {{URL}}/api/v1/reviews/60d2e71204c33d3131f7f67e

4. Get a single review

Get a review with id from database and populate it with corresponding bootcamp details

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/reviews/5d7a514b5d2c12c7449be021

5. Get all reviews

Get all reviews from database and populate it with corresponding bootcamp details

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/reviews

6. Get reviews for a bootcamp

Fetch the reviews for a specific bootcamp

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/bootcamps/5d725a037b292f5f8ceff787/reviews

7. Update review

update review in database

Endpoint:

Method: PATCH
Type: RAW
URL: {{URL}}/api/v1/reviews/60d2e71204c33d3131f7f67e

Headers:

Key Value Description
Content-Type application/json JSON content type

Body:

{
    "title": "Fucking sheeet"
}

User

CRUD functionality for users, available only for the admin

1. Create a user

create a user (admin)

Endpoint:

Method: POST
Type: RAW
URL: {{URL}}/api/v1/users

Headers:

Key Value Description
Content-Type application/json JSON content type

Body:

{
    "name": "William",
    "email": "william@hotmail.com",
    "password": "123456"
}

2. Delete a user

delete a user by id (Admin)

Endpoint:

Method: DELETE
Type: RAW
URL: {{URL}}/api/v1/users/60d17a2e5e0aa912c7f02485

Headers:

Key Value Description
Content-Type application/json JSON content type

Body:

{
    "name": "William",
    "email": "william@hotmail.com",
    "password": "123456"
}

3. Get a single users

single user by id (admin)

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/users/5c8a1d5b0190b214360dc040

4. Get users

get list of users(admin)

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/users

5. Update a single user

update a user by id (admin)

Endpoint:

Method: PUT
Type: RAW
URL: {{URL}}/api/v1/users/5c8a1d5b0190b214360dc040

Headers:

Key Value Description
Content-Type application/json JSON content type

Body:

{
    "email": "sara@gmail.com"
}

Back to top

Made with ♥ by thedevsaddam | Generated at: 2021-06-25 11:23:13 by docgen =======

DevCourses API

Authentication 8

Route for user register, logging, reset passowrd etc

raw[

Get logged in user profile | GET {{URL}}/api/v1/auth/me

]

Description

get logged in user via token

Headers
Key Value Description
Content-Type application/json

JSON content type

Body

{ "name": "test", "description": "ModernTech has one goal, and that is to make you a rockstar developer and/or designer with a six figure salary. We teach both development and UI/UX", "website": "https://moderntech.com", "phone": "(222) 222-2222", "email": "enroll@moderntech.com", "address": "220 Pawtucket St, Lowell, MA 01854", "careers": ["Web Development", "UI/UX", "Android Development"], "housing": false, "jobAssistance": true, "jobGuarantee": false, "acceptGi": true }

[

Logout user | GET {{URL}}/api/v1/auth/logout

]

Description

Clears token cookie

raw[

Register user | POST {{URL}}/api/v1/auth/register

]

Description

Add a user to database with encrypted password

Headers
Key Value Description
Content-Type application/json

JSON content type

Body

{ "name": "Natasha hailey", "email": "nat@gmail.com", "password": "123456", "role": "user" }

raw[

Reset password | PATCH {{URL}}/api/v1/auth/resetpassword/6d8614f2b6e603a06f7141211eb875e518c3821f

]

Description

Reset password using a random token via email

Headers
Key Value Description
Content-Type application/json

JSON content type

Body

{ "password": "12345678" }

raw[

Update password | PATCH {{URL}}/api/v1/auth/updatepassword

]

Description

Update logged in user password, passing currentPassword and newPassword in the body

Headers
Key Value Description
Content-Type application/json

JSON content type

Body

{ "currentPassword": "123456", "newPassword": "1234567" }

raw[

Update user details | PATCH {{URL}}/api/v1/auth/updatedetails

]

Description

updates name and email of a user

Headers
Key Value Description
Content-Type application/json

JSON content type

Body

{ "email": "john@gmail.com", "name": "John Doe" }

raw[

forgotpassword | POST {{URL}}/api/v1/auth/forgotpassword

]

Description

send token for forgetpassword

Headers
Key Value Description
Content-Type application/json

JSON content type

Body

{ "email": "kevin@gmail.com" }

raw[

login user | POST {{URL}}/api/v1/auth/login

]

Description

login user and sends back a token

Headers
Key Value Description
Content-Type application/json

JSON content type

Body

{ "email": "publisher@gmail.com", "password": "123456" }

Bootcamps 6

raw[

Create a bootcamp | POST {{URL}}/api/v1/bootcamps

]

Description

Add new bootcamp to database, must be publisher or admin

Headers
Key Value Description
Content-Type application/json

JSON content type

Body

{ "name":"ModernTech Bootcamp", "description": "ModernTech has one goal, and that is to make you a rockstar developer and/or designer with a six figure salary. We teach both development and UI/UX", "website": "https://moderntech.com", "phone": "(222) 222-2222", "email": "enroll@moderntech.com", "address": "220 Pawtucket St, Lowell, MA 01854", "careers": ["Web Development", "UI/UX", "Android Development"], "housing": false, "jobAssistance": true, "jobGuarantee": false, "acceptGi": true }

[

Delete a bootcamp | DELETE {{URL}}/api/v1/bootcamps/60d32aed202924274054e4bd

]

Description

Delete a bootcamp from database

[

Fetch a single bootcamp | GET {{URL}}/api/v1/bootcamps/60811f14cdea3c17814e2661

]

Description

Fetch a single bootcamp with ID

[

Fetch all bootcamps | GET {{URL}}/api/v1/bootcamps

]

Description

Fetch all bootcamps with sorting,pagination and filtering

[

Get Bootcamps by distance | GET {{URL}}/api/v1/bootcamps/radius/02118/30

]

raw[

Update a bootcamp | PATCH {{URL}}/api/v1/bootcamps/608125b274703a19cdeaaae2

]

Description

Update a single bootcamp in database

Headers
Key Value Description
Content-Type application/json

JSON content type

Body

{ "housing": true }

Courses 6

raw[

Create bootcamp course | POST {{URL}}/api/v1/bootcamps/60cc446a8dfb5b11c1191d0d/courses

]

Description

Create a course for a specific bootcamp

Headers
Key Value Description
Content-Type application/json

JSON content type

Body

{ "title": "Test course 2", "description": "This is a dummy course", "weeks": 6, "tuition": 20000, "minimumSkill": "intermediate", "scholarshipsAvailable": false }

raw[

Delete a course | DELETE {{URL}}/api/v1/courses/60c73c98ca3b821e27fe5d55

]

Description

Delete a course by id

[

Fetch all courses | GET {{URL}}/api/v1/courses

]

Description

Get all courses or of a bootcamp

Query
Key Value Description
tuition[lt] 10000
[

Get a single course | GET {{URL}}/api/v1/courses/5d725a4a7b292f5f8ceff789

]

Description

Get a single course by ID

[

Get courses of bootcamp | GET {{URL}}/api/v1/bootcamps/5d713995b721c3bb38c1f5d0/courses

]

Description

get all courses of a particular bootcamp

raw[

Update a course | PUT {{URL}}/api/v1/courses/60cc44ed8dfb5b11c1191d0e

]

Description

Update a course by id

Headers
Key Value Description
Content-Type application/json

JSON content type

Body

{ "weeks": 16, "minimumSkill": "advanced" }

Reviews 7

manage bootcamp reviews

raw[

Add review for bootcamp | POST {{URL}}/api/v1/bootcamps/60d2e58504c33d3131f7f67b/reviews

]

Description

post reviews for a specific bootcamp

Headers
Key Value Description
Content-Type application/json

JSON content type

Body

{ "title": "cool bootcamp", "text": "dsjfsd dsfsdjfsd sdfjdsifejif", "rating": 10 }

raw[

Add review for bootcamp | POST {{URL}}/api/v1/bootcamps/60d2e58504c33d3131f7f67b/reviews

]

Description

Submit review for a specific bootcamp

Headers
Key Value Description
Content-Type application/json

JSON content type

Body

{ "title": "cool bootcamp", "text": "dsjfsd dsfsdjfsd sdfjdsifejif", "rating": 10 }

raw[

Delete review | DELETE {{URL}}/api/v1/reviews/60d2e71204c33d3131f7f67e

]

Description

Rempve review from database

[

Get a single review | GET {{URL}}/api/v1/reviews/5d7a514b5d2c12c7449be021

]

Description

Get a review with id from database and populate it with corresponding bootcamp details

[

Get all reviews | GET {{URL}}/api/v1/reviews

]

Description

Get all reviews from database and populate it with corresponding bootcamp details

[

Get reviews for a bootcamp | GET {{URL}}/api/v1/bootcamps/5d725a037b292f5f8ceff787/reviews

]

Description

Fetch the reviews for a specific bootcamp

raw[

Update review | PATCH {{URL}}/api/v1/reviews/60d2e71204c33d3131f7f67e

]

Description

update review in database

Headers
Key Value Description
Content-Type application/json

JSON content type

Body

{ "title": "Fucking sheeet" }

User 5

CRUD functionality for users, available only for the admin

raw[

Create a user | POST {{URL}}/api/v1/users

]

Description

create a user (admin)

Headers
Key Value Description
Content-Type application/json

JSON content type

Body

{ "name": "William", "email": "william@hotmail.com", "password": "123456" }

raw[

Delete a user | DELETE {{URL}}/api/v1/users/60d17a2e5e0aa912c7f02485

]

Description

delete a user by id (Admin)

Headers
Key Value Description
Content-Type application/json

JSON content type

Body

{ "name": "William", "email": "william@hotmail.com", "password": "123456" }

[

Get a single users | GET {{URL}}/api/v1/users/5c8a1d5b0190b214360dc040

]

Description

single user by id (admin)

[

Get users | GET {{URL}}/api/v1/users

]

Description

get list of users(admin)

raw[

Update a single user | PUT {{URL}}/api/v1/users/5c8a1d5b0190b214360dc040

]

Description

update a user by id (admin)

Headers
Key Value Description
Content-Type application/json

JSON content type

Body

{ "email": "sara@gmail.com" }