<?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 Can't get custom objects schemas in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Can-t-get-custom-objects-schemas/m-p/848149#M67343</link>
    <description>&lt;P&gt;I'm trying to get all records of a custom object I created but I can't seem to get it to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const hubspot = require('@hubspot/api-client')
const hubspotClient = new hubspot.Client({
    accessToken: process.env.HUBSPOTTOKEN
})

exports.main = async (event) =&amp;gt; {

 hubspotClient.apiRequest({
    method: 'get',
    path: '/crm/v3/schemas',
}).then(response =&amp;gt;{
   console.log(response);
 })
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the custom code in the workflow, I'm first trying to get all schemas to get the custom object ID so that I can later query for all records.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The response logged seems strange to me&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2023-09-12T11:13:47.435Z	INFO	Response {
  size: 0,
  timeout: 0,
  [Symbol(Body internals)]: {
    body: Gunzip {
      _writeState: [Uint32Array],
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 5,
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: true,
      bytesWritten: 0,
      _handle: [Zlib],
      _outBuffer: &amp;lt;Buffer 7b 22 72 65 73 75 6c 74 73 22 3a 5b 7b 22 6c 61 62 65 6c 73 22 3a 7b 22 73 69 6e 67 75 6c 61 72 22 3a 22 44 41 55 20 53 6e 61 70 73 68 6f 74 22 2c 22 ... 16334 more bytes&amp;gt;,
      _outOffset: 0,
      _chunkSize: 16384,
      _defaultFlushFlag: 2,
      _finishFlushFlag: 2,
      _defaultFullFlushFlag: 3,
      _info: undefined,
      _maxOutputLength: 4294967296,
      _level: -1,
      _strategy: 0,
      [Symbol(kCapture)]: false,
      [Symbol(kCallback)]: null,
      [Symbol(kError)]: null
    },
    disturbed: false,
    error: null
  },
  [Symbol(Response internals)]: {
    url: 'https://api.hubapi.com/crm/v3/schemas',
    status: 200,
    statusText: 'OK',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }
}

Memory: 71/128 MB
Runtime: 652.00 ms&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 12 Sep 2023 11:21:33 GMT</pubDate>
    <dc:creator>CAntoniades</dc:creator>
    <dc:date>2023-09-12T11:21:33Z</dc:date>
    <item>
      <title>Can't get custom objects schemas</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Can-t-get-custom-objects-schemas/m-p/848149#M67343</link>
      <description>&lt;P&gt;I'm trying to get all records of a custom object I created but I can't seem to get it to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const hubspot = require('@hubspot/api-client')
const hubspotClient = new hubspot.Client({
    accessToken: process.env.HUBSPOTTOKEN
})

exports.main = async (event) =&amp;gt; {

 hubspotClient.apiRequest({
    method: 'get',
    path: '/crm/v3/schemas',
}).then(response =&amp;gt;{
   console.log(response);
 })
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the custom code in the workflow, I'm first trying to get all schemas to get the custom object ID so that I can later query for all records.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The response logged seems strange to me&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2023-09-12T11:13:47.435Z	INFO	Response {
  size: 0,
  timeout: 0,
  [Symbol(Body internals)]: {
    body: Gunzip {
      _writeState: [Uint32Array],
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 5,
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: true,
      bytesWritten: 0,
      _handle: [Zlib],
      _outBuffer: &amp;lt;Buffer 7b 22 72 65 73 75 6c 74 73 22 3a 5b 7b 22 6c 61 62 65 6c 73 22 3a 7b 22 73 69 6e 67 75 6c 61 72 22 3a 22 44 41 55 20 53 6e 61 70 73 68 6f 74 22 2c 22 ... 16334 more bytes&amp;gt;,
      _outOffset: 0,
      _chunkSize: 16384,
      _defaultFlushFlag: 2,
      _finishFlushFlag: 2,
      _defaultFullFlushFlag: 3,
      _info: undefined,
      _maxOutputLength: 4294967296,
      _level: -1,
      _strategy: 0,
      [Symbol(kCapture)]: false,
      [Symbol(kCallback)]: null,
      [Symbol(kError)]: null
    },
    disturbed: false,
    error: null
  },
  [Symbol(Response internals)]: {
    url: 'https://api.hubapi.com/crm/v3/schemas',
    status: 200,
    statusText: 'OK',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }
}

Memory: 71/128 MB
Runtime: 652.00 ms&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 12 Sep 2023 11:21:33 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Can-t-get-custom-objects-schemas/m-p/848149#M67343</guid>
      <dc:creator>CAntoniades</dc:creator>
      <dc:date>2023-09-12T11:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get custom objects schemas</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Can-t-get-custom-objects-schemas/m-p/848608#M67381</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/605676"&gt;@CAntoniades&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You may want to try something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;const hubspot = require('@hubspot/api-client');
const hubspotClient = new hubspot.Client({accessToken: process.env.HUBSPOTTOKEN});

exports.main = async (event) =&amp;gt; {
  const response = await hubspotClient.apiRequest({
    method: 'get',
    path: '/crm/v3/schemas',
  });
  const json = await response.json();
  console.log(json);
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on my testing, this should get you closer to what you want to achieve.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this proves useful. Please let me know if you have any follow-up questions.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 04:30:51 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Can-t-get-custom-objects-schemas/m-p/848608#M67381</guid>
      <dc:creator>zach_threadint</dc:creator>
      <dc:date>2024-03-05T04:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get custom objects schemas</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Can-t-get-custom-objects-schemas/m-p/860518#M68008</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/324811"&gt;@zach_threadint&lt;/a&gt;,&amp;nbsp;thanks for the response. Just coming back to this it's now saying:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;INFO	{
  status: 'error',
  message: 'Authentication credentials not found. This API supports OAuth 2.0 authentication and you can find more details at https://developers.hubspot.com/docs/methods/auth/oauth-overview',
  correlationId: '8438c071-09d4-4405-91b9-af9eab0ed1b3',
  category: 'INVALID_AUTHENTICATION'
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;I've tried to add the autorization header like so:&lt;BR /&gt;hubspotClient.apiRequest({&lt;BR /&gt;method: 'get',&lt;BR /&gt;path: '/crm/v3/schemas',&lt;BR /&gt;authorization: 'Bearer private_app_token'&lt;BR /&gt;});&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 23:10:33 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Can-t-get-custom-objects-schemas/m-p/860518#M68008</guid>
      <dc:creator>CAntoniades</dc:creator>
      <dc:date>2023-10-05T23:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get custom objects schemas</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Can-t-get-custom-objects-schemas/m-p/863154#M68142</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/605676"&gt;@CAntoniades&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As far as I'm aware, you'll need to authenticate the hubspotClient when you initiate the instance. So, instead of authenticating each individual request made by your hubspotClient, try authenticating it like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;const hubspot = require('@hubspot/api-client');
const hubspotClient = new hubspot.Client({accessToken: private_app_token});&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this proves useful. Please let me know if you have any follow-up questions.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 04:30:30 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Can-t-get-custom-objects-schemas/m-p/863154#M68142</guid>
      <dc:creator>zach_threadint</dc:creator>
      <dc:date>2024-03-05T04:30:30Z</dc:date>
    </item>
  </channel>
</rss>

