Project API


For purposes of this API description, all URLs are relative to the base url of http://localhost:8080/sad

Also, all data is in JSON format. A GET request will return JSON. A PUT or POST will submit a JSON document.

To keep things simple, no authentication is required to access any resource.

NOTE: We'll accept any number of valid JSON that satisfy the requirements of this project.


Admin


POST /advertiser

Creates an advertiser. Returns the id of the account created.

HTTP response codes:

  • 201 (Created), 'Location' header with link to /admin/advertiser/{aid} containing new ID.
  • 400 (Bad Request) if the JSON being POST-ed is bad

Resource URL

/admin/advertiser

Parameters

  • name (required): advertiser name (first last).
  • address (required): advertiser address.
  • email (required): advertiser email address; must be unique across accounts.
  • phone (required): advertiser phone number.
  • facebook (optional): facebook name.
  • twitter (optional): twitter username.

Example Request

	
  POST http://localhost:8080/sad/admin/advertiser


Here is data being POST-ed

  
  {

    "name": "The Summit Bed and Breakfast",
    "address": {
      "street": "123 Main Street",
      "city": "Anytown",
      "state": "Anystate",
      "zip": "12345"
    },
    "email": "jane.doe@example.com",
    "phone": "123-456-7890",
    "facebook": "",
    "twitter": ""   
  }
  

Example Response


  {
    "id": 123
  }



Customer


GET /[{cid}/{cid}/.../{cid}]

Returns an array of listings under /[{cid}/{cid}/.../{cid}]. If no category ID is provided, then return the home page listings.

The array of listings returned includes an array of home-page-featured listings, an array of category-featured and an array of regular listings.

HTTP response codes: 200 (OK).

Resource URL

/[{cid}/{cid}/.../{cid}]

Parameters

cid: e.g. "travel", "hotels", etc.

Example Request

	
  GET http://localhost:8080/sad/travel


Customer Service Representative


GET /csr/search?q=query_string

Returns an array of entities that match the query_string.

HTTP response code: 200 (OK).

Resource URL

/csr/search

Parameters

q (optional): query string (aka keyword) used for search, if none specified, then everything matches.

Example Request

	
  GET http://localhost:8080/sad/csr/search?q=travel



Last update: Nov 22, 2015 Virgil Bistriceanu cs445 Computer Science

$Id: project-api.html,v 1.1 2015/11/23 04:57:55 virgil Exp $