Amazon Forecast
Developer Guide

This is prerelease documentation for a service in preview release. It is subject to change.

GetForecast

Returns a forecast. You can get three types of forecasts:

  • For the latest forecast generated using a predictor, regardless of the version that was used to generate the forecast, specify only the predictor name.

  • For the latest forecast that was generated using a specific version of a predictor, specify the predictor name and version ID.

  • For a specific forecast, include a forecast ID with either of the above.

By default, the operation returns a forecast for up to 1 year. You can specify a date range within the year.

Request Syntax

{ "EndDate": "string", "Filters": { "string" : "string" }, "ForecastId": "string", "Interval": "string", "PredictorName": "string", "StartDate": "string", "VersionId": "string" }

Request Parameters

The request accepts the following data in JSON format.

EndDate

The end date for the forecast. Specify the date using this format: yyyy-MM-dd'T'HH:mm:ss'Z' (ISO 8601 format). For example, "1970-01-01T00:00:00Z."

Type: String

Length Constraints: Maximum length of 20.

Pattern: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$

Required: No

Filters

The filtering criteria to apply when retrieving the forecast. For example:

  • To get a forecast for a specific item, specify the following:

    {"item_id" : "client_1"}

  • To get a forecast for a specific item sold in a specific location, specify the following:

    {"item_id" : "client_1", "location" : "ny"}

  • To get a forecast for all blue items sold in a specific location, specify the following:

    { "location" : "ny", "color":"blue"}

Type: String to string map

Key Length Constraints: Maximum length of 256.

Key Pattern: ^[a-zA-Z0-9\_\-]+$

Value Length Constraints: Maximum length of 256.

Required: Yes

ForecastId

The ID of the forecast.

Type: String

Length Constraints: Maximum length of 256.

Pattern: ^[a-zA-Z0-9\_]+$

Required: No

Interval

The aggregation interval. Specify an aggregation interval that is greater than or equal to your dataset's data collection frequency. Whether data is aggregated depends on how frequently data for your dataset is collected and the value you set for the interval. For example:

  • If the frequency of data collection for your dataset is hourly, and you specify hourly for the aggregation interval, Amazon Forecast doesn't aggregate the forecast data.

  • If the frequency of data collection for your dataset is hourly, and you specify daily as the aggregation interval, Amazon Forecast aggregates the forecast.

Type: String

Length Constraints: Maximum length of 256.

Pattern: ^[a-zA-Z0-9\_]+$

Required: Yes

PredictorName

The name of the predictor that Amazon Forecast used to run inference and generate the forecast.

Type: String

Length Constraints: Maximum length of 256.

Pattern: ^[a-zA-Z0-9\_]+$

Required: Yes

StartDate

The start date for the forecast. Specify the date using this format: yyyy-MM-dd'T'HH:mm:ss'Z' (ISO 8601 format) For example, "1970-01-01T00:00:00Z."

Type: String

Length Constraints: Maximum length of 20.

Pattern: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$

Required: No

VersionId

The version ID of the predictor.

Type: String

Length Constraints: Maximum length of 256.

Pattern: ^[a-zA-Z0-9\_]+$

Required: No

Response Syntax

{ "Forecast": { "ForecastId": "string", "Predictions": { "string" : [ { "Date": "string", "Val": number } ] } } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

Forecast

Provides information about the forecast.

Type: Forecast object

Errors

InvalidInputException

The value that you provided was invalid or too long.

HTTP Status Code: 400

ResourceNotFoundException

We can't find that resource. Check the information that you've provided and try again.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: