SDK for PHP 3.x

Client: Aws\ForecastQueryService\ForecastQueryServiceClient
Service ID: forecastquery
Version: 2018-06-26

This page describes the parameters and results for the operations of the Amazon Forecast Query Service (2018-06-26), and shows how to use the Aws\ForecastQueryService\ForecastQueryServiceClient object to call the described operations. This documentation is specific to the 2018-06-26 API version of the service.

Operation Summary

Each of the following operations can be created from a client using $client->getCommand('CommandName'), where "CommandName" is the name of one of the following operations. Note: a command is a value that encapsulates an operation and the parameters used to create an HTTP request.

You can also create and send a command immediately using the magic methods available on a client object: $client->commandName(/* parameters */). You can send the command asynchronously (returning a promise) by appending the word "Async" to the operation name: $client->commandNameAsync(/* parameters */).

QueryForecast ( array $params = [] )
Retrieves a forecast for a single item, filtered by the supplied criteria.
QueryWhatIfForecast ( array $params = [] )
Retrieves a what-if forecast.

Operations

QueryForecast

$result = $client->queryForecast([/* ... */]);
$promise = $client->queryForecastAsync([/* ... */]);

Retrieves a forecast for a single item, filtered by the supplied criteria.

The criteria is a key-value pair. The key is either item_id (or the equivalent non-timestamp, non-target field) from the TARGET_TIME_SERIES dataset, or one of the forecast dimensions specified as part of the FeaturizationConfig object.

By default, QueryForecast returns the complete date range for the filtered forecast. You can request a specific date range.

To get the full forecast, use the CreateForecastExportJob operation.

The forecasts generated by Amazon Forecast are in the same timezone as the dataset that was used to create the predictor.

Parameter Syntax

$result = $client->queryForecast([
    'EndDate' => '<string>',
    'Filters' => ['<string>', ...], // REQUIRED
    'ForecastArn' => '<string>', // REQUIRED
    'NextToken' => '<string>',
    'StartDate' => '<string>',
]);

Parameter Details

Members
EndDate
Type: string

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

Filters
Required: Yes
Type: Associative array of custom strings keys (AttributeName) to strings

The filtering criteria to apply when retrieving the forecast. For example, to get the forecast for client_21 in the electricity usage dataset, specify the following:

{"item_id" : "client_21"}

To get the full forecast, use the CreateForecastExportJob operation.

ForecastArn
Required: Yes
Type: string

The Amazon Resource Name (ARN) of the forecast to query.

NextToken
Type: string

If the result of the previous request was truncated, the response includes a NextToken. To retrieve the next set of results, use the token in the next request. Tokens expire after 24 hours.

StartDate
Type: string

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

Result Syntax

[
    'Forecast' => [
        'Predictions' => [
            '<Statistic>' => [
                [
                    'Timestamp' => '<string>',
                    'Value' => <float>,
                ],
                // ...
            ],
            // ...
        ],
    ],
]

Result Details

Members
Forecast
Type: Forecast structure

The forecast.

Errors

ResourceNotFoundException:

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

ResourceInUseException:

The specified resource is in use.

InvalidInputException:

The value is invalid or is too long.

LimitExceededException:

The limit on the number of requests per second has been exceeded.

InvalidNextTokenException:

The token is not valid. Tokens expire after 24 hours.

QueryWhatIfForecast

$result = $client->queryWhatIfForecast([/* ... */]);
$promise = $client->queryWhatIfForecastAsync([/* ... */]);

Retrieves a what-if forecast.

Parameter Syntax

$result = $client->queryWhatIfForecast([
    'EndDate' => '<string>',
    'Filters' => ['<string>', ...], // REQUIRED
    'NextToken' => '<string>',
    'StartDate' => '<string>',
    'WhatIfForecastArn' => '<string>', // REQUIRED
]);

Parameter Details

Members
EndDate
Type: string

The end date for the what-if forecast. Specify the date using this format: yyyy-MM-dd'T'HH:mm:ss (ISO 8601 format). For example, 2015-01-01T20:00:00.

Filters
Required: Yes
Type: Associative array of custom strings keys (AttributeName) to strings

The filtering criteria to apply when retrieving the forecast. For example, to get the forecast for client_21 in the electricity usage dataset, specify the following:

{"item_id" : "client_21"}

To get the full what-if forecast, use the CreateForecastExportJob operation.

NextToken
Type: string

If the result of the previous request was truncated, the response includes a NextToken. To retrieve the next set of results, use the token in the next request. Tokens expire after 24 hours.

StartDate
Type: string

The start date for the what-if forecast. Specify the date using this format: yyyy-MM-dd'T'HH:mm:ss (ISO 8601 format). For example, 2015-01-01T08:00:00.

WhatIfForecastArn
Required: Yes
Type: string

The Amazon Resource Name (ARN) of the what-if forecast to query.

Result Syntax

[
    'Forecast' => [
        'Predictions' => [
            '<Statistic>' => [
                [
                    'Timestamp' => '<string>',
                    'Value' => <float>,
                ],
                // ...
            ],
            // ...
        ],
    ],
]

Result Details

Members
Forecast
Type: Forecast structure

Provides information about a forecast. Returned as part of the QueryForecast response.

Errors

ResourceNotFoundException:

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

ResourceInUseException:

The specified resource is in use.

InvalidInputException:

The value is invalid or is too long.

LimitExceededException:

The limit on the number of requests per second has been exceeded.

InvalidNextTokenException:

The token is not valid. Tokens expire after 24 hours.

Shapes

DataPoint

Description

The forecast value for a specific date. Part of the Forecast object.

Members
Timestamp
Type: string

The timestamp of the specific forecast.

Value
Type: double

The forecast value.

Forecast

Description

Provides information about a forecast. Returned as part of the QueryForecast response.

Members
Predictions
Type: Associative array of custom strings keys (Statistic) to DataPoint structuress

The forecast.

The string of the string-to-array map is one of the following values:

  • p10

  • p50

  • p90

The default setting is ["0.1", "0.5", "0.9"]. Use the optional ForecastTypes parameter of the CreateForecast operation to change the values. The values will vary depending on how this is set, with a minimum of 1 and a maximum of 5.

InvalidInputException

Description

The value is invalid or is too long.

Members
Message
Type: string

InvalidNextTokenException

Description

The token is not valid. Tokens expire after 24 hours.

Members
Message
Type: string

LimitExceededException

Description

The limit on the number of requests per second has been exceeded.

Members
Message
Type: string

ResourceInUseException

Description

The specified resource is in use.

Members
Message
Type: string

ResourceNotFoundException

Description

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

Members
Message
Type: string