hippasus / ExchangeRates

Rate exchange JSON/JSONP APIs
http://rate-exchange.appspot.com
MIT License
60 stars 27 forks source link

Getting more than one rate in a single request #27

Open DevMunashe opened 10 years ago

DevMunashe commented 10 years ago

I would like to have more than rate returned after making a single request. For exmple i want USD to GBP and i also want want EUR to USD in the same request

something like the following http://rate-exchange.appspot.com/currency?from=EUR&to=INR&from=USD&to=EUR

hippasus commented 10 years ago

Wait.... what is the expected behavior by passing two "from" and two "to". Should I return the rate of EUR-INR, ERU-EUR, USD-INR and USD-EUR?

I don't this this is a good idea.

adrian7 commented 10 years ago

If you want more then one rate you could make more queries. Or you can subscribe to a service providing you with multiple exchange rates for a selected base currency.

hankinsoft commented 9 years ago

Would it be possible to get support for a '?to=USD&from=GBP&from=EUR'? Not sure about others, but for my purpose this would cut down a bunch of requests.

ghost commented 9 years ago

Should be possible in a way like this:

// you only want to provide one value for $from /?from=eur&to=gbp,usd,chf

// get each of the currency from the parameter $currencies = explode(',',$to);

// output them in json {
"from":"eur", "rate":{
"gbp":1.234, "usd":2.134, "chf":3.124 } }