Celestial Objects API

API is supplied for educational purposes only.
It isn't intended for general public use and may change or be removed without notice.

Information

This API supplies data on a small selection of celestial objects including stars, planets, and nebulas. These are things that might interest an amateur astronomer. While some effort has been made to ensure data accuracy, it is not guaranteed.

All requests to this API must use the following base URL: https://teapi.netlify.app/api/celestial-objects/{endpoint}

This is a consumption-only API—only the HTTP GET method is available for these resources. Documentation on the available endpoints follows. Throughout the documentation curly braces are used to indicate values that must be substituted.

Resource Lists

Calling any API endpoint without an id will return an array containing the available resources of that type.

Some endpoints support search or filtering. All searches use case-insensitive partial matches on the set of search fields. The set of search fields for each resource is listed in the resource documentation. As the collection is relatively small, this API does not support pagination.

Search is handled using standard query parameters: /{endpoint}?{search-field}={field-value}.

Root Endpoint: Celestial Objects

This returns one or more celestial objects from the collection.

Endpoints

  • GET / - list of Celestial Objects
  • GET /{id} - single Celestial Object

Example

GET https://teapi.netlify.app/api/celestial-objects/1001

{
    "id": 1001,
    "name": "Moon",
    "categories": [ 
        {"id": 2200, "name": "Moon"}, 
        {"id": 3201, "name": "Northern Hemisphere"}, 
        {"id": 3202, "name": "Southern Hemisphere"}
    ],
    "distance": "384,000 km",
    "description": "The moon is the Earth's only natural satellite and the fifth largest moon…",
    "image": "/images/celestial-objects/moon.jpg"
}

Resource: Celestial Object

NameType
id The id for this resource. number
name The name of this celestial object. string
categories A list of categories for this celestial object. list (Category)
distance The distance from earth to the celestial object. This value includes both the quantity and the units used for the measurement. string
description A textual description of the celestial object with notes on its significance. string
image The path to an image of the celestial object. string

Search Parameters

  • name
  • category

Searching by name returns partial matches. Searching by category requires an exact match.

Searching with both name and category performs an AND search. Objects must match the name string and a category.

However, searching with multiple categories does an OR search for the categories, including objects with any of the categories specified.

Endpoint: Categories

This returns one or more categories used by the API.

Endpoints

  • GET /category - list of Categories
  • GET /category/{id} - single Category

Example

GET https://teapi.netlify.app/api/celestial-objects/categories/2200

{
    "id": 2200, 
    "name": "Moon"
}

Resource: Category

NameDescriptionType
id The id for this resource. number
name The category name. string

Search Parameters

Search is not supported for this resource.