Dice Roll

FREEMIUM
By Steven Thacher | Updated a month ago | Gaming
Popularity

8.5 / 10

Latency

551ms

Service Level

98%

Health Check

N/A

README

Dice Roll API - README

Overview

The Dice Roll API provides endpoints for simulating dice rolls. It allows clients to request a roll of a single die with a specified number of sides, multiple dice rolls at once, and retrieving the result of a previous roll using its UUID.

Endpoints

1. Single Dice Roll

  • Endpoint: /api/roll/single/:sides
  • Method: GET
  • Description: Roll a single die with a specified number of sides.
  • Parameters:
    • sides: Number of sides of the die.
    • store: Optional query parameter to store the roll result.
  • Response:
    • On success: JSON object containing the roll result and, if stored, the roll ID.
    • On error: Error message.
# Roll a 6-sided die without storing the result
curl https://yourapiurl.com/api/roll/single/6

# Roll a 20-sided die and store the result
curl https://yourapiurl.com/api/roll/single/20?store=true

2. Multiple Dice Roll

  • Endpoint: /api/roll/multiple
  • Method: POST
  • Description: Roll multiple dice as specified in the request body.
  • Request Body:
    • JSON object specifying the types and number of dice.
  • Parameters:
    • store: Optional query parameter to store the roll results.
  • Response:
    • On success: JSON object containing the roll results and, if stored, the roll ID.
    • On error: Error message.
# Roll multiple dice without storing the results
curl -X POST -H "Content-Type: application/json" \
     -d '{"dice":[{"sides":6, "rolls":2}, {"sides":10, "rolls":1}]}' \
     https://yourapiurl.com/api/roll/multiple

# Roll multiple dice and store the results
curl -X POST -H "Content-Type: application/json" \
     -d '{"dice":[{"sides":6, "rolls":2}, {"sides":10, "rolls":1}]}' \
     https://yourapiurl.com/api/roll/multiple?store=true

3. Get Dice Roll

  • Endpoint: /api/roll
  • Method: GET
  • Description: Retrieve the result of a stored dice roll using its UUID.
  • Query Parameters:
    • uuid: UUID of the stored dice roll.
  • Response:
    • On success: JSON object containing the stored roll data.
    • On error: Error message indicating roll not found or UUID not provided.
# Retrieve a dice roll with a specific UUID
curl https://yourapiurl.com/api/roll?uuid=your-uuid-here
Followers: 0
API Creator:
Rapid account: Steven Thacher
Steven Thacher
sthacher
Log In to Rate API
Rating: 5 - Votes: 1