APIs & Integrations

Mhokano
Participant

List Product Folders

Hello,

 

How to list all Product Folder and hs_folder_id from a Portal using API? Is this possible?

Thanks

 

Marcelo

 

6 Replies 6
DaniAstor
Member

List Product Folders

Hi! 

This may not be the most sophisticated idea, but if you are in a hurry, you can opt to download the html and do a little web scraping. 

 

Steps

1. Go to your product portal and select create a product:

DaniAstor_0-1690485987145.png

 

2. There you will find a "Folder" selection box, and click inspect the page from your browser:

DaniAstor_1-1690486162339.png

 

3. In the html of the page you will find the name of the Folder and its respective ID.

DaniAstor_2-1690486441724.png

 

4. Finally by downloading/copying the html of the page and doing a little web scraping you will be able to get all folder IDs with their respective names.

 

Thanks!

0 Upvotes
Mhokano
Participant

List Product Folders

Thanks, but this will work just if I had products in these folders, but If I have just folders without any products?

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

List Product Folders

@Mhokano 

I do not believe that this is possible.  I suggest you submit an idea for it.

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

List Product Folders

@Mhokano Have you explored the CRM Objects API for products?

Your call would look something like this:

https://api.hubapi.com/crm/v3/objects/products?archived=false&hapikey={{hapikey}}&properties=hs_fold...

Where {{hapikey}} would be replaced with your own key

 

cwh8944
Contributor

List Product Folders

When I make this API call, the hs_folder_id returns as null. Any suggestions? I was hopeful and thought I had a solution that I've been spending weeks trying to find, but ran into this blocker. Any insight would be greatly appreciated!!!

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

List Product Folders

If the products are in a folder, you should get an id for the folder..

Just to make sure I wasn't crazy, just ran it again.  Here is an example of what was returned with one product in a folder and the other not

{
            "id": "462948443",
            "properties": {
                "createdate": "2020-12-21T21:13:13.372Z",
                "hs_folder_id": "1858187",
                "hs_lastmodifieddate": "2021-07-14T14:53:59.007Z",
                "hs_object_id": "462948443"
            },
            "createdAt": "2020-12-21T21:13:13.372Z",
            "updatedAt": "2021-07-14T14:53:59.007Z",
            "archived": false
        },
        {
            "id": "519193051",
            "properties": {
                "createdate": "2021-01-04T17:36:09.036Z",
                "hs_folder_id": null,
                "hs_lastmodifieddate": "2021-11-12T19:46:50.842Z",
                "hs_object_id": "519193051"
            },
            "createdAt": "2021-01-04T17:36:09.036Z",
            "updatedAt": "2021-11-12T19:46:50.842Z",
            "archived": false
        }
0 Upvotes