arazzo: 1.0.1
info:
title: Amazon DynamoDB Scan With Pagination
summary: Scan a table and page through results until the table is exhausted.
description: >-
Reads every matching item from a table by issuing an initial Scan and
then repeatedly continuing the Scan from the returned LastEvaluatedKey
until DynamoDB stops returning one, signalling the end of the table.
This is the canonical full-table-Scan pagination loop. Every step
spells out its request inline, including the AWS JSON protocol
X-Amz-Target header, so the flow can be read and executed without
opening the underlying OpenAPI description.
version: 1.0.0
sourceDescriptions:
- name: queriesApi
url: ../openapi/amazon-dynamodb-queries-api-openapi.yml
type: openapi
workflows:
- workflowId: Scan-paginate
summary: Scan a table and follow LastEvaluatedKey until the Scan is complete.
description: >-
Runs an initial Scan, then branches: while a LastEvaluatedKey is
returned it continues the Scan from that key, and when none is returned
it ends.
inputs:
type: object
required:
- tableName
properties:
tableName:
type: string
description: The name of the table to Scan.
filterExpression:
type: string
description: Optional filter expression to apply to scanned items.
expressionAttributeNames:
type: object
description: Optional substitution tokens for attribute names.
expressionAttributeValues:
type: object
description: Optional values substituted into the filter expression.
limit:
type: integer
description: Maximum number of items to evaluate per page.
steps:
- stepId: scanFirstPage
description: Run the initial Scan over the table.
operationId: Scan
parameters:
- name: X-Amz-Target
in: header
value: DynamoDB_20120810.Scan
requestBody:
contentType: application/x-amz-json-1.0
payload:
TableName: $inputs.tableName
FilterExpression: $inputs.filterExpression
ExpressionAttributeNames: $inputs.expressionAttributeNames
ExpressionAttributeValues: $inputs.expressionAttributeValues
Limit: $inputs.limit
successCriteria:
- condition: $statusCode == 200
outputs:
items: $response.body#/Items
lastEvaluatedKey: $response.body#/LastEvaluatedKey
onSuccess:
- name: morePages
type: goto
stepId: scanNextPage
criteria:
- condition: $response.body#/LastEvaluatedKey != null
- name: scanComplete
type: end
criteria:
- condition: $response.body#/LastEvaluatedKey == null
- stepId: scanNextPage
description: >-
Continue the Scan from the previous page's LastEvaluatedKey, looping
until DynamoDB returns no further LastEvaluatedKey.
operationId: Scan
parameters:
- name: X-Amz-Target
in: header
value: DynamoDB_20120810.Scan
requestBody:
contentType: application/x-amz-json-1.0
payload:
TableName: $inputs.tableName
FilterExpression: $inputs.filterExpression
ExpressionAttributeNames: $inputs.expressionAttributeNames
ExpressionAttributeValues: $inputs.expressionAttributeValues
Limit: $inputs.limit
ExclusiveStartKey: $steps.scanFirstPage.outputs.lastEvaluatedKey
successCriteria:
- condition: $statusCode == 200
outputs:
items: $response.body#/Items
lastEvaluatedKey: $response.body#/LastEvaluatedKey
onSuccess:
- name: stillMorePages
type: goto
stepId: scanNextPage
criteria:
- condition: $response.body#/LastEvaluatedKey != null
- name: done
type: end
criteria:
- condition: $response.body#/LastEvaluatedKey == null
outputs:
lastPageItems: $steps.scanNextPage.outputs.items
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.