<?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: Marketing Events API Methods Not Working in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Marketing-Events-API-Methods-Not-Working/m-p/963855#M72949</link>
    <description>&lt;P&gt;Thanks, Edd! I tried this, and it's successful; however, it's not returning the JSON for the Marketing Event that I'm querying with the&amp;nbsp;&lt;FONT face="terminal,monaco"&gt;&lt;STRONG&gt;queryParam&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;constant. Here's the log:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;INFO { results: [] }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, can you provide a little clarity to this remark?&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;"&lt;SPAN&gt;I'd try using the original GET endpoint you're using, then adding in the externalAccountId using the same structure as below."&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;What would the syntax be for using the &lt;STRONG&gt;&lt;FONT face="terminal,monaco"&gt;getById()&lt;/FONT&gt;&lt;/STRONG&gt; method? Or perhaps I'm misunderstanding you. Thanks again for your response!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 20 Apr 2024 03:26:47 GMT</pubDate>
    <dc:creator>TSpooner5</dc:creator>
    <dc:date>2024-04-20T03:26:47Z</dc:date>
    <item>
      <title>Marketing Events API Methods Not Working</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Marketing-Events-API-Methods-Not-Working/m-p/962331#M72844</link>
      <description>&lt;P&gt;I'm using the "Get a marketing event" endpoint in the Marketing Events API but the method shown in the documentation isn't working, paritcuarly the following part of the example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const apiResponse = await hubspotClient.marketing.events.marketingEventsExternalApi.getById(externalEventId, externalAccountId);
console.log(JSON.stringify(apiResponse, null, 2));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The call throws the following error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Error: TypeError: hubspotClient.marketing.events.marketingEventsExternalApi.getById is not a function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;If you look at the prototypes for marketingEventsApi, using the following, getById() isn't listed:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;console.log(Objects.getOwnPropertyNames(Object.getPrototypeOf(hubspotClient.marketing.events.marketingEventsExternalApi)));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead, the following is returned in the logs:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;INFO [ 'constructor', 'completeWithHttpInfo', 'complete' ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this is an error in the documentation or am I doing something wrong? I already verified that the right scopes are enabled in the private app. I also couldn't find anything online saying the method was deprecated. Please help!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2024 04:48:24 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Marketing-Events-API-Methods-Not-Working/m-p/962331#M72844</guid>
      <dc:creator>TSpooner5</dc:creator>
      <dc:date>2024-04-18T04:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Marketing Events API Methods Not Working</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Marketing-Events-API-Methods-Not-Working/m-p/962495#M72851</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/747442"&gt;@TSpooner5&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Interesting one!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you tried the search endpoint instead?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Generally the way I've found around the "is not a function" error is by structuring my request a bit differently. So if this code below doesn't work immediately (with the search endpoint), I'd try using the original GET endpoint you're using, then adding in the externalAccountId using the same structure as below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const axios = require('axios');

exports.main = async (event, callback) =&amp;gt; {
    const queryParam = '01010101010101010'; // Just the eventId, not the externalAccountId

    const hubspotApiKey = "Your secret";
    const options = {
        method: 'GET',
        url: `https://api.hubapi.com/marketing/v3/marketing-events/events/search?q=${queryParam}`,
        headers: {
            Authorization: `Bearer ${hubspotApiKey}` 
        }
    };

    let responseData = null;

    try {
        const response = await axios(options);
        responseData = response.data;
        console.log(responseData);
        
    } catch (error) {
        console.error('Error:', error);
        throw error;
    }

    callback({
        outputFields: {
            responseData: JSON.stringify(responseData)
        }
    });
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if it works, got everything crossed for you!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":crossed_fingers:"&gt;🤞&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Edd&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2024 09:59:11 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Marketing-Events-API-Methods-Not-Working/m-p/962495#M72851</guid>
      <dc:creator>EddBrisley</dc:creator>
      <dc:date>2024-04-18T09:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: Marketing Events API Methods Not Working</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Marketing-Events-API-Methods-Not-Working/m-p/962628#M72862</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dsmarion_0-1713445084167.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/115568i5C55C276A883D1A3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dsmarion_0-1713445084167.png" alt="dsmarion_0-1713445084167.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.hubspot.com/docs/api/marketing/marketing-events" target="_blank"&gt;https://developers.hubspot.com/docs/api/marketing/marketing-events&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2024 12:58:48 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Marketing-Events-API-Methods-Not-Working/m-p/962628#M72862</guid>
      <dc:creator>dsmarion</dc:creator>
      <dc:date>2024-04-18T12:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: Marketing Events API Methods Not Working</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Marketing-Events-API-Methods-Not-Working/m-p/963855#M72949</link>
      <description>&lt;P&gt;Thanks, Edd! I tried this, and it's successful; however, it's not returning the JSON for the Marketing Event that I'm querying with the&amp;nbsp;&lt;FONT face="terminal,monaco"&gt;&lt;STRONG&gt;queryParam&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;constant. Here's the log:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;INFO { results: [] }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, can you provide a little clarity to this remark?&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;"&lt;SPAN&gt;I'd try using the original GET endpoint you're using, then adding in the externalAccountId using the same structure as below."&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;What would the syntax be for using the &lt;STRONG&gt;&lt;FONT face="terminal,monaco"&gt;getById()&lt;/FONT&gt;&lt;/STRONG&gt; method? Or perhaps I'm misunderstanding you. Thanks again for your response!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Apr 2024 03:26:47 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Marketing-Events-API-Methods-Not-Working/m-p/963855#M72949</guid>
      <dc:creator>TSpooner5</dc:creator>
      <dc:date>2024-04-20T03:26:47Z</dc:date>
    </item>
  </channel>
</rss>

