Code Monkey home page Code Monkey logo

ghibliapi's Introduction

Studio Ghibli API

December 1 2022 - Heroku is charging for apps now, so I'm archiving this. Feel free to fork and host another version

The Studio Ghibli API catalogs the people, places, and things found in the worlds of Ghibli. It was created to help users discover resources, consume them via HTTP requests, and interact with them in whatever way makes sense. Navigation can be found on the left sidebar, and the right sidebar shows examples of returned objects for successful calls.

Endpoints

  • Films
  • People
  • Locations
  • Species
  • Vehicles

Getting Started

Requests can be made with curl or other helper libraries by following regular REST calls. Examples are provided for Ruby and Python with a use case in Haskell. For example, here is how to GET the resource for the film My Neighbor Tororo:

curl https://ghibliapi.herokuapp.com/films/58611129-2dbc-4a81-a72f-77ddfc1b1b49

Calling this resource will respond with the following object:

{
  "id": "58611129-2dbc-4a81-a72f-77ddfc1b1b49",
  "title": "My Neighbor Totoro",
  "description": "Two sisters move to the country with their father in order to be closer to their hospitalized mother, and discover the surrounding trees are inhabited by Totoros, magical spirits of the forest. When the youngest runs away from home, the older sister seeks help from the spirits to find her.",
  "director": "Hayao Miyazaki",
  "producer": "Hayao Miyazaki",
  "release_date": "1988",
  "rt_score": "93",
  ...
}

Helper libraries

Elixir

Go

GraphQL

R

Python2 and Python3

Examples

Swift (iOS)

Android

Haskell

Datascript and Clojure

JavaScript

Resources

This API was built using JSON Server, ReDoc, and looking through swapi.co

ghibliapi's People

Contributors

armellarcier avatar atlc avatar barrettcoats avatar catusking avatar codewritingcow avatar darwindev avatar incognito avatar jackelder avatar janaipakos avatar joshfindit avatar jyntran avatar kxvn-lx avatar mikelbook avatar phinnaeus avatar sararekowska avatar sydrawat01 avatar thefetts avatar zibaire avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ghibliapi's Issues

500 Internal Error caused by invalid array lenght

Hello, during the usage of your API instance on Heroku, some of my requests obtained a 500 Internal Error, caused by an invalid array length.

In the species endpoint, with the following request I got the following response:
/species?fields=IPcJyhzl&limit=-824525682274219948

RangeError: Invalid array length
    at Function.router.render (/app/src/app.js:46:19)
    at /app/node_modules/json-server/src/server/router/index.js:77:12
    at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/app/node_modules/express/lib/router/index.js:317:13)
    at /app/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
    at next (/app/node_modules/express/lib/router/index.js:275:10)
    at /app/node_modules/express/lib/router/index.js:635:15
    at next (/app/node_modules/express/lib/router/index.js:260:14)
    at next (/app/node_modules/express/lib/router/route.js:127:14)

In the locations endpoint, with the following request I got the following response:
/locations?fields=tqkdIGXe&limit=-5144637366675912606

RangeError: Invalid array length
    at Function.router.render (/app/src/app.js:46:19)
    at /app/node_modules/json-server/src/server/router/index.js:77:12
    at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/app/node_modules/express/lib/router/index.js:317:13)
    at /app/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
    at next (/app/node_modules/express/lib/router/index.js:275:10)
    at /app/node_modules/express/lib/router/index.js:635:15
    at next (/app/node_modules/express/lib/router/index.js:260:14)
    at next (/app/node_modules/express/lib/router/route.js:127:14)

When accessing a singular object from any endpoint, if that single item has a `.length` property, it is evaluated by Math.min against the constant `defaultLimit`.

For example, in the /vehicles endpoint, if you retrieve all vehicles from that endpoint, it returns an array of all the vehicles. Since the data variable is defined as an array, the .length property successfully shortens the length of the array, creating a limit to the amount of results.

