Although I am not yet fully happy with it the API is now online
![Wink](https://bitcointalk.org/Smileys/default/wink.gif)
. I will certainly add some more stuff (oAuth authentication, better response/error messages, ...) but the general idea will stay like it is now.
The API follows the REST scheme, which means you can create, read, update and delete your agents and notification settings with standard http POST/GET/PUT/DELETE operations.
Currently only basic authentication is in place, so you have to provide user and password with each request, which of course is quite inconvinient... Next thing to add is oAuth token-based authentication.
Note: Be sure to always include the trailing slash in any url!
Get information about all your agents:Browser:
http://www.bitcoinmonitor.net/api/v1/agents/Commandline using curl:
curl -i -u <user>:<password> http://www.bitcoinmonitor.net/api/v1/agents/
Create a new agent:You need to provide only 2 parameters:
- name: The agents name
- watch_type: "1" for notification on withdrawal, "2" for notificatoin on deposits, "3" for both notifications
- addresses: (optional) list of addresses to watch, seperated by comma
curl -i -u <user>:<password> -X POST -d "name=new_agent&watch_type=2" http://www.bitcoinmonitor.net/api/v1/agents/
Change an existing agent:You need to know the ID of the agent (get it from the agent list). You can set:
- name: The agents name
- watch_type: "1" for notification on withdrawal, "2" for notificatoin on deposits, "3" for both notifications
- addresses: list of addresses to watch, seperated by comma
curl -i -u <user>:<password> -X PUT -d "addresses=<bitcoin addresses seperated by comma>" http://www.bitcoinmonitor.net/api/v1/agent/<agent_ID>/
Delete an existing agent:You need to know the ID of the agent (get it from the agent list).
curl -i -u <user>:<password> -X DELETE http://www.bitcoinmonitor.net/api/v1/agent/<agent_ID>/
Get notification settings for an agent:You need to know the ID of the agent you want to work with (get it from the agent list). You need to provide the notification type you want to access:
curl -i -u <user>:<password> http://www.bitcoinmonitor.net/api/v1/agent/<agent_ID>/notification/<notification_type>/
Create new notification setting:You need to know the ID of the agent you want to work with (get it from the agent list). Required parameters:
- req_confirmations: Confirmations required, 0 to 10
- email: email (required for type "email")
curl -i -u <user>:<password> -X POST -d "req_confirmations=0" http://www.bitcoinmonitor.net/api/v1/agent/<agent_ID>/notification/feed/
curl -i -u <user>:<password> -X POST -d "req_confirmations=0&email=me@here.com" http://www.bitcoinmonitor.net/api/v1/agent/<agent_ID>/notification/email/
curl -i -u <user>:<password> -X POST -d "req_confirmations=0&url=http://my.shop.com/payment_confirmation/" http://www.bitcoinmonitor.net/api/v1/agent/<agent_ID>/notification/url/
List bitcoinaddresses watched by agent:You need to know the ID of the agent you want to work with (get it from the agent list)
curl -i -u <user>:<password> http://www.bitcoinmonitor.net/api/v1/agents/<agent_id>/address/
Add a bitcoinaddress to an agent:You need to provide 1 parameters:
- address: address to watch
curl -i -u <user>:<password> -X POST -d "address=<address>" http://www.bitcoinmonitor.net/api/v1/agent/<agent_id>/address/
Remove a bitcoinaddress from an agent:No parameters as address is the ressource and part of url:
curl -i -u <user>:<password> -X DELETE http://www.bitcoinmonitor.net/api/v1/agent/<agent_id>/address/<address>
The agent_ID is guaranteed to never change once an agent is created. So if you have an agent set up it is safe to hardcode its ID in your code.
As all this is still not matured I will not add API documentation to the site itself. As soon as i got some user feedback and added the missing stuff I will also extend the documentation.