How to use our iPhone Currency Converter
Converting currencies using our Objective C Exchange Rate API is as easy as posting a HTTP request. Your requests would need to follow
this simple pattern:
http://www.exchangerate-api.com/FROM_CURRENCY/TO_CURRENCY/AMOUNT?k=YOUR_API_KEY
Here are some examples in Objective C:
To convert from 12.50 USD (US Dollar) to GBP (British Pound):
label.text = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://www.exchangerate-api.com/USD/GBP/12.50?k=API_KEY"]
encoding:CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000)
error:NULL];
encoding:CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000)
error:NULL];
Or to get how many Japanese Yen (JPY) there are to the South African Rand (ZAR):
label.text = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://www.exchangerate-api.com/zar/jpy?k=API_KEY"]
encoding:CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000)
error:NULL];
encoding:CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000)
error:NULL];
Error Codes:
The API returns the following error codes:-1 if an invalid amount is used (must be numeric floating point or integer numbers)
-2 if either of the 3 letter currency codes are invalid (Check our supported currencies)
-3 if an invalid key is used (Get an API key)
-4 if your monthly API query limit is reached (Click here for extended usage)
-5 if an unresolvable IP address is provided (This only applies for our "Automatic Country/Flag Information" query.)
How Our API Works
Python
PHP
Ruby
Perl
ASP.NET
Java
Applescript
iPhone C