Please don't submit pull requests or patches here
Go to file
Cadey Ratio 9996db4179 Merge pull request #9 from PonyFrance/feature-newEP
Added S6 episodes 11 and 12
2016-05-16 14:51:56 -07:00
client don't fail in nim for hiatus 2016-01-16 08:17:08 -08:00
public/static update nim docs 2015-08-17 15:01:47 -07:00
run add run artifacts 2016-01-16 08:00:22 -08:00
.dockerignore Initial commit 2015-08-09 12:51:43 -07:00
.gitattributes vendor the clients 2016-01-16 08:27:10 -08:00
.gitignore fix gitignore and permissions 2015-08-18 16:40:45 -07:00
Dockerfile Fix for Nim 0.12 2016-01-16 07:45:10 -08:00
LICENSE Initial commit 2015-08-09 12:51:43 -07:00
Makefile Serve /all 2015-08-13 19:47:00 -07:00
README.md Update README 2016-01-16 08:31:43 -08:00
episode.nim split off episode manipulation code into its own module 2015-08-15 10:59:53 -07:00
fim.list Added S6 episodes 11 and 12 2016-05-14 16:30:51 +02:00
ponyapi.nim Revert "fix newest/last aired routes" 2016-04-22 06:17:42 -07:00
ponyapi.nimble implement remaining API calls 2015-08-13 20:51:03 -07:00
stats.nim Collect and report statistics about usage of the api server 2015-08-27 20:32:07 -07:00

README.md

PonyAPI

A simple API for episodes of My Little Pony: Friendship is Magic to be run inside a container.

API Usage

An episode will have the following data type:

{
      "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.

Usage Limits

None. Don't make the server it's running on crash and we'll all be good.

Clients

Routes

The canonical route base for PonyAPI is https://ponyapi.apps.xeserv.us. This now supports HTTP/2.0 using Caddy and SSL using Let's Encrypt. If you get SSL errors, please be sure your system certificate lists are up to date. Example usage:

$ curl https://ponyapi.apps.xeserv.us/season/1/episode/1
{
  "episode": {
    "air_date": 1286735400,
    "episode": 1,
    "is_movie": false,
    "name": "Friendship is Magic Part 1",
    "season": 1
  }
}

Bare Replies

As of 882b5b1, 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:

$ curl --header "X-API-Options: bare" https://ponyapi.apps.xeserv.us/last_aired
{
    "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.

/all

Returns all information about all episodes. This returns an array of Episode objects as defined above.

/newest

Returns the episode of My Little Pony: Friendship is Magic that will air next.

/last_aired

Returns the episode of My Little Pony: Friendship is Magic that most recently aired.

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

/season/<number>/episode/<number>

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.

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.

Contributing

Contributions will be judged by their technical merit. No politics on project forums.

All code is licensed under the MIT license.