This is a semi joking api to simulate a pile of dice being thrown. The idea is fully inspired by/stolen from deckofcardsapi.com. If you find any bugs or have feature requests, the project can be found on github at DiceApi on GitHub or send me a tweet @MeadSteve.
The API is no longer available at roll.diceapi.com. I decided to drop the domain to free up money for more domains.
GET http://roll.diceapi.com/json/d6
Response:
{
"success":true,
"dice":[
{"value":2,"type":"d6"}
]
}
GET http://roll.diceapi.com/json/d6/d20
Response:
{
"success":true,
"dice":[
{"value":2,"type":"d6"},
{"value":18,"type":"d20"}
]
}
GET http://roll.diceapi.com/json/2d6/d4
Response:
{
"success":true,
"dice":[
{"value":2,"type":"d6"},
{"value":4,"type":"d6"},
{"value":3,"type":"d4"}
]
}
By default the API assumes you want an html response. You have other options though:
This response type currently only supports d6 and d20 rolls.
curl --header "Accept: text/html" http://roll.diceapi.com/d6
GET http://roll.diceapi.com/html/d6
Response:
<img src="http://roll.diceapi.com/images/poorly-drawn/d6/4.png" />
curl --header "Accept: application/json" http://roll.diceapi.com/d6
GET http://roll.diceapi.com/json/d6