Skip to content

Instantly share code, notes, and snippets.

@lbrenman
Last active September 18, 2020 20:54
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 lbrenman/a2eb954302750a7697524efd4589ddd3 to your computer and use it in GitHub Desktop.
Save lbrenman/a2eb954302750a7697524efd4589ddd3 to your computer and use it in GitHub Desktop.
Integration Builder Pagination Example
{
"id": 39562,
"name": "Pagination Example",
"userId": 21107,
"accountId": 18281,
"createdDate": "2020-08-28T19:14:17Z",
"steps": [{
"id": 410447,
"onSuccess": ["isLastPage"],
"onFailure": [],
"name": "consoleLog",
"type": "script",
"properties": {
"body": "console.log(steps.getFolderContents.response.body);\n\ndone({})"
}
}, {
"id": 410449,
"onSuccess": ["consoleLog"],
"onFailure": [],
"name": "getFolderContents",
"type": "elementRequest",
"properties": {
"elementInstanceId": "${config.files}",
"api": "${steps.prepareGetFolderContents.url}",
"query": "${steps.prepareGetFolderContents.query}",
"method": "GET"
}
}, {
"id": 410450,
"onSuccess": [],
"onFailure": ["prepareGetFolderContents"],
"name": "isLastPage",
"type": "filter",
"properties": {
"body": "done(steps.getFolderContents.response.body.length === 0);"
}
}, {
"id": 410448,
"onSuccess": ["getFolderContents"],
"onFailure": [],
"name": "prepareGetFolderContents",
"type": "script",
"properties": {
"body": "let url = '/folders/contents';\n\nlet query = {};\n\nquery.pageSize = 25;\n\nif (steps.getFolderContents) {\n query.nextPage = steps.getFolderContents.response.headers[\"elements-next-page-token\"] || steps.getFolderContents.response.headers[\"Elements-Next-Page-Token\"];\n}\n\nquery.path = '/db2'\n\ndone({url:url, query:query});"
}
}],
"triggers": [{
"id": 35517,
"onSuccess": ["prepareGetFolderContents"],
"onFailure": [],
"type": "manual",
"async": true,
"name": "trigger",
"properties": {}
}],
"engine": "v3",
"active": true,
"debugLoggingEnabled": false,
"singleThreaded": false,
"configuration": [{
"id": 78504,
"key": "files",
"name": "files",
"type": "elementInstance",
"required": true
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment