jihopark / plainX-turkey

2 stars 0 forks source link

Changes for multi-locations #21

Closed loong closed 8 years ago

loong commented 8 years ago

offer/list can now query for Locations as well. http://plainexchange.herokuapp.com/api/v1/offer/list?Page=1&Locations=HKUST,CUHK

offer/list also returns the locations:

   "Data":{
      "Id":47,
      "SellerId":11,
      "AmountSell":4000,
      "AmountBuy":510,
      "Sell":"HKD",
      "Buy":"HKD",
      "Locations":[
         "HKUST",
         "HKU"
      ],
      "Expires":-1,
      "Created":1448720766
   }

offer/confirm also checks for location. Note that the format is as follows: &Locations=[loc1],[loc2] http://plainexchange.herokuapp.com/api/v1/offer/confirm?Sell=HKD&Buy=USD&AmountSell=100&AmountBuy=7.5&Locations=HKUST,HKU

For posting offers, the new JSON schema is as follows. I kept the string format similar to the offer/confirm, so you can just pass the same string you get from offer/confirm page instead of creating a JSON array. If you rather prefer to send it as a JSON array, I can change that.

 {"AmountSell": 2000, "AmountBuy": 258, "Sell": "HKD", "Buy": "HKD", "Locations": "HKUST,CUHK"}
jihopark commented 8 years ago

it works as intended. i won't send any locations for offer/list for now.