<?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 Input App - Tokens not resetting in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238714#M27005</link>
    <description>&lt;P&gt;I like this solution better as it's the expected behavior versus using the Response Handler to set the parameter for the next request (which is confusing).&lt;/P&gt;

&lt;P&gt;Wondering what Damien, the author, thinks regarding this solution. &lt;/P&gt;</description>
    <pubDate>Mon, 22 Jan 2018 18:02:56 GMT</pubDate>
    <dc:creator>quihong</dc:creator>
    <dc:date>2018-01-22T18:02:56Z</dc:date>
    <item>
      <title>REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238697#M26988</link>
      <description>&lt;P&gt;I am using latest version of REST API Modular Input and doing a simple REST data input. &lt;/P&gt;

&lt;P&gt;i have added a new tokens in tokens.py shown below  which give me two time values, one is the current time value and another one is current - 30 mins values.&lt;/P&gt;

&lt;P&gt;def starttime_thirtym():&lt;BR /&gt;
      thirtym = timedelta(minutes=30)&lt;BR /&gt;
      now = datetime.now()&lt;BR /&gt;
      newtime = now - thirtym&lt;BR /&gt;
      return newtime.strftime('%Y-%m-%dT%H:%M:%S')&lt;/P&gt;

&lt;P&gt;def timenow():&lt;BR /&gt;
      now = datetime.now()&lt;BR /&gt;
      return now.strftime('%Y-%m-%dT%H:%M:%S')&lt;/P&gt;

&lt;P&gt;I then pass these tokens $starttime_thirtym$ and $timenow$  to REST endpoint which will then get me some integer value. I am running this every 30mins. My problem is when it runs first time i am getting value as expected, lets say i run it at 4PM, its passing to values to the REST endpoint 4PM and 3:30PM and  lets say i get back value 250. When it runs next time around 4:30, i am still getting the same 250 value. So with every such run i am keep getting the same value. it seems these tokens are not getting rested with every run. I am not sure why.  any idea?&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2015 21:37:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238697#M26988</guid>
      <dc:creator>jatin_patel</dc:creator>
      <dc:date>2015-09-23T21:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238698#M26989</link>
      <description>&lt;P&gt;Can you post an example of your inputs.conf stanza and also an example of an actual URL you use for your REST request ?&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 10:15:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238698#M26989</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2015-09-25T10:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238699#M26990</link>
      <description>&lt;P&gt;Hi Damien,&lt;/P&gt;

&lt;P&gt;Below example will give me count between 5-5:30PM yesterday. &lt;/P&gt;

