I am using this api to fetch the object schema, but I dont need the “options” attribute that is fetched in the response, I am using the nodejs client library, and using the function
hubspotClient.crm.properties.coreApi.getAll()
Is there any way I can explicilty bring in only the required properties?
Unfortunately, the getAll() function in the Node.js library doesn’t have a built-in option to exclude specific fields like “options” in the response. It always returns the full schema.
However, there’s a workaround you can try.
After getting the full response, you can filter out the options attribute locally in your Node.js code using something like,
const properties = await hubspotClient.crm.properties.coreApi.getAll();
const filteredProperties = properties.body.results.map(prop => {
const { options, …rest } = prop;
return rest;
});
If you want more control, you could use HubSpot’s GraphQL API to fetch only the fields you need. It’ll require a bit more setup, but it’s a powerful way to get specific data without extra fields.
If it’s a recurring need, consider reaching out to HubSpot support to suggest adding field-level filters to the properties API could be a nice feature for future releases!