Skip to content

meadsteve/DiceApi

Repository files navigation

DiceApi

Docker Image CI 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.

Retired !! 🛌🏼

The API is no longer available at roll.diceapi.com. I decided to drop the domain to free up money for more domains.

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

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published