&lt;P&gt;&lt;A href="http://internalendpoint.internaldomain.com/service/Service.svc/GetCountInTimeRange?minTime=2015-09-24T17:00:00&amp;amp;maxTime=2015-09-24T17:30:00" target="_blank"&gt;http://internalendpoint.internaldomain.com/service/Service.svc/GetCountInTimeRange?minTime=2015-09-24T17:00:00&amp;amp;maxTime=2015-09-24T17:30:00&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;below are the inputs.conf that i have tried&lt;BR /&gt;
[rest://Order_Data2]&lt;BR /&gt;
auth_type = none&lt;BR /&gt;
endpoint = &lt;A href="http://internalendpoint.internaldomain.com/service/Service.svc/GetCountInTimeRange?minTime=$starttime_thirtym$&amp;amp;maxTime=$timenow$" target="_blank"&gt;http://internalendpoint.internaldomain.com/service/Service.svc/GetCountInTimeRange?minTime=$starttime_thirtym$&amp;amp;maxTime=$timenow$&lt;/A&gt;&lt;BR /&gt;
http_method = GET&lt;BR /&gt;
index = main&lt;BR /&gt;
index_error_response_codes = 0&lt;BR /&gt;
polling_interval = 1800&lt;BR /&gt;
response_type = text&lt;BR /&gt;
sequential_mode = 1&lt;BR /&gt;
sourcetype = TestTotalCount&lt;BR /&gt;
streaming_request = 0&lt;BR /&gt;
disabled = 1&lt;/P&gt;

&lt;P&gt;[rest://Order_Data_tc2]&lt;BR /&gt;
auth_type = none&lt;BR /&gt;
endpoint = &lt;A href="http://internalendpoint.internaldomain.com/service/Service.svc/GetCountInTimeRange?minTime=$starttime_thirtym$&amp;amp;maxTime=$timenow$" target="_blank"&gt;http://internalendpoint.internaldomain.com/service/Service.svc/GetCountInTimeRange?minTime=$starttime_thirtym$&amp;amp;maxTime=$timenow$&lt;/A&gt;&lt;BR /&gt;
http_method = GET&lt;BR /&gt;
index = main&lt;BR /&gt;
index_error_response_codes = 0&lt;BR /&gt;
polling_interval = */5 * * * *&lt;BR /&gt;
response_handler = TotalCount&lt;BR /&gt;
response_type = text&lt;BR /&gt;
sequential_mode = 0&lt;BR /&gt;
sourcetype = TestTotalCount2&lt;BR /&gt;
streaming_request = 0&lt;BR /&gt;
disabled = 1&lt;BR /&gt;
sequential_stagger_time =&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:22:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238699#M26990</guid>
      <dc:creator>jatin_patel</dc:creator>
      <dc:date>2020-09-29T07:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238700#M26991</link>
      <description>&lt;P&gt;I have a solution for you.&lt;/P&gt;

&lt;P&gt;Token substitution only happens once , before the initial request.&lt;/P&gt;

&lt;P&gt;To update the minTime and maxTime URL parameters for subsequent requests , you will need to declare a custom response handler in &lt;STRONG&gt;rest_ta/bin/responsehandlers.py&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Something like :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;class MyAwesomeResponseHandler:

    def __init__(self,**args):
        pass

    def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):       

        print_xml_stream(raw_response_output)        

        if not "params" in req_args:
            req_args["params"] = {}

        #implement the methods referred to here
        req_args["params"]["minTime"] = getMinTime()
        req_args["params"]["maxTime"] = getMaxTime()
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then to apply this just declare it in your stanza setup :&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/669i0C2B0FC30141187D/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 17:28:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238700#M26991</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2015-09-25T17:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238701#M26992</link>
      <description>&lt;P&gt;Damien,&lt;/P&gt;

&lt;P&gt;Response handler are only after we get the response from REST endpoint and used more to act on the data before it indexes. &lt;BR /&gt;
But if i am unable to get the data from right time range how does it matter on using this approach?&lt;/P&gt;

&lt;P&gt;Also if its keep using the same token value with every run what is the point of defining dynamic tokens in the tokens.py? I could just hardcode the value in the endpoint.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
-Jatin.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 17:44:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238701#M26992</guid>
      <dc:creator>jatin_patel</dc:creator>
      <dc:date>2015-09-25T17:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238702#M26993</link>
      <description>&lt;P&gt;Response Handlers can serve 2 main purposes ;&lt;/P&gt;

&lt;P&gt;1) pre processing of the response before outputting to Splunk for indexing&lt;BR /&gt;
2) setting parameters for the &lt;STRONG&gt;next request&lt;/STRONG&gt; to be made (url args, headers,cookies etc...)&lt;/P&gt;

&lt;P&gt;Define your token (as you are currently doing) for the first intial call.&lt;/P&gt;

&lt;P&gt;Then use a custom response handler (which sets the minTime maxtime into the next request as per my example) for subsequent calls.&lt;/P&gt;

