https://github.com/stephanebruckert/fizzbuzz-api
https://github.com/stephanebruckert/fizzbuzz-api
api fizzbuzz rails
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/stephanebruckert/fizzbuzz-api
- Owner: stephanebruckert
- Created: 2017-03-11T23:39:50.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-15T06:02:50.000Z (over 9 years ago)
- Last Synced: 2025-04-07T20:44:19.310Z (about 1 year ago)
- Topics: api, fizzbuzz, rails
- Language: Ruby
- Homepage: http://fibuzzapi.herokuapp.com/api/numbers
- Size: 40 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FizzBuzz-api
An API to retrieve [FizzBuzz](https://en.wikipedia.org/wiki/Fizz_buzz) numbers.
> Fizz buzz is a group word game for children to teach them about division.[1] Players take turns to count incrementally, replacing any number divisible by three with the word "fizz", and any number divisible by five with the word "buzz".
## A single endpoint
/api/numbers
### Optional query parameters
- `limit` (*integer*), the amount of items to retrieve (min: 1, max: 200, default: 100)
- `offset` (*integer*), the amount of items to skip (min: 1, max: 100 billions, default: 1)
### Examples
#### Successful requests
- http://fibuzzapi.herokuapp.com/api/numbers
- http://fibuzzapi.herokuapp.com/api/numbers?limit=100&offset=500
- http://fibuzzapi.herokuapp.com/api/numbers?offset=150&limit=3
{
"numbers": [
{
"id": 150,
"value": "FizzBuzz"
},
{
"id": 151,
"value": 151
},
{
"id": 152,
"value": 152
}
]
}
#### Erroneous requests
- http://fibuzzapi.herokuapp.com/api/numbers?limit=1000
{
"error": {
"title": "Limit exceeded",
"status": 400,
"code": 1,
"detail": "The limit of items per page can't be more than 200."
}
}
- http://fibuzzapi.herokuapp.com/api/numbers?offset=200000000000
{
"error": {
"title": "Offset exceeded",
"status": 400,
"code": 2,
"detail": "The offset can't be more than 100 billion (100000000000)."
}
}
- http://fibuzzapi.herokuapp.com/api/numbers?offset=99999999950&limit=100
{
"error": {
"title": "Boundaries exceeded",
"status": 400,
"code": 3,
"detail": "This offset with this limit would exceed 100 billion."
}
}