Skip to content

guidr-project/GUIDR-Backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Guidr - Back-End


API Documentation

BASE URL https://guidr-project.herokuapp.com

  • Attach endpoints to the Base URL to hit them with HTTP Requests.

Table of Contents

NON-PROTECTED ENDPOINTS

Links Endpoints
POST Registration /users/signUp
POST Login /users/login

PROTECTED ENDPOINTS

All EndPoints listed below require a token! Send an authorizatoin header with the token provided upon login.

Links Endpoints
GET Trips by user ID /users/:id/trips
POST Add new trip /users/:id/trips
GET Get profile by user ID /users/:id/profile
PUT Update user profile info /users/:id/profile
GET Get all public trips /trips
PUT Update a trip by trip ID /trips/:id
DELETE Delete a trip by trip ID /trips/:id

[POST] Registration

Payload: an object with the following credentials:

Required: username, email, password, full_name

{
    "username": "newUsername",
    "password": "newPassword",
    "email": "[email protected]",
    "full_name": "John"
}

Return: Returns message that new user was create (may or may not be used by front end)


[POST] Login

Payload: an object with the following credentials:

Required: username, password

{
    "username": "newUsername",
    "password": "newPassword"
}

Return:

{
    "id": 5,
    "token": "9834yt834yg89024hy3t89347yt297wey78t643879fhuowe"
}

[GET] Get Trips by user ID

Return:

{
    "id": 8,
    "title": "Yosemite",
    "description": "When hiking through the park",
    "private": true,
    "type": "Hiking",
    "start_date": "2019-07-15",
    "end_date": "2019-07-17",
    "duration_hours": 5,
    "duration_days": 2
}

[POST] Add a new trip

Required: title, description, private, type, start_date, end_date, duration_hours, duration_days

{
    "title": "Yosemite",
    "description": "When hiking through the park",
    "private": true,
    "type": "Hiking",
    "start_date": "2019-07-15",
    "end_date": "2019-07-17",
    "duration_hours": 5,
    "duration_days": 2
}

Return:

{
    "id": 8,
    "title": "Yosemite",
    "description": "When hiking through the park",
    "private": true,
    "type": "Hiking",
    "start_date": "2019-07-15",
    "end_date": "2019-07-17",
    "duration_hours": 5,
    "duration_days": 2,
    "user_id": 4
}

[GET] Get profile by user ID

Return:

{
    "full_name": "Sean McDonnell",
    "email": "[email protected]",
    "username": "username",
    "title": "Outdoorsman",
    "description": "A person who does stuff outdoors",
    "age": 31,
    "experience_duration": "5 years"
}

[PUT] Update user profile info

Payload: an object with the following credentials:

Required: full_name, email, title, description, age, experience_duration

{
    "full_name": "Sean McDonnell",
    "email": "[email protected]",
    "title": "Outdoorsman",
    "description": "A person who does stuff outdoors",
    "age": 31,
    "experience_duration": "5 years"
}

Return:

{
    "full_name": "Sean McDonnell",
    "email": "[email protected]",
    "title": "Outdoorsman",
    "description": "A person who does stuff outdoors",
    "age": 31,
    "experience_duration": "5 years"
}

[GET] Get all public trips

Return:

{
    "id": 2,
    "title": "Lake Michigan",
    "description": "Kayaking at the lake",
    "private": false,
    "type": "Kayaking",
    "start_date": "2019-07-20",
    "end_date": "2019-07-20",
    "duration_hours": 12,
    "duration_days": 0,
    "user_id": 1
}

[PUT] Update a trip by trip ID

Payload: an object with the following credentials:

Required: title, description, private, type, start_date, end_date, duration_hours, duration_days

{
    "title": "Something",
    "description": "Kayaking at the lake",
    "private": false,
    "type": "Kayaking",
    "start_date": "2019-07-20",
    "end_date": "2019-07-20",
    "duration_hours": 12,
    "duration_days": 0
}

Return:

{
    "id": 2,
    "title": "Something",
    "description": "Kayaking at the lake",
    "private": false,
    "type": "Kayaking",
    "start_date": "2019-07-20",
    "end_date": "2019-07-20",
    "duration_hours": 12,
    "duration_days": 0,
    "user_id": 1
}

[DELETE] Delete a trip by trip ID

Return: Returns confirmation message that trip was deleted

Back to Top

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published