---
title: "Get 7-day forecast"
url: "https://dev-portal.dehaven.org/apis/empty-api-v1/versions/e40571fa-f6cf-4b13-a833-6fc3b759e34d/operations/getForecast"
---

> Full API specification: https://dev-portal.dehaven.org/apis/empty-api-v1/versions/e40571fa-f6cf-4b13-a833-6fc3b759e34d.md

# Get 7-day forecast

`GET` `/forecast`

Operation ID: `getForecast`

Provides a 7-day weather forecast for a given location.

## Query parameters

- `location` (string, required) - Location for which to retrieve the forecast.
- `limit` (integer, int32, optional) - Maximum number of items to return
- `offset` (integer, int32, optional) - Number of items to skip

## Responses

- `200` - Successful operation
- `400` - Bad Request
- `500` - Internal Server Error

## OpenAPI definition

```yaml
openapi: 3.1.0
info:
  title: Weather API
  version: 1.0.0
servers:
  - url: https://api.example.com/weather/v1
    description: Main API server
paths:
  /forecast:
    get:
      summary: Get 7-day forecast
      description: Provides a 7-day weather forecast for a given location.
      operationId: getForecast
      tags:
        - Weather
      parameters:
        - name: location
          in: query
          description: Location for which to retrieve the forecast.
          schema:
            type: string
          required: true
        - name: limit
          in: query
          description: Maximum number of items to return
          schema:
            type: integer
            format: int32
            minimum: 1
            maximum: 7
            default: 7
        - name: offset
          in: query
          description: Number of items to skip
          schema:
            type: integer
            format: int32
            minimum: 0
            default: 0
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ForecastList"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
components:
  schemas:
    ForecastList:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Forecast"
        meta:
          type: object
          properties:
            page:
              type: object
              properties:
                offset:
                  type: integer
                  description: The number of items to skip before starting to collect the result
                    set.
                  example: 0
                limit:
                  type: integer
                  description: The numbers of items to return.
                  example: 7
                total:
                  type: integer
                  description: The total number of items available.
                  example: 7
                estimated_total:
                  type: boolean
                  description: If the total number of items available is an estimate.
                  example: false
      example:
        data:
          - date: 2024-07-08
            high_temperature: 22
            low_temperature: 14
            condition: Sunny
          - date: 2024-07-09
            high_temperature: 23
            low_temperature: 15
            condition: Cloudy
        meta:
          page:
            offset: 0
            limit: 7
            total: 7
            estimated_total: false
    Error:
      type: object
      properties:
        code:
          type: string
          description: Error code.
          example: "400"
        message:
          type: string
          description: Error message.
          example: Bad Request
    Forecast:
      type: object
      properties:
        date:
          type: string
          format: date
          description: Date of the forecast.
        high_temperature:
          type: number
          format: float
          description: High temperature in Celsius.
        low_temperature:
          type: number
          format: float
          description: Low temperature in Celsius.
        condition:
          type: string
          description: Weather condition for the day.
      example:
        date: 2024-07-08
        high_temperature: 22
        low_temperature: 14
        condition: Sunny
```
