Skip to content

hippasus/ExchangeRates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rate Exchange JSON/JSONP APIs

This is the rate exchange JSON/JSONP APIs project which is deployed at http://rate-exchange.appspot.com/.

Currently only currency and temperature rate exchange are supported.

Usage

Currency API

By invoking the currency API, just send a request to /currency as follow:

/currency?from=USD&to=EUR&q=1&callback=jsonpCallback

And note that the parameter q and callback is optional. One more thing is that the rate fetched from google is cached by 10mins in this application.

Here are some samples:

Request Response
/currency?from=USD&to=EUR {
    "to": "EUR",
    "rate": 0.77966630299999995,
    "from": "USD"
}
/currency?from=USD&to=EUR&q=2 {
    "to": "EUR",
    "rate": 0.77966630299999995,
    "from": "USD",
    "v": 1.5593326059999999
}
/currency?from=USD&to=EUR&callback=jsonpCallback jsonpCallback({
    "to": "EUR",
    "rate": 0.77966630299999995,
    "from": "USD"
})
/currency?from=USD&to=EUR&q=2&callback=jsonpCallback jsonpCallback({
    "to": "EUR",
    "rate": 0.77966630299999995,
    "from": "USD",
    "v": 1.5593326059999999
})
/currency?from=USD {
    "err": "invalid request"
}
/currency?from=USD&to=LAK {
    "err": "not supported rate conversion."
}
/currency?from=MXV&to=USD {
    "err": "Parse error in query. - tokens = 1 MXV =? U.S. dollar"
}

Temperature API

By invoking the temperature API, send a request to /temperature as follows:

/temperature?mode=C2F&q=37

The mode can be C2F(Celsius to Fahrenheit) or F2C(Fahrenheit to Celsius). A jsonp callback parameter is optional. The response is as:

{"v": 98.6, "mode": "C2F", "qty": 37.0}

Help needed!

We've reached the GAE URL Fetch Quota for the currency API. And I need your help to enable billing to get larger quota. Do please help to click this link and donate me $1.00USD.

License

ExchangeRates is released under the MIT license:

Releases

No releases published

Packages

No packages published

Languages