<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to get post code (ZIP) from List object? in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/How-to-get-post-code-ZIP-from-List-object/m-p/891214#M69618</link>
    <description>&lt;P&gt;Hey,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/602082"&gt;@ChrisSosa1337&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt; Thanks for your question! Have you tried using the&amp;nbsp;&lt;A href="https://legacydocs.hubspot.com/docs/methods/lists/get_list_contacts" target="_blank" rel="noopener"&gt;Get contacts in a list endpoint&lt;/A&gt;? This endpoint allows us to add query params such as `property`.&lt;/P&gt;
&lt;P&gt;The &lt;A href="https://legacydocs.hubspot.com/docs/methods/lists/get_list" target="_blank" rel="noopener"&gt;Get a list by ID endpoint&lt;/A&gt; doesn't offer additional query params.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a quick example:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Gave zip codes to five test contacts&lt;/LI&gt;
&lt;LI&gt;I created a List in my portal – last name = Belcher And portal code (zip)&amp;nbsp;&lt;EM&gt;is known&lt;/EM&gt;&lt;/LI&gt;
&lt;LI&gt;Used the endpoint –&amp;nbsp;&lt;A href="https://legacydocs.hubspot.com/docs/methods/lists/get_list_contacts" target="_blank" rel="noopener"&gt;Get contacts in a list&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Added the additional query params to my request&lt;BR /&gt;&lt;LI-CODE lang="javascript"&gt;https://api.hubapi.com/contacts/v1/lists/50/contacts/all/?property=zip&amp;amp;property=firstname&amp;amp;property=lastname​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;The contacts and the additional properties are returned in the response&lt;BR /&gt;&lt;LI-CODE lang="javascript"&gt;{
    "contacts": [
        {
            "vid": 801,
            "canonical-vid": 801,
            "merged-vids": [],
            "portal-id": 22245342,
            "is-contact": true,
            "properties": {
                "zip": {
                    "value": "87106"
                },
                "firstname": {
                    "value": "Louise"
                },
                "lastmodifieddate": {
                    "value": "1702058170130"
                },
                "lastname": {
                    "value": "Belcher"
                }
            },
            "form-submissions": [],
            "identity-profiles": [
                {
                    "vid": 801,
                    "saved-at-timestamp": 1667511751622,
                    "deleted-changed-timestamp": 0,
                    "identities": [
                        {
                            "type": "EMAIL",
                            "value": "louise@bobsburgers.com",
                            "timestamp": 1667511751520,
                            "is-primary": true
                        },
                        {
                            "type": "LEAD_GUID",
                            "value": "29428db3-e768-4f01-ae49-7e23280db908",
                            "timestamp": 1667511751618
                        }
                    ]
                }
            ],
            "merge-audits": [],
            "addedAt": 1702058221138
        },
        {
            "vid": 851,
            "canonical-vid": 851,
            "merged-vids": [],
            "portal-id": 22245342,
            "is-contact": true,
            "properties": {
                "zip": {
                    "value": "87106"
                },
                "firstname": {
                    "value": "Linda"
                },
                "lastmodifieddate": {
                    "value": "1702058170130"
                },
                "lastname": {
                    "value": "Belcher"
                }
            },
            "form-submissions": [],
            "identity-profiles": [
                {
                    "vid": 851,
                    "saved-at-timestamp": 1667511751624,
                    "deleted-changed-timestamp": 0,
                    "identities": [
                        {
                            "type": "EMAIL",
                            "value": "linda@bobsburgers.com",
                            "timestamp": 1667511751560,
                            "is-primary": true
                        },
                        {
                            "type": "LEAD_GUID",
                            "value": "bd0d9401-ba87-4f6b-93d5-3b7f0205b032",
                            "timestamp": 1667511751619
                        }
                    ]
                }
            ],
            "merge-audits": [],
            "addedAt": 1702058221106
        },
        {
            "vid": 901,
            "canonical-vid": 901,
            "merged-vids": [],
            "portal-id": 22245342,
            "is-contact": true,
            "properties": {
                "zip": {
                    "value": "87106"
                },
                "firstname": {
                    "value": "Bob"
                },
                "lastmodifieddate": {
                    "value": "1702058170130"
                },
                "lastname": {
                    "value": "Belcher"
                }
            },
            "form-submissions": [],
            "identity-profiles": [
                {
                    "vid": 901,
                    "saved-at-timestamp": 1683133205786,
                    "deleted-changed-timestamp": 0,
                    "identities": [
                        {
                            "type": "EMAIL",
                            "value": "bob@bobsburgers.com",
                            "timestamp": 1667511751550,
                            "is-primary": true
                        },
                        {
                            "type": "LEAD_GUID",
                            "value": "13ff422f-5c71-47e0-8b29-62247b51233d",
                            "timestamp": 1667511751626
                        },
                        {
                            "type": "EMAIL",
                            "value": "bob2@bobsburgers.com",
                            "timestamp": 1683133205772,
                            "is-secondary": true
                        }
                    ]
                }
            ],
            "merge-audits": [],
            "addedAt": 1702058221087
        },
        {
            "vid": 951,
            "canonical-vid": 951,
            "merged-vids": [],
            "portal-id": 22245342,
            "is-contact": true,
            "properties": {
                "zip": {
                    "value": "87106"
                },
                "firstname": {
                    "value": "Gene"
                },
                "lastmodifieddate": {
                    "value": "1702058170130"
                },
                "lastname": {
                    "value": "Belcher"
                }
            },
            "form-submissions": [],
            "identity-profiles": [
                {
                    "vid": 951,
                    "saved-at-timestamp": 1667511751639,
                    "deleted-changed-timestamp": 0,
                    "identities": [
                        {
                            "type": "EMAIL",
                            "value": "gene@bobsburgers.com",
                            "timestamp": 1667511751519,
                            "is-primary": true
                        },
                        {
                            "type": "LEAD_GUID",
                            "value": "4a114578-68f3-482f-86e8-67b3a99fd2b1",
                            "timestamp": 1667511751629
                        }
                    ]
                }
            ],
            "merge-audits": [],
            "addedAt": 1702058221113
        },
        {
            "vid": 1001,
            "canonical-vid": 1001,
            "merged-vids": [],
            "portal-id": 22245342,
            "is-contact": true,
            "properties": {
                "zip": {
                    "value": "87106"
                },
                "firstname": {
                    "value": "Tina"
                },
                "lastmodifieddate": {
                    "value": "1702058170130"
                },
                "lastname": {
                    "value": "Belcher"
                }
            },
            "form-submissions": [],
            "identity-profiles": [
                {
                    "vid": 1001,
                    "saved-at-timestamp": 1667511751648,
                    "deleted-changed-timestamp": 0,
                    "identities": [
                        {
                            "type": "EMAIL",
                            "value": "tina@bobsburgers.com",
                            "timestamp": 1667511751614,
                            "is-primary": true
                        },
                        {
                            "type": "LEAD_GUID",
                            "value": "781eb0f3-bb93-4e99-8669-5f635e9e1b0f",
                            "timestamp": 1667511751643
                        }
                    ]
                }
            ],
            "merge-audits": [],
            "addedAt": 1702058220834
        }
    ],
    "has-more": false,
    "vid-offset": 1001
}​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I hope this helps get you moving in the right direction.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have fun building! — Jaycee&lt;/P&gt;</description>
    <pubDate>Fri, 08 Dec 2023 18:13:53 GMT</pubDate>
    <dc:creator>Jaycee_Lewis</dc:creator>
    <dc:date>2023-12-08T18:13:53Z</dc:date>
    <item>
      <title>How to get post code (ZIP) from List object?</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/How-to-get-post-code-ZIP-from-List-object/m-p/890545#M69583</link>
      <description>&lt;P&gt;I was wondering, is there a way to to get the post code (ZIP) from a list object, if it is even possible? Right now I have the following code that pulls a list object from the HubSpot API, but the post code/ZIP does not return in the output&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;const express = require('express');
