sphuff / jobsforhosh-server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

API Specification

Users


Request
      POST /user
Errors
      -- 400 -- Must send email and password
      -- 409 -- User already exists
Header
      Accept: application/x-www-form-urlencoded
Body
      email=testemail8@test.com&password=1234
Response

{
  "__v": 0,
  "email": "testemail8@test.com",
  "password": "1234",
  "signupDate": "2017-02-03T18:42:08.195Z",
  "admin": false,
  "_id": "5894cf00ccb0df2bbb1d1bdb",
  "jobs": []
}

Request
      GET /user
Errors
      -- 400 -- Must send email and password
      -- 404 -- User not found
Query
      email=testemail8@test.com&password=1234
Response

{
  "_id": "5894cf00ccb0df2bbb1d1bdb",
  "email": "testemail8@test.com",
  "password": "1234",
  "signupDate": "2017-02-03T18:42:08.195Z",
  "admin": false,
  "__v": 1,
  "jobs": [
    "5894d08f2141b92d1e3319d6"
  ]
}

Jobs


Request
      POST /job
Errors
      -- 400 -- Must send job title, company name, and user ID
      -- 500 -- Internal Error
Header
      Accept: application/x-www-form-urlencoded
Body
      userID=5894cf00ccb0df2bbb1d1bdb&title=Cook&company=Outback&url=www.outback.com
Response

{
  "__v": 0,
  "title": "Cook",
  "company": "Outback",
  "url": "www.outback.com",
  "_id": "5894d08f2141b92d1e3319d6"
}

Request
      GET /job
Errors
      -- 400 -- Must send job ID
Query
      id=5894d08f2141b92d1e3319d6
Response

{
  "__v": 0,
  "title": "Cook",
  "company": "Outback",
  "url": "www.outback.com",
  "_id": "5894d08f2141b92d1e3319d6"
}

Request
      GET /jobsforuser
Errors
      -- 400 -- Must user ID
      -- 404 -- Jobs not found
Query
      id=589b3c19a012bb133d1d49e5
Response

[ { "_id": "589b3c19a012bb133d1d49e6",
    "_creator": "589b3c19a012bb133d1d49e5",
    "title": "job-title",
    "company": "company-name",
    "__v": 0 },
  { "_id": "589b3c19a012bb133d1d49e7",
    "_creator": "589b3c19a012bb133d1d49e5",
    "title": "job-title2",
    "company": "company-name2",
    "__v": 0 } ]

About


Languages

Language:JavaScript 100.0%