If you attempt to access a single resource, like /vehicles/4e09b023-f650-4747-9ab9-eacf14540cfb, that data variable is now represented as an object. Since objects don't have an inherit .length property to them, the .length property of the data is being mutated. This doesn't pose an issue anywhere else except the vehicles endpoint, where the objects do have that property.

Furthermore, if the length of the vehicle itself is shorter than the defaultLimit value, the data goes by unmodified. If a vehicle is longer than defaultLimit, it is overridden to defaultLimit. If the vehicle is longer than 999, Math.min will return NaN because the length property is initially stored as a string with commas.

My suggestion would be omitting modifying data.length altogether in the event a single resource is requested. If someone is requesting just a single item, they'll only have that single object returned.

Bug in app.js with proposed fix

Hi James!

Thanks for your awesome API.

My company is developing a service for automated testing of GitHub apps, and while testing it out on some public repos we found the following bug on this line.

      data.length = Math.min(Math.min(query.limit, data.length), maxLimit)

If query.limit is negative, it will cause the server to crash. A fix could be to do, for example, Math.max(query.limit, 0).

We really enjoyed testing your app with Meeshkan, and if you find this bug report useful, I'd encourage you to sign up for free alpha access at https://meeshkan.com. Thanks again for your great work!

api iconsistency

When fetching
curl -X GET -H "Content-Type: application/json" https://ghibliapi.herokuapp.com/people/34277bec-7401-43fa-a00a-5aee64b45b08
it returns
{ "id": "34277bec-7401-43fa-a00a-5aee64b45b08", "name": "Eboshi", "gender": "Female", "age": "Unspecified/Adult", "eye_color": "Hazel", "hair_color": "Black", "films": [ "https://ghibliapi.herokuapp.com/films/0440483e-ca0e-4120-8c50-4c8cd9b965d6" ], "species": "https://ghibliapi.herokuapp.com/species/af3910a6-429f-4c74-9ad5-dfe1c4aa04f2", "url": "https://ghibliapi.herokuapp.com/people/34277bec-7401-43fa-a00a-5aee64b45b08" }

it returns an array of films, with one link, but a string for species.
It's a very low priority issue, and I locally handle the issue, but I guess the fewer iconsistencies, the better.

Implement image for each people (enhancement)

Hi! hope u are fine! this is not an issue but i realize the api has no people images, just charateristics like (age, eyes color, hair color, etc) Would be nice implement selfies/pics for each character to make the API more dynamic and beautiful, greetings!

More complete Haskell example?

Hey, this looks cool, and I like that it has a Haskell use case... but a more complete example would be cool—or a pointer to a tutorial to write it. But if you wrote it, compiled it, and still have it, the full thing would be cool ;-). Assuming it isn't complete already, and it doesn't seem to be.

And the full thing doesn't need to be in the website, just to be somewhere... From Aeson docs it seems you need to write GhibliCatResponse, GhibliCatResult and so on—or if they can be generated, the given code seems not enough. Also, T.pack seems not in scope (though here I can guess that's probably from Text)...

But in fairness: I don't need this to build something on it—it honestly just took me a while to figure out how the other code was generated (and to guess it wasn't, and I'm still not sure).

Feature request: Convert all IDs to v4 UUID

A pleasant surprise as an API, thank you.

UUIDs have the benefits of being globally unique, which means that if someone brings in data from an API that returns a UUID, they can use that UUID as the internal ID as well.

If IDs are returned sequentially, the API caller have to create a different ID internally and then map it to the external ID for later updates.

Films do not list locations or people even if there are locations or people that refer to the film

