Dynamicaly pull Listings objects into a module

Hi,

for the past few hours, i’ve been trying to pull information from my listings CRM object into a custom module. It has so far only worked with the “products” CRM object, but not the listings one. Why could this be? This is the code i’m using just to test to see if there are any instances of the listings object.

{% set listings = crm_objects("LISTING") %}
{{ listings | pprint }}

I have tried to replace the “LISTING” for “listing”, “listings” and many more, but this is the only way I don’t get there errors:

1. Error:object type `listing` does not exist
2. Error:'listing' is not a valid object type
3. Error:An argument is missing

Anyway, the above code snippet comes up with “null” on the hubspot page. As soon as I replace “LISTINGS” with “product”, it comes up with the instances of the product object, as I would expect with the listing object. And I have one testing instance of the listing object set up in the CRM. Any help will be appreciated.

@Thoumii - Would it work to use the object ID for listings instead (which you can find in the URL)..?!

It wouldn’t. Not only does it not work, but I need to pull all the objects, not just a specific one. I talked to support and found out that it just won’t work, due to this: Please note: for security purposes, of the HubSpot standard object types only the product, and marketing_event objects can be retrieved on a publicly accessible page. Any other standard object type must be hosted on a page which is either password protected or requires a CMS Membership login. Custom objects do not have this same restriction.

Thanks for the reply!

@Thoumii - I know everything you explain sounds perfectly logical, but I often revert to using the base object ID in API and other calls rather than the name(s). In this case that value seems to be ‘0-420’ Perhaps the code will work better with that as an anchor.

Steve

Hi,

thanks so much for the reply! Sadly, as seen in the image, it does not accept this.

I think I’ll revert to just accessing the information via the API.

Have a great day!

Hey @Thoumii
If you are on content hub professional you could use graphql. I can see that the object is available in the GraphiQL tool from hubspot: