Newbie here… Trying to do something pretty basic, and can’t deem to get it to work.
Here is my code:
const options = {
url: 'https://happeningout.api.accelo.com/api/v0/contacts/',
method: 'GET',
headers: {
'Accept': 'application/json',
'Authorization': `Bearer ${bundle.authData.access_token}`
},
params: {
'page': bundle.meta.page,
'sort': 'updated',
'per_page': '100'
}
}
return z.request(options)
.then((response) => {
response.throwForStatus();
const results = response.json;
// You can do any parsing you need for results here before returning them
return results;
});
Here is the error:
Invalid API Response: - Results must be an array, got: object, ({"response": {"surname":"Example","firstname":"Con) - Got a result missing the "id" property (r{"surname":"Example","firstname":"Contact","id":"4","email":"contact@ExampleClient.com","mobile":""},{"id":"5","mobile":"2059011005","email":"darren.loli@loligroup.com","surname":"Loli","firstname":"Orlando"},{"id":"6","mobile":"9542940108","email":) What happened (You are seeing this because you are an admin): Executing triggers.new_contact.operation.perform with bundle Invalid API Response: - Results must be an array, got: object, ({"response": {"surname":"Example","firstname":"Con) - Got a result missing the "id" property (r{"surname":"Example","firstname":"Contact","id":"4","email":"contact@ExampleClient.com","mobile":""},{"id":"5","mobile":"2059011005","email":"darren.loli@loligroup.com","surname":"Loli","firstname":"Orlando"},{"id":"6","mobile":"9542940108","email":) Console logs: Stack trace: CheckError: Invalid API Response: - Results must be an array, got: object, ({"response": {"surname":"Example","firstname":"Con) - Got a result missing the "id" property (r{"surname":"Example","firstname":"Contact","id":"4","email":"contact@ExampleClient.com","mobile":""},{"id":"5","mobile":"2059011005","email":"darren.loli@loligroup.com","surname":"Loli","firstname":"Orlando"},{"id":"6","mobile":"9542940108","email":) at checkOutput (/var/task/node_modules/zapier-platform-core/src/app-middlewares/after/checks.js:42:15) at Object.collector.then.newOutput (/var/task/node_modules/zapier-platform-core/src/middleware.js:80:37) at bound (domain.js:402:14) at Object.runBound (domain.js:415:12) at Object.tryCatcher (/var/task/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/var/task/node_modules/bluebird/js/release/promise.js:517:31) at Promise._settlePromise (/var/task/node_modules/bluebird/js/release/promise.js:574:18) at Promise._settlePromiseCtx (/var/task/node_modules/bluebird/js/release/promise.js:611:10) at _drainQueueStep (/var/task/node_modules/bluebird/js/release/async.js:142:12) at _drainQueue (/var/task/node_modules/bluebird/js/release/async.js:131:9) at Async._drainQueues (/var/task/node_modules/bluebird/js/release/async.js:147:5) at Immediate.Async.drainQueues 5as _onImmediate] (/var/task/node_modules/bluebird/js/release/async.js:17:14) at runCallback (timers.js:705:18) at tryOnImmediate (timers.js:676:5) at processImmediate (timers.js:658:5) at process.topLevelDomainCallback (domain.js:126:23)