&lt;P&gt;Try it.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 17:52:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238702#M26993</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2015-09-25T17:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238703#M26994</link>
      <description>&lt;P&gt;Now it makes sense...is there a extended documentation for this app? I feel lot of it is not documented in the App page. &lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 18:07:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238703#M26994</guid>
      <dc:creator>jatin_patel</dc:creator>
      <dc:date>2015-09-25T18:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238704#M26995</link>
      <description>&lt;P&gt;This is free community software created and supported by just me. I update the docs from time to time when I can.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 18:09:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238704#M26995</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2015-09-25T18:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238705#M26996</link>
      <description>&lt;P&gt;Below is the class i have added in est_ta/bin/responsehandlers.py. Thanks to Damien!!!&lt;/P&gt;

&lt;P&gt;class MyClass:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;def __init__(self,**args):
    pass

def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):
    print_xml_stream(raw_response_output)
    now = datetime.now()
    thirtym = timedelta(minutes=30)
    newtime = now + thirtym
    time_fmt = '%Y-%m-%dT%H:%M:%S'

    if not "params" in req_args:
        req_args["params"] = {}
    req_args["params"]["starttime_thirtym"] = now.strftime(time_fmt)
    req_args["params"]["timenow"] = newtime.strftime(time_fmt)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Sep 2015 17:04:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238705#M26996</guid>
      <dc:creator>jatin_patel</dc:creator>
      <dc:date>2015-09-30T17:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238706#M26997</link>
      <description>&lt;P&gt;Hi Damien,&lt;BR /&gt;
I am having similar requirement but in my case I am trying to access a URL to get cookie before endpoint URL. Can you provide some guidelines on how to invoke a pre-check URL / mechanism to check / get cookies before accessing endpoints.&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Rakesh&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2016 12:21:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238706#M26997</guid>
      <dc:creator>rakeshbhl</dc:creator>
      <dc:date>2016-08-30T12:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238707#M26998</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I encountered exactly the same issue and found another solution.&lt;/P&gt;

&lt;P&gt;Indeed, using custom response handler worked well to set URL arguments but I didn't find how to use it to set tokens in URL path (ex : &lt;A href="http://myendpoint/api/$token$/search"&gt;http://myendpoint/api/$token$/search&lt;/A&gt;).&lt;/P&gt;

&lt;P&gt;After analyzing &lt;STRONG&gt;rest_ta/bin/rest.py&lt;/STRONG&gt;, I found this part of the script, which is executed for each polling (begins at line 465 in version 1.4 of the REST Modular Input App) :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;while True:

    if polling_type == 'cron':
        next_cron_firing = cron_iter.get_next(datetime)
        while get_current_datetime_for_cron() != next_cron_firing:
            time.sleep(float(10))

    for endpoint in endpoint_list:

        if "params" in req_args:
            req_args_params_current = dictParameterToStringFormat(req_args["params"])
        else:
       (...)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem is that the &lt;CODE&gt;endpoint_list&lt;/CODE&gt; variable is set the first time the script runs, but is never updated after that.&lt;/P&gt;

&lt;P&gt;I added the functions used when the script starts, before the " &lt;CODE&gt;for endpoint in endpoint_list&lt;/CODE&gt; " loop as below :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    while True:

        if polling_type == 'cron':
            next_cron_firing = cron_iter.get_next(datetime)
            while get_current_datetime_for_cron() != next_cron_firing:
                time.sleep(float(10))

        original_endpoint=config.get("endpoint")
        #token replacement
        endpoint_list = replaceTokens(original_endpoint)

        for endpoint in endpoint_list:

            if "params" in req_args:
                req_args_params_current = dictParameterToStringFormat(req_args["params"])
            else:
            (...)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;After that, tokens are always updated with tokens.py file before the REST API is polled.&lt;/P&gt;

&lt;P&gt;Damien, if the answer is correct, is it possible to update the rest.py script for the next version of the REST Modular Input App ?&lt;/P&gt;

&lt;P&gt;Thank you in advance, and sorry for my english, I didn't speak for a while &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2017 15:19:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238707#M26998</guid>
      <dc:creator>ext_thales_dami</dc:creator>
      <dc:date>2017-03-27T15:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238708#M26999</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;

