APIs & Integrations

mhetreayush
Participant

Fetching only selected values in the getProperties API

Résolue

https://legacydocs.hubspot.com/docs/methods/crm-properties/get-properties

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?

1 Solution acceptée
KhushbooRevOps
Solution
Participant

Fetching only selected values in the getProperties API

Résolue

Hi @mhetreayush,

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! 

I hope it helps, let me know if you need to talk!

Khushboo Pokhriyal

Growth & Operations

GroRapid Labs

LinkedIn | 9315044754 | Email | Website

Voir la solution dans l'envoi d'origine

4 Réponses
GRajput
Expert reconnu | Partenaire solutions Platinum
Expert reconnu | Partenaire solutions Platinum

Fetching only selected values in the getProperties API

Résolue

Hi @mhetreayush 

 

I think you are using V1 doc, you should move to the V3 APIs as they are more advanced and stable.

 

GRajput_0-1727440289472.png

 

 

here is the link to CRM properties read API - https://developers.hubspot.com/docs/api/crm/properties

 

I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!




Gaurav Rajput
Director, MarTech( Growth Natives)

Book a meeting


mhetreayush
Participant

Fetching only selected values in the getProperties API

Résolue

Thank you for the help Gaurav!

0 Votes
KhushbooRevOps
Solution
Participant

Fetching only selected values in the getProperties API

Résolue

Hi @mhetreayush,

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! 

I hope it helps, let me know if you need to talk!

Khushboo Pokhriyal

Growth & Operations

GroRapid Labs

LinkedIn | 9315044754 | Email | Website

mhetreayush
Participant

Fetching only selected values in the getProperties API

Résolue

Thank you for the help Khushboo. GraphQL API is something that might help me.

0 Votes