<?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: Handler Arguments from responsehandlers.py for REST API Modular Input app adding raw data in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Handler-Arguments-from-responsehandlers-py-for-REST-API-Modular/m-p/324922#M38902</link>
    <description>&lt;P&gt;Thanks for your help this is resolved we have changed code to this&lt;/P&gt;

&lt;P&gt;ef &lt;STRONG&gt;init&lt;/STRONG&gt;(self,**args):&lt;BR /&gt;
     pass&lt;BR /&gt;
 def &lt;STRONG&gt;call&lt;/STRONG&gt;(self, response_object,raw_response_output,response_type,req_args,endpoint):&lt;BR /&gt;
     if response_type == "json":&lt;BR /&gt;
         output = json.loads(raw_response_output)&lt;BR /&gt;
         data1=output['columnHeader']&lt;BR /&gt;
         data2=output['formattedData']&lt;BR /&gt;
         for i in data2:&lt;BR /&gt;
             dic=dict(zip(data1,i))&lt;BR /&gt;
             print_xml_stream(json.dumps(dic))&lt;BR /&gt;
     else:&lt;BR /&gt;
         print_xml_stream(raw_response_output)&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 16:25:03 GMT</pubDate>
    <dc:creator>pranayadla</dc:creator>
    <dc:date>2020-09-29T16:25:03Z</dc:date>
    <item>
      <title>Handler Arguments from responsehandlers.py for REST API Modular Input app adding raw data</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Handler-Arguments-from-responsehandlers-py-for-REST-API-Modular/m-p/324918#M38898</link>
      <description>&lt;P&gt;I would like to ask how could I transform Json data from one format to another Json format.&lt;/P&gt;

&lt;P&gt;class APMRESTeventHandler:&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):
    if response_type == "json":
        output = json.loads(raw_response_output)
        data1=output['columnHeader']
        data2=output['formattedData']
        for i in data2:
            dic=dict(zip(data1,i))
            print_xml_stream(json.dump(dic,ensure_ascii=False))
    else:
        print_xml_stream(raw_response_output)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Oct 2017 14:50:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Handler-Arguments-from-responsehandlers-py-for-REST-API-Modular/m-p/324918#M38898</guid>
      <dc:creator>pranayadla</dc:creator>
      <dc:date>2017-10-24T14:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: Handler Arguments from responsehandlers.py for REST API Modular Input app adding raw data</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Handler-Arguments-from-responsehandlers-py-for-REST-API-Modular/m-p/324919#M38899</link>
      <description>&lt;P&gt;Using a custom response handler is the correct approach.&lt;/P&gt;

&lt;P&gt;Can you please ask the question with more context.&lt;/P&gt;

&lt;P&gt;Such as, &lt;/P&gt;

&lt;P&gt;1) what actual problem are you encountering with your handler above ?&lt;BR /&gt;
2) any log errors pertaining to 1&lt;BR /&gt;
3) what does your configuration look like pertaining to 1&lt;BR /&gt;
4) to help troubleshooot , what do the target and destination JSON format look like ? &lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 18:17:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Handler-Arguments-from-responsehandlers-py-for-REST-API-Modular/m-p/324919#M38899</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2017-10-24T18:17:00Z</dc:date>
    </item>
    <item>
      <title>Re: Handler Arguments from responsehandlers.py for REST API Modular Input app adding raw data</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Handler-Arguments-from-responsehandlers-py-for-REST-API-Modular/m-p/324920#M38900</link>
      <description>&lt;P&gt;We are trying to use custom response handler to transform data from on JSON format to Another JSON format.&lt;/P&gt;

&lt;P&gt;In RAW data we are getting columnHeader and formattedData but target JSON needs to be combination of these two.&lt;/P&gt;

&lt;P&gt;We have used given handler to transform it's working fine in locally if we took JSON file as input. But not working when we used this in custom response handler. Data coming in as it is not transformed to another JSON format.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 06:36:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Handler-Arguments-from-responsehandlers-py-for-REST-API-Modular/m-p/324920#M38900</guid>
      <dc:creator>pranayadla</dc:creator>
      <dc:date>2017-10-25T06:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: Handler Arguments from responsehandlers.py for REST API Modular Input app adding raw data</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Handler-Arguments-from-responsehandlers-py-for-REST-API-Modular/m-p/324921#M38901</link>
      <description>&lt;P&gt;And anything to add for points 2,3,4 ? &lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 07:59:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Handler-Arguments-from-responsehandlers-py-for-REST-API-Modular/m-p/324921#M38901</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2017-10-25T07:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: Handler Arguments from responsehandlers.py for REST API Modular Input app adding raw data</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Handler-Arguments-from-responsehandlers-py-for-REST-API-Modular/m-p/324922#M38902</link>
      <description>&lt;P&gt;Thanks for your help this is resolved we have changed code to this&lt;/P&gt;

&lt;P&gt;ef &lt;STRONG&gt;init&lt;/STRONG&gt;(self,**args):&lt;BR /&gt;
     pass&lt;BR /&gt;
 def &lt;STRONG&gt;call&lt;/STRONG&gt;(self, response_object,raw_response_output,response_type,req_args,endpoint):&lt;BR /&gt;
     if response_type == "json":&lt;BR /&gt;
         output = json.loads(raw_response_output)&lt;BR /&gt;
         data1=output['columnHeader']&lt;BR /&gt;
         data2=output['formattedData']&lt;BR /&gt;
         for i in data2:&lt;BR /&gt;
             dic=dict(zip(data1,i))&lt;BR /&gt;
             print_xml_stream(json.dumps(dic))&lt;BR /&gt;
     else:&lt;BR /&gt;
         print_xml_stream(raw_response_output)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:25:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Handler-Arguments-from-responsehandlers-py-for-REST-API-Modular/m-p/324922#M38902</guid>
      <dc:creator>pranayadla</dc:creator>
      <dc:date>2020-09-29T16:25:03Z</dc:date>
    </item>
  </channel>
</rss>