This is a result from: https://ghibliapi.herokuapp.com/locations
{ "id": "11014596-71b0-4b3e-b8c0-1c4b15f28b9a", "name": "Irontown", "climate": "Continental", "terrain": "Mountain", "surface_water": "40", "residents": [ "https://ghibliapi.herokuapp.com/people/ba924631-068e-4436-b6de-f3283fa848f0", "https://ghibliapi.herokuapp.com/people/030555b3-4c92-4fce-93fb-e70c3ae3df8b" ], "films": [ "https://ghibliapi.herokuapp.com/films/0440483e-ca0e-4120-8c50-4c8cd9b965d6" ], "url": [ "https://ghibliapi.herokuapp.com/locations/11014596-71b0-4b3e-b8c0-1c4b15f28b9a" ] },

if you use the film id to fetch https://ghibliapi.herokuapp.com/films/0440483e-ca0e-4120-8c50-4c8cd9b965d6
you get
{ "id": "0440483e-ca0e-4120-8c50-4c8cd9b965d6", "title": "Princess Mononoke", "description": "Ashitaka, a prince of the disappearing Ainu tribe, is cursed by a demonized boar god and must journey to the west to find a cure. Along the way, he encounters San, a young human woman fighting to protect the forest, and Lady Eboshi, who is trying to destroy it. Ashitaka must find a way to bring balance to this conflict.", "director": "Hayao Miyazaki", "producer": "Toshio Suzuki", "release_date": "1997", "rt_score": "92", "people": [ "https://ghibliapi.herokuapp.com/people/ba924631-068e-4436-b6de-f3283fa848f0", "https://ghibliapi.herokuapp.com/people/ebe40383-aad2-4208-90ab-698f00c581ab", "https://ghibliapi.herokuapp.com/people/030555b3-4c92-4fce-93fb-e70c3ae3df8b", "https://ghibliapi.herokuapp.com/people/ca568e87-4ce2-4afa-a6c5-51f4ae80a60b", "https://ghibliapi.herokuapp.com/people/e9356bb5-4d4a-4c93-aadc-c83e514bffe3", "https://ghibliapi.herokuapp.com/people/34277bec-7401-43fa-a00a-5aee64b45b08", "https://ghibliapi.herokuapp.com/people/91939012-90b9-46e5-a649-96b898073c82", "https://ghibliapi.herokuapp.com/people/20e3bd33-b35d-41e6-83a4-57ca7f028d38", "https://ghibliapi.herokuapp.com/people/8bccdc78-545b-49f4-a4c8-756163a38c91", "https://ghibliapi.herokuapp.com/people/116bfe1b-3ba8-4fa0-8f72-88537a493cb9" ], "species": [ "https://ghibliapi.herokuapp.com/species/af3910a6-429f-4c74-9ad5-dfe1c4aa04f2", "https://ghibliapi.herokuapp.com/species/6bc92fdd-b0f4-4286-ad71-1f99fb4a0d1e", "https://ghibliapi.herokuapp.com/species/f25fa661-3073-414d-968a-ab062e3065f7" ], "locations": [ "https://ghibliapi.herokuapp.com/locations/" ], "vehicles": [ "https://ghibliapi.herokuapp.com/vehicles/" ], "url": "https://ghibliapi.herokuapp.com/films/0440483e-ca0e-4120-8c50-4c8cd9b965d6", "length": null }

the same happens for many movies, often they do not list locations, people, vehicles, species even if there are such items linking to the film.

Not an issue, but something interesting

https://www.digitalocean.com/community/tutorials/how-to-write-asynchronous-code-in-node-js

They use ghibliapi as the teaching tool

callbackMovies.js

const request = require('request');

request('https://ghibliapi.herokuapp.com/films', (error, response, body) => {
    if (error) {
        console.error(`Could not send request to API: ${error.message}`);
        return;
    }

    if (response.statusCode != 200) {
        console.error(`Expected status code 200 but received ${response.statusCode}.`);
        return;
    }

    console.log('Processing our list of movies');
    movies = JSON.parse(body);
    movies.forEach(movie => {
        console.log(`${movie['title']}, ${movie['release_date']}`);
    });
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.