Skip to content

Instantly share code, notes, and snippets.

@DavidWells
Created March 25, 2020 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidWells/569a092481435da82198f0326e9eacb0 to your computer and use it in GitHub Desktop.
Save DavidWells/569a092481435da82198f0326e9eacb0 to your computer and use it in GitHub Desktop.
Recursively fetch API gateway rest API data
const AWS = require('aws-sdk')
const apiGateway = new AWS.APIGateway()
async function fetchAllApis() {
let getRestApisResult = await apiGateway.getRestApis().promise()
let apis = getRestApisResult.items
while (getRestApisResult.$response.hasNextPage()) {
getRestApisResult = await (getRestApisResult.$response.nextPage()).promise()
apis = apis.concat(getRestApisResult.items)
}
return apis
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment