Last active
October 13, 2015 12:38
-
-
Save trappist/4197306 to your computer and use it in GitHub Desktop.
TRR API doc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Toggle obsession: | |
| POST /obsessions/obsess_over_variant | |
| JSON payload: {:id => flash_sale_variant_id, :auth_token => auth_token} | |
| Returns: {:obsessed => bool} | |
| Sign up: | |
| POST /api/signup | |
| JSON payload: {:user => {:email => email, :password => password, :password_confirmation => password}} | |
| Fetch designers | |
| GET /api/designers | |
| Fetch item types | |
| GET /api/item_types | |
| Fetch sizes | |
| GET /api/sizes | |
| Watch a watchable: | |
| POST /api/watch | |
| JSON payload: {:id => watchable_id, :type => watchable_type, :auth_token => auth_token} | |
| where watchable_type is one of Designer, Spree::OptionValue or Spree::Prototype | |
| Fetch states: | |
| GET /states (auth is optional) | |
| NOTE: this is the default Spree action with default Spree data, so it's in the form of {:country_id => [[state_id,state_name],[...]}. It includes Canadian provinces, but the stuff you (presumably) want is under {"214" => [states]} | |
| Fetch cart: | |
| GET /cart?auth_token=... | |
| NOTE: cart output now includes available shipping methods for the order | |
| Add item to cart: | |
| POST /minipopulate | |
| JSON payload params: auth_token, variant_id, quantity | |
| Remove item from cart: | |
| POST /orders/remove_from_cart | |
| JSON payload params: auth_token, id (the id of the line item) | |
| Checkout address (without using existing addresses): | |
| PUT /checkout/update/address | |
| JSON payload: | |
| { | |
| :state => "address", | |
| :auth_token => auth_token, { | |
| :order => { | |
| :ship_address_attributes => { | |
| :firstname => "Bob", | |
| :lastname => "Jones", | |
| :address1 => "123 Main Street", | |
| :address2 => "", | |
| :city => "Spreeville", | |
| :state_id => "525212995", # TODO: may need to add an endpoint to fetch a list of states | |
| :country_id => "214", # I think we only support U.S., and 214 is the id | |
| :zipcode => "76017", | |
| :phone => "1234567890" | |
| }, | |
| :use_shipping => "1" # if shipping and billing are the same, else submit bill_address_attributes just like ship_address_attributes | |
| } | |
| } | |
| } | |
| Checkout address (with existing addresses): | |
| PUT /checkout/update/address | |
| JSON payload: | |
| { | |
| :state => "address", | |
| :auth_token => auth_token, { | |
| :order => {:bill_address_id => bill_address_id, :ship_address_id => ship_address_id} | |
| } | |
| } | |
| NOTE: I haven't tested this, and we probably need to do something to give you access to available addresses to select from | |
| Checkout payment: | |
| PUT /checkout/update/payment | |
| JSON payload: | |
| { | |
| :auth_token => auth_token, | |
| :payment_source => { | |
| 1 => { | |
| :first_name => "Bob", | |
| :last_name => "Jones", | |
| :number => "4111111111111111", | |
| :month => "12", | |
| :year => "2015", | |
| :verification_value => "123" # CVV | |
| } | |
| }, | |
| :order => { | |
| :payments_attributes => [{:payment_method_id => "1"}], | |
| } | |
| } | |
| Confirm checkout: | |
| PUT checkout/update/confirm | |
| JSON payload: {:auth_token => auth_token, state => "complete"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment