Mars Explorer

Mars Explorer · GPT Actions

NASA Mars Rover Photo API

Access to image data from NASA's Mars Rovers - Perseverance, Curiosity, Opportunity, and Spirit.

  • GET /{rover}/photosgetMarsRoverPhotos

    Retrieve photos taken by a specific Mars rover, filterable by Martian sol, Earth date, and camera.

  • GET /{rover}/latest_photosgetLatestMarsRoverPhotos

    Get the latest photos from a specific Mars rover.

  • GET /manifests/{rover}getMarsRoverManifest

    Retrieve mission manifest for a specific Mars rover.

原始 API 定义
{
  "openapi": "3.1.0",
  "info": {
    "title": "NASA Mars Rover Photo API",
    "description": "Access to image data from NASA's Mars Rovers - Perseverance, Curiosity, Opportunity, and Spirit.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.nasa.gov/mars-photos/api/v1/rovers"
    }
  ],
  "paths": {
    "/{rover}/photos": {
      "get": {
        "description": "Retrieve photos taken by a specific Mars rover, filterable by Martian sol, Earth date, and camera.",
        "operationId": "getMarsRoverPhotos",
        "parameters": [
          {
            "name": "rover",
            "in": "path",
            "required": true,
            "description": "Name of the Mars rover (Perseverance, Curiosity, Opportunity, Spirit).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sol",
            "in": "query",
            "description": "Martian sol to retrieve photos from.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "earth_date",
            "in": "query",
            "description": "Earth date to retrieve photos from, formatted as yyyy-mm-dd.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "camera",
            "in": "query",
            "description": "Camera type used for the photos.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "api_key",
            "in": "query",
            "required": true,
            "description": "API key for authorization.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with photo data.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "photos": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Photo"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Rate limit exceeded. Please try again later."
                    },
                    "rate_limit_reset_utc": {
                      "type": "string",
                      "format": "date-time",
                      "example": "2023-10-01T12:00:00Z"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/{rover}/latest_photos": {
      "get": {
        "description": "Get the latest photos from a specific Mars rover.",
        "operationId": "getLatestMarsRoverPhotos",
        "parameters": [
          {
            "name": "rover",
            "in": "path",
            "required": true,
            "description": "Name of the Mars rover.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "api_key",
            "in": "query",
            "required": true,
            "description": "API key for authorization.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with latest photo data.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "latest_photos": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Photo"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Rate limit exceeded. Please try again later."
                    },
                    "rate_limit_reset_utc": {
                      "type": "string",
                      "format": "date-time",
                      "example": "2023-10-01T12:00:00Z"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/manifests/{rover}": {
      "get": {
        "description": "Retrieve mission manifest for a specific Mars rover.",
        "operationId": "getMarsRoverManifest",
        "parameters": [
          {
            "name": "rover",
            "in": "path",
            "required": true,
            "description": "Name of the Mars rover.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with mission manifest data.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "landing_date": {
                      "type": "string"
                    },
                    "launch_date": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "max_sol": {
                      "type": "integer"
                    },
                    "max_date": {
                      "type": "string"
                    },
                    "total_photos": {
                      "type": "integer"
                    },
                    "photos": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "sol": {
                            "type": "integer"
                          },
                          "total_photos": {
                            "type": "integer"
                          },
                          "cameras": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Rate limit exceeded. Please try again later."
                    },
                    "rate_limit_reset_utc": {
                      "type": "string",
                      "format": "date-time",
                      "example": "2023-10-01T12:00:00Z"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Photo": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "sol": {
            "type": "integer"
          },
          "camera": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "full_name": {
                "type": "string"
              }
            }
          },
          "img_src": {
            "type": "string"
          },
          "earth_date": {
            "type": "string"
          },
          "rover": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              },
              "landing_date": {
                "type": "string"
              },
              "launch_date": {
                "type": "string"
              },
              "status": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}