APIs & Integrations

Anat14
Member

API give me wrong list id's

Hello everyone, I'm actualy trying to develop a script that will return me all lists in a single list. For exemple : 

 

LIST 1 (id : 123) : 

             - List "Blue"

             - List "Red"

             - List "Green"

 

My script should returns me the id of list "Blue", "Red" & "Green".

So I'm using this endpoint "Get a contact list by its unique ID", it should returns me filters of the list 1 (id : 123). But it returns me some ids that didn't exist. Maybe it is some "internal ids"...

 

Can you help me with that ? 

Thanks a lot !

0 Upvotes
3 Replies 3
Jaycee_Lewis
Community Manager
Community Manager

API give me wrong list id's

Hey, @Anat14 👋 Great question. I feel like a bit more info can help the community to better understand what's going on. Can you add the following:

  • A screenshot of the filters used in your List? (see mine below for an example)
  • The full JSON body being returned? (see mine below for an example)
  • 1-2 examples of the unexpected values?

 

It sounds like you are getting back the internal value for properties. The internal values can differ from the property label. For example:

Label = Contact owner

Internal value = hubspot_owner_id

 

My quick test:

I created a test property to include in my test list:

Label = This is a label

Internal value = this_is_an_internal_value


List filters:

list_label_test.png

Endpoint — Get a contact list by its unique ID

GET /contacts/v1/lists/:list_id

 

Response body:

{
    "portalId": 22245342,
    "listId": 1,
    "internalListId": 1,
    "createdAt": 1660754855571,
    "updatedAt": 1660754855571,
    "name": "Testerr-1",
    "listType": "DYNAMIC",
    "authorId": 10233975,
    "parentId": 0,
    "filters": [],
    "metaData": {
        "size": 1,
        "lastSizeChangeAt": 1660754867815,
        "processing": "DONE",
        "lastProcessingStateChangeAt": 1660754867698,
        "error": "",
        "listReferencesCount": null,
        "parentFolderId": 0
    },
    "archived": false,
    "teamIds": [],
    "ilsFilterBranch": "{\"filterBranchOperator\":\"OR\",\"filters\":[],\"filterBranches\":[{\"filterBranchOperator\":\"AND\",\"filters\":[{\"filterId\":null,\"filterType\":\"PROPERTY\",\"property\":\"this_is_an_internal_value\",\"operation\":{\"propertyType\":\"alltypes\",\"operator\":\"IS_KNOWN\",\"pruningRefineBy\":null,\"coalescingRefineBy\":{\"setType\":\"ANY\",\"type\":\"SetOccurrencesRefineBy\"},\"defaultValue\":null,\"includeObjectsWithNoValueSet\":false,\"operationType\":\"alltypes\",\"operatorName\":\"IS_KNOWN\"},\"frameworkFilterId\":null},{\"filterId\":null,\"filterType\":\"PROPERTY\",\"property\":\"hubspot_owner_id\",\"operation\":{\"propertyType\":\"alltypes\",\"operator\":\"IS_KNOWN\",\"pruningRefineBy\":null,\"coalescingRefineBy\":{\"setType\":\"ANY\",\"type\":\"SetOccurrencesRefineBy\"},\"defaultValue\":null,\"includeObjectsWithNoValueSet\":false,\"operationType\":\"alltypes\",\"operatorName\":\"IS_KNOWN\"},\"frameworkFilterId\":null}],\"filterBranches\":[],\"filterBranchType\":\"AND\"}],\"filterBranchType\":\"OR\"}",
    "limitExempt": false,
    "internal": false,
    "dynamic": true
}

 

We can see in the isFilterBranch section that the internal values for both properties are returned. I understand how this is confusing, as there is inconsistency within HubSpot's own naming of labels vs. internal values for system-created properties. This is why I chose Contact Owner for my list, as it's a good example of the variance between label and internal value. 

 

And one last thing 😊 If you'd like to get all the properties for an object ahead of time, including the internal values, you can use the Properties API — 

GET /crm/v3/properties/{objectType}

 

I hope this helps get you moving forward! 

 

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
Anat14
Member

API give me wrong list id's

Hi @Jaycee_Lewis, thanks a lot for your time ! 

I will provide you more details : 

- I have a list containg other lists : 

Anat14_0-1660807450896.png

To get these 2 lists, I call this endpoint : 

https://api.hubapi.com/contacts/v1/lists/1048?hapikey={MY_API_KEY}

 

And here the JSON response : 

{
    "portalId": 3460983,
    "listId": 1048,
    "internalListId": 1164,
    "createdAt": 1660652012990,
    "updatedAt": 1660655044537,
    "name": "[TEST] [DEV] Spring GDS",
    "listType": "DYNAMIC",
    "authorId": 25736633,
    "parentId": 0,
    "filters": [],
    "metaData": {
        "size": 174,
        "lastSizeChangeAt": 1660655205501,
        "processing": "DONE",
        "lastProcessingStateChangeAt": 1660655205298,
        "error": "",
        "listReferencesCount": null,
        "parentFolderId": 0
    },
    "archived": false,
    "teamIds": [],
    "ilsFilterBranch": "{\"filterBranchOperator\":\"OR\",\"filters\":[],\"filterBranches\":[{\"filterBranchOperator\":\"AND\",\"filters\":[{\"listId\":829,\"operator\":\"IN_LIST\",\"metadata\":null,\"filterId\":null,\"frameworkFilterId\":null,\"filterType\":\"IN_LIST\"}],\"filterBranches\":[],\"filterBranchType\":\"AND\"},{\"filterBranchOperator\":\"AND\",\"filters\":[{\"listId\":220,\"operator\":\"IN_LIST\",\"metadata\":null,\"filterId\":null,\"frameworkFilterId\":null,\"filterType\":\"IN_LIST\"}],\"filterBranches\":[],\"filterBranchType\":\"AND\"}],\"filterBranchType\":\"OR\"}",
    "limitExempt": false,
    "internal": false,
    "dynamic": true
}

 

So I can see in "ilsFilterBranch", that I have 2 lists, the 220 and 829, the problem is that these lists do not exist. 

How can I get the reals ids of these list ? 

 

Thanks a lot again 🙂 !

0 Upvotes
Anat14
Member

API give me wrong list id's

Hi @Jaycee_Lewis , did you found a solution ? 

Thanks a lot for your time, 

Anatole

0 Upvotes