&lt;P&gt;We are facing the same issue here.&lt;/P&gt;

&lt;P&gt;We are trying to use a token to replace a value in the querystring parameter.&lt;BR /&gt;
We've written a function on the tokens.py and we've setted the token name in the Endpoint URL: &lt;A href="http://www.something.com/getinfo?value=$tokenName$"&gt;http://www.something.com/getinfo?value=$tokenName$&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;This didn't work, so we have found this thread and tried the solution you suggested (changing the rest.py to force the token replacement) but this didn't work also...&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 10:09:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238708#M26999</guid>
      <dc:creator>joaopadilha</dc:creator>
      <dc:date>2017-06-01T10:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238709#M27000</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;If your token is not replaced with any value in the URL :&lt;/EM&gt;&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;What kind of function did you write in tokens.py ?&lt;/LI&gt;
&lt;LI&gt;Did you test it (for example by running tokens.py with a &lt;CODE&gt;print&lt;/CODE&gt; instead of a &lt;CODE&gt;return&lt;/CODE&gt; in the function) to check that the results are correct ? It should return only a single value (ex : &lt;CODE&gt;'zoo'&lt;/CODE&gt;) or a list of values (ex : &lt;CODE&gt;['goo','foo','zoo']&lt;/CODE&gt;)&lt;/LI&gt;
&lt;LI&gt;Does your function have exactly the same name than your token ( &lt;CODE&gt;def tokenName()&lt;/CODE&gt; ) ?&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;&lt;EM&gt;If your token is replaced with a value the first time but is never updated :&lt;/EM&gt;&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Did you restart splunk service after modifying the rest.py script ?&lt;/LI&gt;
&lt;LI&gt;Are you sure that your function in tokens.py returns different values each time it is called ?&lt;/LI&gt;
&lt;LI&gt;Which version are you using for the REST Modular Input App ? I tried this solution with success only on 1.4 and didn't test it on previous versions.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Thu, 01 Jun 2017 11:42:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238709#M27000</guid>
      <dc:creator>ext_thales_dami</dc:creator>
      <dc:date>2017-06-01T11:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238710#M27001</link>
      <description>&lt;P&gt;My token in not replaced with any value in the URL.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;It's a function that reads and returns a single value from a .csv file&lt;/LI&gt;
&lt;LI&gt;Yes we tested it and it works fine.&lt;/LI&gt;
&lt;LI&gt;Yes, it has the exact same name.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Thu, 01 Jun 2017 13:02:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238710#M27001</guid>
      <dc:creator>joaopadilha</dc:creator>
      <dc:date>2017-06-01T13:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238711#M27002</link>
      <description>&lt;P&gt;The only case where I didn't have any value in my URL during my tests was because of the variable's format returned by the function. &lt;BR /&gt;
Did you try something like &lt;CODE&gt;return str(myvalue)&lt;/CODE&gt; at the end of your function ? &lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 13:29:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238711#M27002</guid>
      <dc:creator>ext_thales_dami</dc:creator>
      <dc:date>2017-06-01T13:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238712#M27003</link>
      <description>&lt;P&gt;Well, the output from the function is: &lt;BR /&gt;
'86626496'&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 13:42:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238712#M27003</guid>
      <dc:creator>joaopadilha</dc:creator>
      <dc:date>2017-06-01T13:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238713#M27004</link>
      <description>&lt;P&gt;Btw, we didn't change the response handler...&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 13:50:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238713#M27004</guid>
      <dc:creator>joaopadilha</dc:creator>
      <dc:date>2017-06-01T13:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238714#M27005</link>
      <description>&lt;P&gt;I like this solution better as it's the expected behavior versus using the Response Handler to set the parameter for the next request (which is confusing).&lt;/P&gt;

