GetExecutionHistory - AWS Step Functions

GetExecutionHistory

Returns the history of the specified execution as a list of events. By default, the results are returned in ascending order of the timeStamp of the events. Use the reverseOrder parameter to get the latest events first.

If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.

This API action is not supported by EXPRESS state machines.

Request Syntax

{ "executionArn": "string", "includeExecutionData": boolean, "maxResults": number, "nextToken": "string", "reverseOrder": boolean }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

executionArn

The Amazon Resource Name (ARN) of the execution.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 256.

Required: Yes

includeExecutionData

You can select whether execution data (input or output of a history event) is returned. The default is true.

Type: Boolean

Required: No

maxResults

The maximum number of results that are returned per call. You can use nextToken to obtain further pages of results. The default is 100 and the maximum allowed page size is 1000. A value of 0 uses the default.

This is only an upper limit. The actual number of results returned per call might be fewer than the specified maximum.

Type: Integer

Valid Range: Minimum value of 0. Maximum value of 1000.

Required: No

nextToken

If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No

reverseOrder

Lists events in descending order of their timeStamp.

Type: Boolean

Required: No

Response Syntax

{ "events": [ { "activityFailedEventDetails": { "cause": "string", "error": "string" }, "activityScheduledEventDetails": { "heartbeatInSeconds": number, "input": "string", "inputDetails": { "truncated": boolean }, "resource": "string", "timeoutInSeconds": number }, "activityScheduleFailedEventDetails": { "cause": "string", "error": "string" }, "activityStartedEventDetails": { "workerName": "string" }, "activitySucceededEventDetails": { "output": "string", "outputDetails": { "truncated": boolean } }, "activityTimedOutEventDetails": { "cause": "string", "error": "string" }, "executionAbortedEventDetails": { "cause": "string", "error": "string" }, "executionFailedEventDetails": { "cause": "string", "error": "string" }, "executionRedrivenEventDetails": { "redriveCount": number }, "executionStartedEventDetails": { "input": "string", "inputDetails": { "truncated": boolean }, "roleArn": "string", "stateMachineAliasArn": "string", "stateMachineVersionArn": "string" }, "executionSucceededEventDetails": { "output": "string", "outputDetails": { "truncated": boolean } }, "executionTimedOutEventDetails": { "cause": "string", "error": "string" }, "id": number, "lambdaFunctionFailedEventDetails": { "cause": "string", "error": "string" }, "lambdaFunctionScheduledEventDetails": { "input": "string", "inputDetails": { "truncated": boolean }, "resource": "string", "taskCredentials": { "roleArn": "string" }, "timeoutInSeconds": number }, "lambdaFunctionScheduleFailedEventDetails": { "cause": "string", "error": "string" }, "lambdaFunctionStartFailedEventDetails": { "cause": "string", "error": "string" }, "lambdaFunctionSucceededEventDetails": { "output": "string", "outputDetails": { "truncated": boolean } }, "lambdaFunctionTimedOutEventDetails": { "cause": "string", "error": "string" }, "mapIterationAbortedEventDetails": { "index": number, "name": "string" }, "mapIterationFailedEventDetails": { "index": number, "name": "string" }, "mapIterationStartedEventDetails": { "index": number, "name": "string" }, "mapIterationSucceededEventDetails": { "index": number, "name": "string" }, "mapRunFailedEventDetails": { "cause": "string", "error": "string" }, "mapRunRedrivenEventDetails": { "mapRunArn": "string", "redriveCount": number }, "mapRunStartedEventDetails": { "mapRunArn": "string" }, "mapStateStartedEventDetails": { "length": number }, "previousEventId": number, "stateEnteredEventDetails": { "input": "string", "inputDetails": { "truncated": boolean }, "name": "string" }, "stateExitedEventDetails": { "name": "string", "output": "string", "outputDetails": { "truncated": boolean } }, "taskFailedEventDetails": { "cause": "string", "error": "string", "resource": "string", "resourceType": "string" }, "taskScheduledEventDetails": { "heartbeatInSeconds": number, "parameters": "string", "region": "string", "resource": "string", "resourceType": "string", "taskCredentials": { "roleArn": "string" }, "timeoutInSeconds": number }, "taskStartedEventDetails": { "resource": "string", "resourceType": "string" }, "taskStartFailedEventDetails": { "cause": "string", "error": "string", "resource": "string", "resourceType": "string" }, "taskSubmitFailedEventDetails": { "cause": "string", "error": "string", "resource": "string", "resourceType": "string" }, "taskSubmittedEventDetails": { "output": "string", "outputDetails": { "truncated": boolean }, "resource": "string", "resourceType": "string" }, "taskSucceededEventDetails": { "output": "string", "outputDetails": { "truncated": boolean }, "resource": "string", "resourceType": "string" }, "taskTimedOutEventDetails": { "cause": "string", "error": "string", "resource": "string", "resourceType": "string" }, "timestamp": number, "type": "string" } ], "nextToken": "string" }

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.

events

The list of events that occurred in the execution.

Type: Array of HistoryEvent objects

nextToken

If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Errors

For information about the errors that are common to all actions, see Common Errors.

ExecutionDoesNotExist

The specified execution does not exist.

HTTP Status Code: 400

InvalidArn

The provided Amazon Resource Name (ARN) is not valid.

HTTP Status Code: 400

InvalidToken

The provided token is not valid.

HTTP Status Code: 400

Examples

HelloWorld Execution History

The following shows example output from GetExecutionHistory for a simple HelloWorld state machine, comprised of a single Pass state.

Sample Response

{ "events": [ { "timestamp": 1525283875.58, "executionStartedEventDetails": { "input": "{}", "inputDetails": { "truncated": false }, "roleArn": "arn:aws:iam::123456789123:role/service-role/StatesExecutionRole-us-east-1" }, "type": "ExecutionStarted", "id": 1, "previousEventId": 0 }, { "timestamp": 1525283875.612, "type": "PassStateEntered", "id": 2, "stateEnteredEventDetails": { "input": "{}", "inputDetails": { "truncated": false }, "name": "HelloWorld" }, "previousEventId": 0 }, { "timestamp": 1525283875.612, "stateExitedEventDetails": { "output": "\"Hello World!\"", "outputDetails": { "truncated": false }, "name": "HelloWorld" }, "type": "PassStateExited", "id": 3, "previousEventId": 2 }, { "executionSucceededEventDetails": { "output": "\"Hello World!\"", "outputDetails": { "truncated": false } }, "timestamp": 1525283875.612, "type": "ExecutionSucceeded", "id": 4, "previousEventId": 3 } ] }

See Also

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