CodaCoin


Codacoin API

Endpoint:

http://codacoin.com/api/public.php

Requests:


- codacoin
- convert
- validate
- saveaddress


Codacoin Bitcoin Price


Endpoint: http://codacoin.com/api/public.php?request=codacoin
Output Format: json

Parameters:
decimal - (int) The amount of decimal places to show.
currency - (Currency code: 3 Capital letters)

Example Request: http://codacoin.com/api/public.php?request=codacoin Example Result: {"currency":"USD","average_bitcoin_price":"435.180","twenty_four_hour_high":"445.642","twenty_four_hour_low":"425.325","fifteen_minute_high":"436.257","fifteen_minute_low":"435.163","timestamp":1450730458} Example 2 Request: http://codacoin.com/api/public.php?request=codacoin&decimal=2&currency=GBP Example 2 Result: {"currency":"GBP","average_bitcoin_price":"292.10","twenty_four_hour_high":"299.22","twenty_four_hour_low":"285.58","fifteen_minute_high":"292.10","fifteen_minute_low":"291.82","timestamp":1450732155} Php Example Code:
$request = 'codacoin'; $decimal = '2'; $currency = 'USD'; $bitcoin_price = file_get_contents("http://codacoin.com/api/public.php?request=$request&decimal=$decimal&currency=$currency"); $json = json_decode($bitcoin_price); $average = $json->average_bitcoin_price; $high24 = $json->twenty_four_hour_high; $low24 = $json->twenty_four_hour_low; $high15 = $json->fifteen_minute_high; $low15 = $json->fifteen_minute_low; $timestamp = $json->timestamp; echo 'Average Bitcoin Price: ' . $average . '<br>24 Hour High: ' . $high24 . '<br>24 Hour Low: ' . $low24; echo '<br>15 Minute High: ' . $high15 . '<br>15 Minute Low: ' . $low15 . '<br>Timestamp: ' . $timestamp;


BTC Conversion API


Endpoint:

http://codacoin.com/api/public.php?request=convert

Parameters:

- type
- denom
- exchange
- input
- currency
- decimal

Example request: http://codacoin.com/api/public.php?request=convert&type=btctofiat&input=1&symbol=enabled&decimal=2&exchange=average&currency=USD&denom=bitcoin Result: $439.20

Parameter options:


request:
convert - Enables the convert btc API

type:
btctofiat - Converts from Bitcoin to your fiat currency.
fiattobtc - Converts from your fiat currency to Bitcoin.

denom: (denomination)
bitcoin
cbtc
mbtc
ubtc
satoshi

exchange: (Converts using the selected exchange)
average
coinbase
bitfinex
btce
bitstamp
okcoin
itbit
coinsetter
kraken
sochain

input:
(float) The amount to convert.

decimal:
(int) The amount of decimal places to show.

symbol:
enabled - When enabled, the currency stymbol will be displayed.

currency: (The output currency.) Note: Currency must be capitalized in the request.
USD
EUR
CAD
AUD
CNY
BGN
BRL
CHF
CZK
DKK
GBP
HKD
HRK
HUF
IDR
ILS
INR
JPY
KRW
MXN
MYR
NOK
NZD
PHP
PLN
RON
RUB
SEK
SGD
THB



Validate Bitcoin Address


Endpoint: http://codacoin.com/api/public.php?request=validate
Parameters:
address - Bitcoin address to validate.

Example Request:
http://codacoin.com/api/public.php?request=validate&address=14xgx8cCmvkbBQxeKEsSVNMrNFacgWTN9j Example Result: Valid


Save Bitcoin Address


Endpoint: http://codacoin.com/api/public.php?request=saveaddress
Parameters:
-key
-savekey
-saveaddress

Request:
http://codacoin.com/api/public.php?request=saveaddress&key=thisismykey Result: 14xgx8cCmvkbBQxeKEsSVNMrNFacgWTN9j
Save Request:
http://codacoin.com/api/public.php?request=saveaddress&saveaddress=14xgx8cCmvkbBQxeKEsSVNMrNFacgWTN9j&savekey=thisismykey Result: Your address has been saved.
Errors: You must include a key. This key already exists. This key does not exist. Address is not valid. Requirements:
-Bitcoin Address must be valid
-Key must not have been previously used by someone else