I’m trying to get all records of a custom object I created but I can’t seem to get it to work.
const hubspot = require('@hubspot/api-client')
const hubspotClient = new hubspot.Client({
accessToken: process.env.HUBSPOTTOKEN
})
exports.main = async (event) => {
hubspotClient.apiRequest({
method: 'get',
path: '/crm/v3/schemas',
}).then(response =>{
console.log(response);
})
}
This is the custom code in the workflow, I’m first trying to get all schemas to get the custom object ID so that I can later query for all records.
The response logged seems strange to me
2023-09-12T11:13:47.435Z INFO Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]: {
body: Gunzip {
_writeState: [Uint32Array],
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
bytesWritten: 0,
_handle: [Zlib],
_outBuffer: <Buffer 7b 22 72 65 73 75 6c 74 73 22 3a 5b 7b 22 6c 61 62 65 6c 73 22 3a 7b 22 73 69 6e 67 75 6c 61 72 22 3a 22 44 41 55 20 53 6e 61 70 73 68 6f 74 22 2c 22 ... 16334 more bytes>,
_outOffset: 0,
_chunkSize: 16384,
_defaultFlushFlag: 2,
_finishFlushFlag: 2,
_defaultFullFlushFlag: 3,
_info: undefined,
_maxOutputLength: 4294967296,
_level: -1,
_strategy: 0,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null,
[Symbol(kError)]: null
},
disturbed: false,
error: null
},
[Symbol(Response internals)]: {
url: 'https://api.hubapi.com/crm/v3/schemas',
status: 200,
statusText: 'OK',
headers: Headers { [Symbol(map)]: [Object: null prototype] },
counter: 0
}
}
Memory: 71/128 MB
Runtime: 652.00 ms