Giter VIP home page Giter VIP logo

amazon-price-tracker's Introduction

CS263 Amazon Price Tracker

API Authentication

There are two REST APIs exposed:

  • wishlist
  • sharedlist

Both API require user to login with their Google account first. The following commands allow user to obtain the necessary cookie to access the REST APIs with curl. (Only applicable to development server)

curl http://localhost:8080/_ah/login \
  -d "[email protected]&action=Log+In" \
  -c -

Take the last value of the result "[email protected]:False:18580..." and use it to send the API request.

curl -XGET -H "Accept:application/json" http://localhost:8080/rest/wishlist \
  -b "dev_appserver_login="[email protected]:false:18580..."; Path=/;"

Wishlist

Send GET to /rest/wishlist to get the wishlist of the user.

curl -XGET -H "Accept:application/json" http://localhost:8080/rest/wishlist \
  -b "dev_appserver_login="[email protected]:false:18580..."; Path=/;"

To POST a new product, the product JSON object needs the following field:

  • productID: String
  • productName: String
  • currentPrice: Double
  • lowestPrice: Double
  • lowestDate: Date
curl -XPOST -H "Content-Type:application/json" \
  -d '{"productID":"XXXXXXXXXX", "productName":"Test product", "currentPrice":999.0, "lowestPrice":999.0, "lowestDate":1457993425165}' \
  http://localhost:8080/rest/wishlist \
  -b "dev_appserver_login="[email protected]:false:18580..."; Path=/;"

To DELETE a product, send DELETE request to /rest/wishlist/${product_id}.

curl -XDELETE http://localhost:8080/rest/wishlist/XXXXXXXXXX \
  -b "dev_appserver_login="[email protected]:false:18580..."; Path=/;"

Sharedlist

Send GET to /rest/sharedlist to get the list of the shared products.

curl -XGET -H "Accept:application/json" http://localhost:8080/rest/sharedlist \
  -b "dev_appserver_login="[email protected]:false:18580..."; Path=/;"

To POST a new shared product, the product JSON object needs the following field:

  • productID: String
  • productName: String
  • sharedDate: Date The field email will be filled with the current user automatically.
curl -XPOST -H "Content-Type:application/json" \
  -d '{"productID":"XXXXXXXXXX", "productName":"Test product", "sharedDate":1457993425165}' \
  http://localhost:8080/rest/sharedlist \
  -b "dev_appserver_login="[email protected]:false:18580..."; Path=/;"

Other internal servlets

There are some servlets are used internally only:

  • mail
  • cron/flush
  • cron/update

Send POST to /mail to send a mail. Required parameters are email, productName, productID, and price. The content is automatically generated. (See MailServlet.java)

Send POST to /cron/flush to flush the memcache, and to /cron/update to update the products' prices.

amazon-price-tracker's People

Contributors

fasthall avatar soulhsu avatar

Stargazers

 avatar Ciaran Shanahan avatar

Watchers

Diego avatar James Cloos avatar Chandra Krintz avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.