Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.