No description, website, or topics provided.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

Hey You API

Build Status

RESTful server api for hey you hosted on heroku

API address : https://hey-you-api.herokuapp.com

Users Routes

Create User :

POST /api/users

Body:

{ "username": "testman",
  "password": "testpassword",
  "birthday": 1,
  "email": "test@example.com" }

Returns jwt token

{ "jwt": "alkvnpefTHISdfaibISbvrawfAaweifjFAKEalskdfwaoHASHoiouaslfjakwjef" }

Login :

GET /api/users

username: "testman", password: "testpassword"

Returns jwt token

Dots

Retrieving all dots - TEMPORARY :

GET /v1/api/dots/all

Returns array of all dot objects

[ {     "_id": "324comment1id2348790",
        "user_id": "101testmanid010",
        "username": "testman",
        "time": 1416445071063,
        "title": "HEY SEATTLE",
        "color": "blue",
        "latitude": 47.623,
        "longitude": -122.333,
        "post": "download this app!",
        "__v": 0,
        "hidden": false,
        "stars": [] }, {...} ]

Getting zone of dots :

GET /v1/api/dots

Headers: zone: {"latMax":50,"longMin":-125,"longMax":-120,"latMin":45}

Returns array of dots in zone

[ { _id: '546eaa0618b26cfe16365e0f',
    user_id: '546eaa0618b26cfe16365e0c',
    username: 'dotUser',
    time: 1416538630645,
    color: 'green',
    title: 'Hey you, with the coffee',
    latitude: 47.6097,
    longitude: -122.3331,
    post: 'I am in Seattle',
    __v: 0,
    views: 2,
    hidden: false,
    starred: false }, {...} ]

Getting dot by id :

GET /v1/api/dots/dot_id

note: jwt header is optional. If set, the API will check if the user has stared the dot.

Returns single dot object of given id and comments

{ _id: '546eaae6a45f8b021729bddb',
  user_id: '546eaae6a45f8b021729bdd8',
  username: 'dotUser',
  time: 1416538854538,
  color: 'green',
  title: 'Hey you, with the coffee',
  latitude: 47.6097,
  longitude: -122.3331,
  post: 'I am in Seattle',
  __v: 0,
  views: 3,
  hidden: false,
  starred: false,
  stars: 0,
  comments: 
   [ { _id: '546eaae6a45f8b021729bddd',
       timestamp: 1416538854611,
       username: 'dotUser',
       user_id: '546eaae6a45f8b021729bdd8',
       dot_id: '546eaae6a45f8b021729bddb',
       text: 'this is a text comment from the OP',
       __v: 0 },
     { _id: '546eaae6a45f8b021729bdde',
       timestamp: 1416538854622,
       username: 'dotUser2',
       user_id: '546eaae6a45f8b021729bdd9',
       dot_id: '546eaae6a45f8b021729bddb',
       text: 'this is a text comment from another user',
       __v: 0 } ] }

Getting user's dot by id :

GET /v1/api/dots/mydots

jwt required in header

Returns array dot objects made from the user

[ { _id: '546eb21a9bd55e171793a195',
    user_id: '546eb2199bd55e171793a193',username: 'dotUser',
    time: 1416540698148,
    color: 'blue',
    title: 'Hey you, with the startup',
    latitude: 37.7833,
    longitude: -122.4167,
    post: 'I am in San Fransico',
    __v: 0,
    hidden: false,
    starred: false }, {...} ]

Creating a dot :

POST /v1/api/dots

jwt required in header

Body (JSON):

{ "longitude": "-122.333",
  "latitude": "47.623",
  "title": "HEY SEATTLE",
  "post": "download this app!",
  "color": "blue" }

Returns _id and time

{ "dot_id": "275FAKEID1738",
  "time": 1416445071063 }

Delete a dot :

DELETE /v1/api/dots/_id

jwt required in header

Removes dot of id _id

Commenting on a dot :

POST /v1/api/comments/dot_id

Body(JSON): {"text": "listen to testman. he knows things."}

Returns comment message on success "listen to testman. he knows things."

Deleting a comment :

DELETE /v1/api/comments/dot_id

jwt required in header

Returns 'removed!' message on success removed!

Getting users dots :

GET /v1/api/dots/mydots

jwt required in header

Returns array of dots for that user

[ {     "_id": "324comment1id2348790",
        "user_id": "101testmanid010",
        "username": "testman",
        "time": 1416445071063,
        "title": "HEY SEATTLE",
        "color": "blue",
        "latitude": 47.623,
        "longitude": -122.333,
        "post": "download this app!",
        "__v": 0,
        "hidden": false,
        "stars": [] },
    {   
        "_id": "203comment2id092384",
        "user_id": "101testmanid010",
        "username": "testman",
        "time": 1416445071064,
        "title": "YO",
        "green": "green",
        "latitude": 47.312,
        "longitude": -122.373,
        "post": "this is awesome!",
        "__v": 0,
        "hidden": false,
        "stars": [] } ]

Toggle a user's star

POST /v1/api/stars/_id

jwt required in header

Adds a star or deletes a star based on user history