Ghibli Landscapes API Documentation

Version:

A simple API for accessing beautiful landscape images from Studio Ghibli films

images from films

Overview

This API provides random Studio Ghibli landscape images from the official Ghibli website. It ensures that the same image is returned for the same ID or query, making it consistent across requests.

Features

API Endpoints

Home

URL: /

Method: GET

Description: Returns API information and available endpoints

Response: JSON with API details

Random Image

URL: /api/random

Method: GET

Description: Returns a random Ghibli landscape image

Response: JSON with image details

Image by ID or Query

URL: /api/image

Method: GET

Parameters:

  • id (optional): Specific image ID
  • q (optional): Query string (same query always returns same image)

Description: Returns an image based on ID or query

Response: JSON with image details

List Films

URL: /api/films

Method: GET

Description: Lists all available film codes

Response: JSON with film codes

Film-specific Image

URL: /api/film/{film_code}

Method: GET

Parameters:

  • film_code: Code of the film (e.g., "totoro", "chihiro")

Description: Returns a random image from a specific film

Response: JSON with image details

Direct Image Redirects

URL: /api/redirect/random

Method: GET

Description: Redirects to a random image

Response: HTTP redirect to image URL

Direct Image Redirect by ID or Query

URL: /api/redirect

Method: GET

Parameters:

  • id (optional): Specific image ID
  • q (optional): Query string

Description: Redirects to an image based on ID or query

Response: HTTP redirect to image URL

Response Format

{
  "id": "abcdef1234567890",
  "url": "https://www.ghibli.jp/gallery/totoro001.jpg",
  "film_code": "totoro",
  "film_name": "totoro",
  "image_number": "001"
}

Usage Examples

JavaScript Example

// Get a random Ghibli landscape
fetch('/api/random')
  .then(response => response.json())
  .then(data => {
    console.log(data);
    document.getElementById('image').src = data.url;
  });

Python Example

import requests

# Get an image based on a query
response = requests.get('https://your-domain.com/api/image', params={'q': 'totoro'})
data = response.json()
print(f"Image URL: {data['url']}")
print(f"Film: {data['film_code']}")