Usage as per listSessions
The important part:
try {
return await cventSDK.sessions.listSessions({
filter: `event.id eq '${cvent_event_id}'`,
});
} catch (err) {
if (err instanceof cventErrors.CventSDKError) {
console.log(err.message);
console.log(err.statusCode);
console.log(err.body);
console.log(err.headers);
}
}
Errors with:
Response validation failed +0ms
200 +0ms
{
"paging": {
"_links": { ... },
"limit": 100,
"totalCount": 65,
"currentToken": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
},
"data": [ ... ]
} +3ms
Headers {
'content-type': 'application/json',
'content-length': '13766',
...
} +0ms
However, as you can see, the response has all of the correct data as you'd expect from the fetch. The err.body can be used via JSON.parse()
Apart from erroring, if the totalCount is greater than the limit more requests would need to be made to fetch the remaining data.
Usage as per listSessions
The important part:
Errors with:
However, as you can see, the response has all of the correct data as you'd expect from the fetch. The
err.bodycan be used viaJSON.parse()Apart from erroring, if the totalCount is greater than the limit more requests would need to be made to fetch the remaining data.