Docs

Introduction

Welcome to the Greek Myth API! This API provides comprehensive data on various characters, stories, and gods from Greek mythology, allowing you to easily integrate this rich content into your applications.

Getting Started

To begin using the Greek Myth API, you need to understand the basic endpoint structure and how to make requests. The API offers detailed information on Greek mythology, covering gods, heroes, monsters, and more.

Authentication

Currently, the API does not require authentication, making it easy to start fetching data right away. Simply use the base URL provided in your requests.

Endpoints

In addition to the primary endpoint (/api/data), the Greek Myth API offers specific endpoints for various categories:

  • Gods Endpoint
GET /api/gods

Retrieves information about gods from Greek mythology.

  • Monsters Endpoint
GET /api/monsters

Fetches data regarding monsters featured in Greek mythology.

  • Titans Endpoint
GET /api/titans

Provides details about the titans, powerful beings from ancient Greek mythology.

  • Heroes Endpoint
GET /api/heroes

Retrieves information about legendary heroes from Greek mythology.

Each endpoint provides detailed information specific to its category, including attributes, stories, and associated images where applicable.

Example Requests

Fetching Gods Data

Using JavaScript Fetch API:

fetch("https://thegreekmythapi.vercel.app/api/gods")
  .then((response) => response.json())
  .then((data) => console.log(data))
  .catch((error) => console.error("Error:", error));

Using Axios:

axios
  .get("https://thegreekmythapi.vercel.app/api/gods")
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.error("Error:", error);
  });

Error Handling

The API employs standard HTTP status codes for error responses:

  • 400 Bad Request : Invalid request.

  • 404 Not Found : Resource not found.

  • 500 Internal Server Error : Server-side error.

Example error response:

{
  "error": {
    "message": "Resource not found",
    "code": 404
  }
}

Response Structure

Each endpoint's response adheres to the general structure described earlier, tailored to the specific category of entity being queried (gods, monsters, titans, or heroes).

{
  "Gods": [
    {
      "name": "Zeus",
      "description": "The king of the gods, the ruler of Mount Olympus, and the god of the sky, lightning, thunder, law, order, and justice.",
      "category": "God",
      "attributes": {
        "origin": "Son of Cronus and Rhea",
        "symbols": ["Thunderbolt", "Eagle", "Oak"],
        "abode": "Mount Olympus",
        "powers": ["Control over the weather", "Ability to hurl thunderbolts"],
        "family": {
          "parents": ["Cronus", "Rhea"],
          "siblings": ["Hades", "Poseidon", "Hestia", "Demeter"],
          "spouse": ["Hera"]
        },
        "stories": ["Defeat of the Titans", "The Birth of Hercules"]
      },
      "image": "/images/zeus.png",
      "id": 1
    }
    // More gods...
  ]
}

Detailed Field Descriptions

  • name : The name of the character or god.

  • description : A brief description of the character's role and significance in Greek mythology.

  • category : Indicates if the entry is a god, hero, creature, etc.

  • attributes : Additional details about the character including:

    • origin : The lineage or origins of the character.
    • symbols : Important symbols associated with the character.
    • abode : The dwelling place or realm of the character.
    • powers : Special abilities or powers the character possesses.
    • family : Family relations, including parents, siblings, and spouse.
    • stories : Notable myths or stories involving the character.
  • image : URL path to an image representing the character.

  • id : A unique identifier for the character.

Error Handling

The API includes error handling to ensure robust integration. Common error responses include:

  • 400 Bad Request : The request was invalid or cannot be otherwise served.

  • 404 Not Found : The requested resource could not be found.

  • 500 Internal Server Error : An error occurred on the server.

Example Error Response

{
  "error": {
    "message": "Resource not found",
    "code": 404
  }
}

With the Greek Myth API, you have access to a wealth of information on Greek mythology, from gods and heroes to epic tales. Use this API to enhance your applications with historical and mythical content.