Skip to content

Latest commit

 

History

History
192 lines (155 loc) · 6.26 KB

api.md

File metadata and controls

192 lines (155 loc) · 6.26 KB

Sit-n-paws API

API

API request to create initial booking:

/stays POST

Parameters

param description data type examples
listingId The listingID as stored in the listings collection String "vw45346b7b3467"
startDate Date to start the stay in UTC format String "2016-05-18T16:00:00Z"
endDate Date to end the stay in UTC format String "2016-05-18T16:00:00Z"
{
  "listingId": "v3456yv456v46",
  "startDate": "2016-05-18T16:00:00Z",
  "endDate": "2016-05-18T16:00:00Z"
}

Response

{
  "stayId": "v3456yv456v46",
  "status": "pending" // planned for future
}

API to signup:

/signup POST

Parameters

param description data type examples
name The name as input by the user String "Brian Griffin"
password The user's desired password as input by the user String "writer123"
email The user's email address as input by the user String "brianG@random.edu"

Example JSON

Request format
{
   "name": "Brian Griffin",
   "email": "brianG@random.edu",
   "password": "writer123"
}
Response format
{
   "success": true
}

API to create and retrieve Listings

/listings POST

Parameters

param description data type examples
name The name of the property/listing String "Brian's Awesome Home"
zipcode The user's zipcode as input by the user String "writer123"
dogSizePreference The user's preferred size of dog to host as input by the user String "small"
dogBreedPreference The user's preferred breed of dog to host as input by the user String "All"
dogTemperamentPreference The user's preferred temperament of dog to host as input by the user String "chill"
dogActivityPreference The user's preferred activity level of dog to host as input by the user String "fast"
homeAttributes Type of living space as described by the user String "apartment"
cost The cost per night as decided by the user Number 45.99

Example Request format

{
   "name": "Best House NA",
   "zipcode": 94106,
   "dogSizePreference": "small",
   "dogBreedPreference": "All",
   "dogTemperamentPreference": "chill",
   "dogActivityPreference": "fast",
   "homeAttributes": "apartment",
   "cost": 45
}

Example Response format

{
   "success": true
}

Database collections

Stay in stays collection

Fields

param description data type examples
_id Id representing this specific stay String "354673bv46736bv"
listingId The Id of the associated listing String "5426g3bv4673b4673"
guestId The Id of the guest who will be staying String "f354987hnc39870n7c3y5"
startDate The start date of the stay in UTC String "2016-05-18T16:00:00Z"
status The end date of the stay in UTC String "2016-05-18T16:00:00Z"
hostRating The rating given to the stay by the host Number 5
guestRating The rating given to the stay by the guest Number 5
pricePer The average price per night the guest is paying Number 76.77
totalPrice The total price the guest is paying Number 76.77
{
  "_id": "2340k728234jjf87",
  "listingId": "3cv45765nb75467",
  "guestId": "3vg5980u34cvg5",
  "startDate": "2016-05-18T16:00:00Z",
  "endDate": "2016-05-18T16:00:00Z",
  "status": "pending, confirmed, closed, cancelled",
  "hostRating": 5,
  "guestRating": 5,
  "pricePer": 33.99,
  "totalPrice": 76.77
}

Listing in listings collection

Fields

param description data type examples
name The property/listing name String "Dog Mansion"
zipcode The zipcode of the listing String "95024"
dogSizePreference The dog's size preferred by the host String "Small"
dogBreedPreference The dog's breed preferred by the host String "Beagle"
dogTemperamentPreference The dog's temperament preferred by the host String "Nice"
dogActivityPreference The dog's level of activity preferred by the host String "calm"
homeAttributes Words to describe the home String "Apartment"
hostPictures URL of the image for the Host String "https://randomuser.me/api/portraits/men/55.jpg"
homePictures URL of the image for the listing String "https://farm1.staticflickr.com/48/111317752_7934d93e8a.jpg"
cost The user's address as input by the user Number 57.99
{
   "name": "Camp Snoopy",
   "zipcode": 94123,
   "dogSizePreference": "small",
   "dogBreedPreference": "ROSIE",
   "dogTemperamentPreference": "Expanded",
   "dogActivityPreference": "fusce",
   "homeAttributes": "Support",
   "hostPictures": "https://randomuser.me/api/portraits/men/55.jpg",
   "homePictures": "https://farm1.staticflickr.com/48/111317752_7934d93e8a.jpg",
   "cost": 57.99
}

User is Users Collection

Fields

param description data type examples
password The user's password as input by the user String "writer123"
email The user's email as input by the user String "brianG@random.edu"
name The user's name as input by the user String "Brian Griffin"
phone The user's phone number as input by the user String "555-235-1234"
address The user's address as input by the user String "31 Spooner Street"

Example user entry

{
   "password": "writer123",
   "email": "brianG@random.edu",
   "name": "Brian Griffin",
   "phone": "555-235-1234",
   "address": "31 Spooner Street"
}