const axios = require('axios');

const app = express();

const hubspot = require('@hubspot/api-client');

const private_app_token = /*my token */
const hubspotClient = new hubspot.Client({"accessToken":private_app_token});

app.get('/contacts/v1/lists/2677/contacts/all', async (req, res) =&amp;gt; {

    
    try {
      const listData = await axios({
        method: 'get',
        url: `https://api.hubapi.com/contacts/v1/lists/2677/contacts/all`,
        headers: {
          'Authorization': `Bearer ${private_app_token}`,
          'Content-Type': 'application/json'
        }
      }).then(async (response) =&amp;gt; {
        const apiResponse = response?.data.contacts;
      //  let result = apiResponse.map(({properties}) =&amp;gt; properties);
        console.log(JSON.stringify(apiResponse));
        return apiResponse;
      }).catch((error) =&amp;gt; {
        console.log(`Error while getting list data: ${error.response.data.message}`)
        return null
      })
    } catch (e) {
      e.message === 'HTTP request failed'
        ? console.error(JSON.stringify(e.response, null, 2))
        : console.error(e)
    }
});

function getValueByKey(object, row) {
  return Object.values(object).find(x =&amp;gt; object[x] === row.key);
}


app.listen(3000, () =&amp;gt; console.log('Listening on http://localhost:3000'));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help me out here? How would I get the post code/ZIP from the list object, if it even exists?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 15:34:01 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/How-to-get-post-code-ZIP-from-List-object/m-p/890545#M69583</guid>
      <dc:creator>ChrisSosa1337</dc:creator>
      <dc:date>2023-12-07T15:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get post code (ZIP) from List object?</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/How-to-get-post-code-ZIP-from-List-object/m-p/891214#M69618</link>
      <description>&lt;P&gt;Hey,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/602082"&gt;@ChrisSosa1337&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt; Thanks for your question! Have you tried using the&amp;nbsp;&lt;A href="https://legacydocs.hubspot.com/docs/methods/lists/get_list_contacts" target="_blank" rel="noopener"&gt;Get contacts in a list endpoint&lt;/A&gt;? This endpoint allows us to add query params such as `property`.&lt;/P&gt;
