A simple Rack application that provides a REST interface to Coin's API.
$ gem install coin_rack
$ coin_rack --run
$ curl --data "value=true" http://localhost:9292/example.json
{"example":true}
$ curl http://localhost:9292/example.json
{"example":true}
$ curl -X DELETE http://localhost:9292/example.json
{"example":true}
$ curl http://localhost:9292/example.json
{"example":null}
$ curl --data "value=true" http://localhost:9292/example.xml
<?xml version="1.0" encoding="UTF-8"?>
<hash>
<example type="boolean">true</example>
</hash>
$ curl http://localhost:9292/example.xml
<?xml version="1.0" encoding="UTF-8"?>
<hash>
<example type="boolean">true</example>
</hash>
$ curl -X DELETE http://localhost:9292/example.xml
<?xml version="1.0" encoding="UTF-8"?>
<hash>
<example type="boolean">true</example>
</hash>
$ curl http://localhost:9292/example.xml
<?xml version="1.0" encoding="UTF-8"?>
<hash>
<example nil="true"/>
</hash>
cache key
|
http://localhost:9292/KEY.FORMAT
|
response format
Note: The XML format is also supported but XML examples have been omitted for brevity.
Create and/or update the key to a new value.
http://localhost:9292/example.json
value=true
"{\"example\":\"true\"}"
Get the current value for the specified key.
http://localhost:9292/example.json
"{\"example\":\"true\"}"
Deletes the key.
http://localhost:9292/example.json
Note the value returned is the value that was deleted.
"{\"example\":true}"