<?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: REST API Modular - Why are the dynamic tokens used for URL not updating? in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Why-are-the-dynamic-tokens-used-for-URL-not/m-p/669189#M79973</link>
    <description>&lt;P&gt;The problem is that the&amp;nbsp;endpoint_list&amp;nbsp;variable is set the first time the script runs, but is never updated after that.&lt;/P&gt;&lt;P&gt;I just edited rest_ta/bin/rest.py, before the "&amp;nbsp;for endpoint in endpoint_list&amp;nbsp;" loop as below :&lt;/P&gt;&lt;P&gt;(begins at line 465 in version 1.4 of the REST Modular Input App)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="loggar_0-1700487539055.png" style="width: 676px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28176i0D817EAE93B8770B/image-dimensions/676x404?v=v2" width="676" height="404" role="button" title="loggar_0-1700487539055.png" alt="loggar_0-1700487539055.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;After that, tokens are always updated with tokens.py file before the REST API is polled.&lt;/P&gt;</description>
    <pubDate>Mon, 20 Nov 2023 13:52:32 GMT</pubDate>
    <dc:creator>loggar</dc:creator>
    <dc:date>2023-11-20T13:52:32Z</dc:date>
    <item>
      <title>REST API Modular - Why are the dynamic tokens used for URL not updating?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Why-are-the-dynamic-tokens-used-for-URL-not/m-p/607217#M77266</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I'm currently using the Modular REST API to pull data from a REST API which allows me to specify the earliest time for events through an argument in the URL.&lt;/P&gt;
&lt;P&gt;I'm using the dynamic token functionality to put a unix timestamp into the URL, all works well. My python code in tokens.py just gets the current linux time and takes 80 seconds from it.&lt;/P&gt;
&lt;P&gt;My interval is then set to 60 seconds and in theory I shouldn't lose any data from the API.&lt;/P&gt;
&lt;P&gt;However the REST API Add-on seems to always issue the same request to the API. If I restart splunk then it seems to update and the API call uses the correct time, however then it just keeps using the same time, although the Python code should be updating.&lt;/P&gt;
&lt;P&gt;Here's the Python code.&lt;/P&gt;
&lt;P&gt;def eightySecondsAgo():&lt;BR /&gt;unixEpochTimeNow = time.time()&lt;BR /&gt;timeEightySecondsAgo = int(unixEpochTimeNow) - 80&lt;BR /&gt;return str(timeEightySecondsAgo)&lt;/P&gt;
&lt;P&gt;Any my inputs.conf&lt;/P&gt;
&lt;P&gt;[rest://Intercom_admin_events]&lt;BR /&gt;activation_key = &amp;lt;redacted&amp;gt;&lt;BR /&gt;endpoint=&lt;A href="https://api.intercom.io/admins/activity_logs?created_at_after=$eightySecondsAgo$" target="_blank" rel="noopener"&gt;https://api.intercom.io/admins/activity_logs?created_at_after=$eightySecondsAgo$&lt;/A&gt;&lt;BR /&gt;http_header_propertys = authorization=Bearer &amp;lt;redacted&amp;gt;,accept=application/json,content-type=application/json&lt;BR /&gt;http_method = GET&lt;BR /&gt;auth_type= none&lt;BR /&gt;response_type = json&lt;BR /&gt;streaming_request=0&lt;BR /&gt;verify=0&lt;BR /&gt;sourcetype=intercom.admin.events&lt;BR /&gt;polling_interval=60&lt;/P&gt;
&lt;P&gt;It's like the dynamic token response is being cached or something? Really strange.&lt;/P&gt;
&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 16:18:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Why-are-the-dynamic-tokens-used-for-URL-not/m-p/607217#M77266</guid>
      <dc:creator>Stu-eonnext</dc:creator>
      <dc:date>2022-07-27T16:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular - Why are the dynamic tokens used for URL not updating?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Why-are-the-dynamic-tokens-used-for-URL-not/m-p/669189#M79973</link>
      <description>&lt;P&gt;The problem is that the&amp;nbsp;endpoint_list&amp;nbsp;variable is set the first time the script runs, but is never updated after that.&lt;/P&gt;&lt;P&gt;I just edited rest_ta/bin/rest.py, before the "&amp;nbsp;for endpoint in endpoint_list&amp;nbsp;" loop as below :&lt;/P&gt;&lt;P&gt;(begins at line 465 in version 1.4 of the REST Modular Input App)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="loggar_0-1700487539055.png" style="width: 676px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28176i0D817EAE93B8770B/image-dimensions/676x404?v=v2" width="676" height="404" role="button" title="loggar_0-1700487539055.png" alt="loggar_0-1700487539055.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;After that, tokens are always updated with tokens.py file before the REST API is polled.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 13:52:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Why-are-the-dynamic-tokens-used-for-URL-not/m-p/669189#M79973</guid>
      <dc:creator>loggar</dc:creator>
      <dc:date>2023-11-20T13:52:32Z</dc:date>
    </item>
  </channel>
</rss>