&lt;P&gt;Wondering what Damien, the author, thinks regarding this solution. &lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 18:02:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/238714#M27005</guid>
      <dc:creator>quihong</dc:creator>
      <dc:date>2018-01-22T18:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/530934#M64276</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/1660"&gt;@Damien_Dallimor&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/47972"&gt;@jatin_patel&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I'm doing just like you suggested, defined my function 'testid()'&amp;nbsp; in tokens.py and responsehandlers.py&amp;nbsp;&lt;/P&gt;&lt;P&gt;scenario: created a function to read a value from csv file(which is being updated constantly with the last logged AuditId in splunk) and return the value after incrementing.&lt;BR /&gt;Tokens.py ---&amp;gt;&lt;/P&gt;&lt;P&gt;import csv&lt;BR /&gt;def xyz():&lt;BR /&gt;with open('abc.csv', 'r') as f:&lt;BR /&gt;csv_f=csv.DictReader(f)&lt;BR /&gt;for row in csv_f:&lt;BR /&gt;x=int(row['AuditId'])&lt;BR /&gt;return(str(x+1))&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;responsehandlers.py ----&amp;gt;&lt;/P&gt;&lt;P&gt;class Mytestclass:&lt;/P&gt;&lt;P&gt;def __init__(self,**args):&lt;BR /&gt;pass&lt;/P&gt;&lt;P&gt;def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):&lt;BR /&gt;print_xml_stream(raw_response_output)&lt;BR /&gt;with open('abc.csv','r') as f:&lt;BR /&gt;csv_f = csv.DictReader(f)&lt;BR /&gt;for row in csv_f:&lt;BR /&gt;x=int(row['AuditId'])&lt;/P&gt;&lt;P&gt;if not "params" in req_args:&lt;BR /&gt;req_args["params"]= {}&lt;BR /&gt;req_args["params"]["testid"]=str(x+1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However,&amp;nbsp;I'm still facing some issues,&lt;/P&gt;&lt;P&gt;1. Every event is being logged twice.&lt;/P&gt;&lt;P&gt;2. Some AuditId's are missing.&lt;/P&gt;&lt;P&gt;3.&amp;nbsp; empty events are getting created with 0 return records.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 03:10:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/530934#M64276</guid>
      <dc:creator>Jasdeep</dc:creator>
      <dc:date>2020-11-26T03:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Modular Input App - Tokens not resetting</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/634014#M78691</link>
      <description>&lt;P&gt;having token in endpoint, and doing that setting in responsehandler.py leads to doubling param in subsequent call:&lt;/P&gt;&lt;P&gt;url addr:&amp;nbsp;&lt;A href="https://my.rest.partner/getsomedata?start=$since10min$" target="_blank"&gt;https://my.rest.partner/getsomedata?start=$since10min$&lt;/A&gt;&lt;/P&gt;&lt;P&gt;url args: &amp;lt;none&amp;gt;&lt;/P&gt;&lt;P&gt;responsehandler: myresphdl&lt;/P&gt;&lt;P&gt;tokens.py: def since10min()&lt;/P&gt;&lt;P&gt;responsehandler.py: def myresphdl() params[since10min] = "xx"&lt;/P&gt;&lt;P&gt;--&amp;gt;&lt;/P&gt;&lt;P&gt;next call calls&amp;nbsp;&lt;A href="https://my.rest.partner/getsomedata?start=$since10min$" target="_blank"&gt;https://my.rest.partner/getsomedata?start=10&amp;amp;start=20&lt;/A&gt;&lt;/P&gt;&lt;P&gt;leading to error from rest-peer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;also, if rest-peer throws error,the responsehandler never gets the chance to set the params in reststate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i solved this by having no tokens used, rest-peer throws error but i ignore it (tweak rest.py), set the responsehandler params and voila, next time it works&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there a better way to achvieve same?&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 07:17:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/REST-API-Modular-Input-App-Tokens-not-resetting/m-p/634014#M78691</guid>
      <dc:creator>carbdb</dc:creator>
      <dc:date>2023-03-10T07:17:54Z</dc:date>
    </item>
  </channel>
</rss>

