<?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: getPage is returning undefined in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/getPage-is-returning-undefined/m-p/718394#M58691</link>
    <description>Thanks for the assist. I think we have it working now.&lt;BR /&gt;I believe the code was accurate but we were accessing the wrong variable in&lt;BR /&gt;the response.&lt;BR /&gt;&lt;BR /&gt;This can be closed. Thanks!&lt;BR /&gt;</description>
    <pubDate>Mon, 14 Nov 2022 22:23:48 GMT</pubDate>
    <dc:creator>hankscrpio</dc:creator>
    <dc:date>2022-11-14T22:23:48Z</dc:date>
    <item>
      <title>getPage is returning undefined</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/getPage-is-returning-undefined/m-p/717055#M58610</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am going through the private app tutorial and attempting to simply query for a list of Contacts via the hubspotClient API, however, when I do so, I am get "undefined" in the response body.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the access token given to me by HubSpot and when I use the same token with a curl command, I get th expected results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;const &lt;/SPAN&gt;ACCESS_TOKEN = &lt;SPAN&gt;process&lt;/SPAN&gt;.&lt;SPAN&gt;env&lt;/SPAN&gt;.&lt;SPAN&gt;ACCESS_TOKEN&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;//=============================================================================//&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;//   Using Private App Access Token to configure HubSpot API Client instance   //&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;//=============================================================================//&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;const &lt;/SPAN&gt;hubspotClient = &lt;SPAN&gt;new &lt;/SPAN&gt;hubspot.Client({ accessToken: ACCESS_TOKEN })&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;//==================================================//&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;//   Using an API Client to Query the HubSpot API   //&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;//==================================================//&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;const &lt;/SPAN&gt;&lt;SPAN&gt;getContacts &lt;/SPAN&gt;= &lt;SPAN&gt;async &lt;/SPAN&gt;() =&amp;gt; {&lt;BR /&gt;    &lt;SPAN&gt;const &lt;/SPAN&gt;limit = &lt;SPAN&gt;10&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    const &lt;/SPAN&gt;after = &lt;SPAN&gt;undefined;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    const &lt;/SPAN&gt;properties = &lt;SPAN&gt;undefined;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    const &lt;/SPAN&gt;propertiesWithHistory = &lt;SPAN&gt;undefined;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    const &lt;/SPAN&gt;associations = &lt;SPAN&gt;undefined;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    const &lt;/SPAN&gt;archived = &lt;SPAN&gt;false;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    try &lt;/SPAN&gt;{&lt;BR /&gt;        &lt;SPAN&gt;const &lt;/SPAN&gt;apiResponse = &lt;SPAN&gt;await &lt;/SPAN&gt;hubspotClient.&lt;SPAN&gt;crm&lt;/SPAN&gt;.&lt;SPAN&gt;contacts&lt;/SPAN&gt;.&lt;SPAN&gt;basicApi&lt;/SPAN&gt;.&lt;SPAN&gt;getPage&lt;/SPAN&gt;(limit&lt;SPAN&gt;, &lt;/SPAN&gt;after&lt;SPAN&gt;, &lt;/SPAN&gt;properties&lt;SPAN&gt;, &lt;/SPAN&gt;propertiesWithHistory&lt;SPAN&gt;, &lt;/SPAN&gt;associations&lt;SPAN&gt;, &lt;/SPAN&gt;archived)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;        &lt;SPAN&gt;console&lt;/SPAN&gt;.&lt;SPAN&gt;log&lt;/SPAN&gt;(&lt;SPAN&gt;JSON&lt;/SPAN&gt;.&lt;SPAN&gt;stringify&lt;/SPAN&gt;(apiResponse.body&lt;SPAN&gt;, null, &lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;))&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;    } &lt;SPAN&gt;catch &lt;/SPAN&gt;(e) {&lt;BR /&gt;        e.&lt;SPAN&gt;message &lt;/SPAN&gt;=== &lt;SPAN&gt;'HTTP request failed'&lt;BR /&gt;&lt;/SPAN&gt;            ? &lt;SPAN&gt;console&lt;/SPAN&gt;.&lt;SPAN&gt;error&lt;/SPAN&gt;(&lt;SPAN&gt;JSON&lt;/SPAN&gt;.&lt;SPAN&gt;stringify&lt;/SPAN&gt;(e.&lt;SPAN&gt;response&lt;/SPAN&gt;&lt;SPAN&gt;, null, &lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;))&lt;BR /&gt;            : &lt;SPAN&gt;console&lt;/SPAN&gt;.&lt;SPAN&gt;error&lt;/SPAN&gt;(e)&lt;BR /&gt;    }&lt;BR /&gt;}&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;apiResponse.body is "undefined"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated! Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2022 17:02:04 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/getPage-is-returning-undefined/m-p/717055#M58610</guid>
      <dc:creator>hankscrpio</dc:creator>
      <dc:date>2022-11-10T17:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: getPage is returning undefined</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/getPage-is-returning-undefined/m-p/718389#M58690</link>
      <description>&lt;P&gt;Hey,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/452021"&gt;@hankscrpio&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt; A few questions to help the community better understand. Is this issue occurring when you make a request from the endpoint tab &lt;A href="https://developers.hubspot.com/docs/api/crm/contacts" target="_blank" rel="noopener"&gt;here&lt;/A&gt;? How about if you use a tool like postman?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just ran a quick test using a Private App:&lt;/P&gt;
