2015-08-09 19:48:49 +00:00
|
|
|
PonyAPI
|
|
|
|
=======
|
|
|
|
|
2015-08-09 20:36:30 +00:00
|
|
|
A simple API for episodes of My Little Pony: Friendship is Magic to be run
|
2015-08-09 19:48:49 +00:00
|
|
|
inside a container.
|
2015-08-09 20:36:30 +00:00
|
|
|
|
|
|
|
API Usage
|
|
|
|
---------
|
|
|
|
|
|
|
|
An episode will have the following data type:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"air_date": 1286735400,
|
|
|
|
"episode": 1,
|
|
|
|
"is_movie": false,
|
|
|
|
"name": "Friendship is Magic Part 1",
|
|
|
|
"season": 1
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
This represents Season 1, Episode 1 of My Little Pony: Friendship Is Magic. The
|
|
|
|
`air_date` column represents the date and time that the episode was originally
|
|
|
|
shown on The Hub (now Discovery Family Network). If `is_movie` is set and the
|
|
|
|
season number is `99`, the episode record should be treated as a movie.
|
|
|
|
|
2015-08-09 20:55:22 +00:00
|
|
|
Usage Limits
|
|
|
|
------------
|
|
|
|
|
|
|
|
None. Don't make the server it's running on crash and we'll all be good.
|
|
|
|
|
2015-08-09 20:52:17 +00:00
|
|
|
Clients
|
|
|
|
-------
|
|
|
|
|
2015-08-13 01:09:49 +00:00
|
|
|
- [Go](https://godoc.org/github.com/Xe/PonyAPI/client/go)
|
|
|
|
- [Nim](https://github.com/Xe/PonyAPI/blob/master/client/nim/ponyapi.nim) [Docs](http://ponyapi.apps.xeserv.us/static/nim.html)
|
2015-08-13 01:17:05 +00:00
|
|
|
- [Python](https://github.com/Xe/PonyAPI/blob/master/client/python/ponyapi.py)
|
2015-08-19 22:10:53 +00:00
|
|
|
- [Java](https://github.com/Xe/PonyAPI/tree/master/client/java)
|
2015-08-09 20:52:17 +00:00
|
|
|
|
|
|
|
Routes
|
|
|
|
------
|
|
|
|
|
2016-01-16 16:31:43 +00:00
|
|
|
The canonical route base for PonyAPI is `https://ponyapi.apps.xeserv.us`. This
|
|
|
|
now supports HTTP/2.0 using [Caddy](https://caddyserver.com) and SSL using
|
|
|
|
[Let's Encrypt](https://letsencrypt.org/). If you get SSL errors, please be
|
|
|
|
sure your system certificate lists are up to date.
|
|
|
|
Example usage:
|
2015-08-09 20:52:17 +00:00
|
|
|
|
|
|
|
```console
|
2016-01-16 16:31:43 +00:00
|
|
|
$ curl https://ponyapi.apps.xeserv.us/season/1/episode/1
|
2015-08-09 20:52:17 +00:00
|
|
|
{
|
|
|
|
"episode": {
|
|
|
|
"air_date": 1286735400,
|
|
|
|
"episode": 1,
|
|
|
|
"is_movie": false,
|
|
|
|
"name": "Friendship is Magic Part 1",
|
|
|
|
"season": 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2015-09-08 23:23:22 +00:00
|
|
|
Bare Replies
|
|
|
|
------------
|
|
|
|
|
|
|
|
As of [882b5b1](https://github.com/Xe/PonyAPI/commit/882b5b155157d3a3c9e329fffcf7ff3fdf64d4ee),
|
|
|
|
PonyAPI will accept an `X-API-Options` header that when set to `bare` will
|
|
|
|
return the API replies without the `episode` or `episodes` header.
|
|
|
|
Functionality is otherwise unchanged, however an error will still be shown if
|
|
|
|
something goes wrong, and that will parse differently. This API will return
|
|
|
|
`200` if and **only** if everything went to plan.
|
|
|
|
|
|
|
|
An example:
|
|
|
|
|
|
|
|
```console
|
2016-01-16 16:31:43 +00:00
|
|
|
$ curl --header "X-API-Options: bare" https://ponyapi.apps.xeserv.us/last_aired
|
2015-09-08 23:23:22 +00:00
|
|
|
{
|
|
|
|
"name": "Do Princesses Dream of Magic Sheep?",
|
|
|
|
"air_date": 1436628600,
|
|
|
|
"season": 5,
|
|
|
|
"episode": 13,
|
|
|
|
"is_movie": false
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
This will also be triggered if you set the query parameter `options` to `bare`.
|
|
|
|
|
2015-08-09 20:36:30 +00:00
|
|
|
### `/all`
|
|
|
|
|
|
|
|
Returns all information about all episodes. This returns an array of Episode
|
|
|
|
objects as defined above.
|
|
|
|
|
2015-08-09 21:09:24 +00:00
|
|
|
### `/newest`
|
|
|
|
|
|
|
|
Returns the episode of My Little Pony: Friendship is Magic that will air next.
|
|
|
|
|
2015-08-17 21:32:05 +00:00
|
|
|
### `/last_aired`
|
|
|
|
|
|
|
|
Returns the episode of My Little Pony: Friendship is Magic that most recently
|
|
|
|
aired.
|
|
|
|
|
2015-08-09 20:36:30 +00:00
|
|
|
### `/season/<number>`
|
|
|
|
|
|
|
|
Returns all information about episodes in the given season number or a `404`
|
|
|
|
reply if no episodes could be found. To get all information about the movies
|
|
|
|
shown, set the season as `99`.
|
|
|
|
|
2015-08-28 23:15:06 +00:00
|
|
|
### `/season/<number>/episode/<number>`
|
2015-08-09 20:36:30 +00:00
|
|
|
|
|
|
|
Returns all information about the episode with the given season and episode
|
|
|
|
number. If the episode cannot be found, this will return a `404`.
|
|
|
|
|
|
|
|
### `/random`
|
|
|
|
|
|
|
|
Returns a random episode record from the list of episodes.
|
|
|
|
|
|
|
|
### `/search`
|
|
|
|
|
|
|
|
This must be given a query paramater `q` containing the text to search for. Not
|
|
|
|
including this will return a `406` reply. This will search the list of episode
|
|
|
|
records for any episodes whose names match the given search terms. This is
|
|
|
|
case-insensitive. If no episodes can be found, this will return a `404` reply.
|
2015-09-09 06:34:14 +00:00
|
|
|
|
|
|
|
Contributing
|
|
|
|
------------
|
|
|
|
|
|
|
|
Contributions will be judged by their technical merit. No politics on project forums.
|
|
|
|
|
|
|
|
All code is licensed under the MIT license.
|