Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
src
 
 
 
 
www
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

DiceApi

Build Status Scrutinizer Code Quality

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.

Rolling

Roll a single dice

GET http://roll.diceapi.com/json/d6

Response:

{
  "success":true,
  "dice":[
    {"value":2,"type":"d6"}
  ]
}

Roll multiple dice

GET http://roll.diceapi.com/json/d6/d20

Response:

{
  "success":true,
  "dice":[
    {"value":2,"type":"d6"},
    {"value":18,"type":"d20"}
  ]
}

Roll batches of dice

GET http://roll.diceapi.com/json/2d6/d4

Response:

{
  "success":true,
  "dice":[
    {"value":2,"type":"d6"},
    {"value":4,"type":"d6"},
    {"value":3,"type":"d4"}
  ]
}

Response types

By default the API assumes you want an html response. You have other options though:

text/html

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" />

dice with 4 spots

application/json

curl --header "Accept: application/json" http://roll.diceapi.com/d6

GET http://roll.diceapi.com/json/d6

About

🎲 Heroku app to roll some dice

Resources

License

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.