&lt;P&gt;Endpoint&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;GET /crm/v3/objects/contacts&lt;/LI-CODE&gt;
&lt;P&gt;Request&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;const hubspot = require('@hubspot/api-client');

const hubspotClient = new hubspot.Client({"accessToken":"YOUR_ACCESS_TOKEN"});

const limit = 10;
const after = undefined;
const properties = undefined;
const propertiesWithHistory = undefined;
const associations = undefined;
const archived = false;

try {
  const apiResponse = await hubspotClient.crm.contacts.basicApi.getPage(limit, after, properties, propertiesWithHistory, associations, archived);
  console.log(JSON.stringify(apiResponse.body, null, 2));
} catch (e) {
  e.message === 'HTTP request failed'
    ? console.error(JSON.stringify(e.response, null, 2))
    : console.error(e)
}&lt;/LI-CODE&gt;
&lt;P&gt;Response&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;HTTP 200

{
  "results": [
    {
      "id": "1",
      "properties": {
        "createdate": "2022-06-29T17:59:00.693Z",
        "email": "emailmaria@hubspot.com",
        "firstname": "Maria",
        "hs_object_id": "1",
        "lastmodifieddate": "2022-08-11T23:25:03.952Z",
        "lastname": "Johnson (Sample Contact)"
      },
      "createdAt": "2022-06-29T17:59:00.693Z",
      "updatedAt": "2022-08-11T23:25:03.952Z",
      "archived": false
    },
    {
      "id": "51",
      "properties": {
        "createdate": "2022-06-29T17:59:01.172Z",
        "email": "bh@hubspot.com",
        "firstname": "Brian",
        "hs_object_id": "51",
        "lastmodifieddate": "2022-08-02T17:50:32.754Z",
        "lastname": "Halligan (Sample Contact)"
      },
      "createdAt": "2022-06-29T17:59:01.172Z",
      "updatedAt": "2022-08-02T17:50:32.754Z",
      "archived": false
    },
    {
      "id": "101",
      "properties": {
        "createdate": "2022-06-30T04:07:35.653Z",
        "email": "jaycee@example.com",
        "firstname": null,
        "hs_object_id": "101",
        "lastmodifieddate": "2022-08-02T17:50:32.092Z",
        "lastname": null
      },
      "createdAt": "2022-06-30T04:07:35.653Z",
      "updatedAt": "2022-08-02T17:50:32.092Z",
      "archived": false
    },
    {
      "id": "201",
      "properties": {
        "createdate": "2022-06-30T05:20:31.927Z",
        "email": "jaycee222@example.com",
        "firstname": null,
        "hs_object_id": "201",
        "lastmodifieddate": "2022-08-02T17:50:33.777Z",
        "lastname": null
      },
      "createdAt": "2022-06-30T05:20:31.927Z",
      "updatedAt": "2022-08-02T17:50:33.777Z",
      "archived": false
    },
    {
      "id": "251",
      "properties": {
        "createdate": "2022-06-30T05:54:47.865Z",
        "email": "jaycee2224@example.com",
        "firstname": null,
        "hs_object_id": "251",
        "lastmodifieddate": "2022-08-02T17:50:33.588Z",
        "lastname": null
      },
      "createdAt": "2022-06-30T05:54:47.865Z",
      "updatedAt": "2022-08-02T17:50:33.588Z",
      "archived": false
    },
    {
      "id": "301",
      "properties": {
        "createdate": "2022-07-08T04:15:03.373Z",
        "email": "testing@testingmctest.com",
        "firstname": "Jaycee",
        "hs_object_id": "301",
        "lastmodifieddate": "2022-09-20T20:35:49.906Z",
        "lastname": null
      },
      "createdAt": "2022-07-08T04:15:03.373Z",
      "updatedAt": "2022-09-20T20:35:49.906Z",
      "archived": false
    },
    {
      "id": "351",
      "properties": {
        "createdate": "2022-07-15T17:28:54.557Z",
        "email": "testingapis@hubspot.com",
        "firstname": "HubSpot",
        "hs_object_id": "351",
        "lastmodifieddate": "2022-08-02T17:50:32.636Z",
        "lastname": "Test"
      },
      "createdAt": "2022-07-15T17:28:54.557Z",
      "updatedAt": "2022-08-02T17:50:32.636Z",
      "archived": false
    },
    {
      "id": "451",
      "properties": {
        "createdate": "2022-08-03T17:25:46.314Z",
        "email": "pickles@catsrule.xyz",
        "firstname": "Pickles",
        "hs_object_id": "451",
        "lastmodifieddate": "2022-10-17T17:08:36.651Z",
        "lastname": "Lewis"
      },
      "createdAt": "2022-08-03T17:25:46.314Z",
      "updatedAt": "2022-10-17T17:08:36.651Z",
      "archived": false
    },
    {
      "id": "501",
      "properties": {
        "createdate": "2022-08-11T23:25:21.585Z",
        "email": null,
        "firstname": "Fiona",
        "hs_object_id": "501",
        "lastmodifieddate": "2022-10-24T20:09:43.571Z",
        "lastname": "Cat"
      },
      "createdAt": "2022-08-11T23:25:21.585Z",
      "updatedAt": "2022-10-24T20:09:43.571Z",
      "archived": false
    },
    {
      "id": "551",
      "properties": {
        "createdate": "2022-08-11T23:27:36.511Z",
        "email": "pickle@cat.com",
        "firstname": "Pickle",
        "hs_object_id": "551",
        "lastmodifieddate": "2022-10-24T20:09:43.862Z",
        "lastname": "Cat"
      },
      "createdAt": "2022-08-11T23:27:36.511Z",
      "updatedAt": "2022-10-24T20:09:43.862Z",
      "archived": false
    }
  ],
  "paging": {
    "next": {
      "after": "552",
      "link": "https://api.hubapi.com/crm/v3/objects/contacts?hs_static_app=endpoint-reference-ui&amp;amp;hs_static_app_version=1.1342&amp;amp;limit=10&amp;amp;archived=false&amp;amp;after=552"
    }
  }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the additional information! — Jaycee&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 22:10:23 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/getPage-is-returning-undefined/m-p/718389#M58690</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2022-11-14T22:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: getPage is returning undefined</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/getPage-is-returning-undefined/m-p/718394#M58691</link>
      <description>Thanks for the assist. I think we have it working now.&lt;BR /&gt;I believe the code was accurate but we were accessing the wrong variable in&lt;BR /&gt;the response.&lt;BR /&gt;&lt;BR /&gt;This can be closed. Thanks!&lt;BR /&gt;</description>
      <pubDate>Mon, 14 Nov 2022 22:23:48 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/getPage-is-returning-undefined/m-p/718394#M58691</guid>
      <dc:creator>hankscrpio</dc:creator>
      <dc:date>2022-11-14T22:23:48Z</dc:date>
    </item>
  </channel>
</rss>