&lt;P&gt;The &lt;A href="https://legacydocs.hubspot.com/docs/methods/lists/get_list" target="_blank" rel="noopener"&gt;Get a list by ID endpoint&lt;/A&gt; doesn't offer additional query params.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a quick example:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Gave zip codes to five test contacts&lt;/LI&gt;
&lt;LI&gt;I created a List in my portal – last name = Belcher And portal code (zip)&amp;nbsp;&lt;EM&gt;is known&lt;/EM&gt;&lt;/LI&gt;
&lt;LI&gt;Used the endpoint –&amp;nbsp;&lt;A href="https://legacydocs.hubspot.com/docs/methods/lists/get_list_contacts" target="_blank" rel="noopener"&gt;Get contacts in a list&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Added the additional query params to my request&lt;BR /&gt;&lt;LI-CODE lang="javascript"&gt;https://api.hubapi.com/contacts/v1/lists/50/contacts/all/?property=zip&amp;amp;property=firstname&amp;amp;property=lastname​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;The contacts and the additional properties are returned in the response&lt;BR /&gt;&lt;LI-CODE lang="javascript"&gt;{
    "contacts": [
        {
            "vid": 801,
            "canonical-vid": 801,
            "merged-vids": [],
            "portal-id": 22245342,
            "is-contact": true,
            "properties": {
                "zip": {
                    "value": "87106"
                },
                "firstname": {
                    "value": "Louise"
                },
                "lastmodifieddate": {
                    "value": "1702058170130"
                },
                "lastname": {
                    "value": "Belcher"
                }
            },
            "form-submissions": [],
            "identity-profiles": [
                {
                    "vid": 801,
                    "saved-at-timestamp": 1667511751622,
                    "deleted-changed-timestamp": 0,
                    "identities": [
                        {
                            "type": "EMAIL",
                            "value": "louise@bobsburgers.com",
                            "timestamp": 1667511751520,
                            "is-primary": true
                        },
                        {
                            "type": "LEAD_GUID",
                            "value": "29428db3-e768-4f01-ae49-7e23280db908",
                            "timestamp": 1667511751618
                        }
                    ]
                }
            ],
            "merge-audits": [],
            "addedAt": 1702058221138
        },
        {
            "vid": 851,
            "canonical-vid": 851,
            "merged-vids": [],
            "portal-id": 22245342,
            "is-contact": true,
            "properties": {
                "zip": {
                    "value": "87106"
                },
                "firstname": {
                    "value": "Linda"
                },
                "lastmodifieddate": {
                    "value": "1702058170130"
                },
                "lastname": {
                    "value": "Belcher"
                }
            },
            "form-submissions": [],
            "identity-profiles": [
                {
                    "vid": 851,
                    "saved-at-timestamp": 1667511751624,
                    "deleted-changed-timestamp": 0,
                    "identities": [
                        {
                            "type": "EMAIL",
                            "value": "linda@bobsburgers.com",
                            "timestamp": 1667511751560,
                            "is-primary": true
                        },
                        {
                            "type": "LEAD_GUID",
                            "value": "bd0d9401-ba87-4f6b-93d5-3b7f0205b032",
                            "timestamp": 1667511751619
                        }
                    ]
                }
            ],
            "merge-audits": [],
            "addedAt": 1702058221106
        },
        {
            "vid": 901,
            "canonical-vid": 901,
            "merged-vids": [],
            "portal-id": 22245342,
            "is-contact": true,
            "properties": {
                "zip": {
                    "value": "87106"
                },
                "firstname": {
                    "value": "Bob"
                },
                "lastmodifieddate": {
                    "value": "1702058170130"
                },
                "lastname": {
                    "value": "Belcher"
                }
            },
            "form-submissions": [],
            "identity-profiles": [
                {
                    "vid": 901,
                    "saved-at-timestamp": 1683133205786,
                    "deleted-changed-timestamp": 0,
                    "identities": [
                        {
                            "type": "EMAIL",
                            "value": "bob@bobsburgers.com",
                            "timestamp": 1667511751550,
                            "is-primary": true
                        },
                        {
                            "type": "LEAD_GUID",
                            "value": "13ff422f-5c71-47e0-8b29-62247b51233d",
                            "timestamp": 1667511751626
                        },
                        {
                            "type": "EMAIL",
                            "value": "bob2@bobsburgers.com",
                            "timestamp": 1683133205772,
                            "is-secondary": true
                        }
                    ]
                }
            ],
            "merge-audits": [],
            "addedAt": 1702058221087
        },
        {
            "vid": 951,
            "canonical-vid": 951,
            "merged-vids": [],
            "portal-id": 22245342,
            "is-contact": true,
            "properties": {
                "zip": {
                    "value": "87106"
                },
                "firstname": {
                    "value": "Gene"
                },
                "lastmodifieddate": {
                    "value": "1702058170130"
                },
                "lastname": {
                    "value": "Belcher"
                }
            },
            "form-submissions": [],
            "identity-profiles": [
                {
                    "vid": 951,
                    "saved-at-timestamp": 1667511751639,
                    "deleted-changed-timestamp": 0,
                    "identities": [
                        {
                            "type": "EMAIL",
                            "value": "gene@bobsburgers.com",
                            "timestamp": 1667511751519,
                            "is-primary": true
                        },
                        {
                            "type": "LEAD_GUID",
                            "value": "4a114578-68f3-482f-86e8-67b3a99fd2b1",
                            "timestamp": 1667511751629
                        }
                    ]
                }
            ],
            "merge-audits": [],
            "addedAt": 1702058221113
        },
        {
            "vid": 1001,
            "canonical-vid": 1001,
            "merged-vids": [],
            "portal-id": 22245342,
            "is-contact": true,
            "properties": {
                "zip": {
                    "value": "87106"
                },
                "firstname": {
                    "value": "Tina"
                },
                "lastmodifieddate": {
                    "value": "1702058170130"
                },
                "lastname": {
                    "value": "Belcher"
                }
            },
            "form-submissions": [],
            "identity-profiles": [
                {
                    "vid": 1001,
                    "saved-at-timestamp": 1667511751648,
                    "deleted-changed-timestamp": 0,
                    "identities": [
                        {
                            "type": "EMAIL",
                            "value": "tina@bobsburgers.com",
                            "timestamp": 1667511751614,
                            "is-primary": true
                        },
                        {
                            "type": "LEAD_GUID",
                            "value": "781eb0f3-bb93-4e99-8669-5f635e9e1b0f",
                            "timestamp": 1667511751643
                        }
                    ]
                }
            ],
            "merge-audits": [],
            "addedAt": 1702058220834
        }
    ],
    "has-more": false,
    "vid-offset": 1001
}​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I hope this helps get you moving in the right direction.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have fun building! — Jaycee&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 18:13:53 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/How-to-get-post-code-ZIP-from-List-object/m-p/891214#M69618</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2023-12-08T18:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to get post code (ZIP) from List object?</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/How-to-get-post-code-ZIP-from-List-object/m-p/891223#M69621</link>
      <description>&lt;P&gt;You are a lifesaver! Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 18:35:09 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/How-to-get-post-code-ZIP-from-List-object/m-p/891223#M69621</guid>
      <dc:creator>ChrisSosa1337</dc:creator>
      <dc:date>2023-12-08T18:35:09Z</dc:date>
    </item>
  </channel>
</rss>

