AstronomyAPI
  • 🚀Getting Started
  • API v2 Reference
    • 🪐Bodies
      • 🌐Positions
      • 🗓️Events
    • 📸Studio
      • ✨Star Chart
      • 🌒Moon Phase
    • 🔎Search
  • 🤝Requests and Responses
    • 🪐Body Properties
    • 🕚Event Properties
    • 🔎Search Result Properties
    • 🔭Observer Parameters
    • 🗓️Tabular Responses
    • 🔢Rows Responses
    • 🚩Error Responses
    • 🔢Constellation Enums
    • 🔢DSO Enums
  • Page
  • 🧩Widgets
  • ⚠️Known Issues
  • 📕Changelog
  • Links
    • demo.astronomyapi.com
    • Sample code on Github
    • Back to Dashboard
Powered by GitBook
On this page

Was this helpful?

  1. Requests and Responses

Error Responses

Common error responses.

Error response from the API should return a JSON object with the key error describing the nature of the error. A request validation failure will cause a 422 HTTP code to be produced.

Sample validation error response

The below response was caused by not providing the value for the latitude parameter.

 {
    "statusCode": 422,
    "errors": [
        {
            "path": [],
            "property": "instance",
            "message": "requires property \"latitude\"",
            "schema": {
                "latitude": {
                    "type": "string"
                },
                "longitude": {
                    "type": "string"
                },
                "elevation": {
                    "type": "string"
                },
                "from_date": {
                    "type": "string"
                },
                "to_date": {
                    "type": "string"
                },
                "time": {
                    "type": "string"
                },
                "required": [
                    "latitude",
                    "longitude",
                    "elevation",
                    "from_date",
                    "to_date",
                    "time"
                ]
            },
            "instance": {
                "elevation": "1000",
                "from_date": "2017-12-20",
                "longitude": "-84.39733",
                "time": "08:00:00",
                "to_date": "2017-12-27"
            },
            "name": "required",
            "argument": "latitude",
            "stack": "instance requires property \"latitude\""
        }
    ]
}
PreviousRows ResponsesNextConstellation Enums

Last updated 1 year ago

Was this helpful?

🤝
🚩