<?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: &amp;quot;Failed to parse json object from response&amp;quot; Error message in output file from the API response in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/quot-failed-to-parse-json-object-from-response-quot-error/m-p/414778#M2703</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/185558"&gt;@Naeema&lt;/a&gt;, it would be best to post this query in the XSOAR discussion area here:&amp;nbsp;&lt;A href="https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/bd-p/Cortex_XSOAR_Discussions" target="_blank"&gt;https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/bd-p/Cortex_XSOAR_Discussions&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Jun 2021 15:43:49 GMT</pubDate>
    <dc:creator>JimmyHolland</dc:creator>
    <dc:date>2021-06-23T15:43:49Z</dc:date>
    <item>
      <title>"Failed to parse json object from response" Error message in output file from the API response</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/quot-failed-to-parse-json-object-from-response-quot-error/m-p/414733#M2702</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to XSOAR and I'm getting an error in the output response file from Recorded Future API, while modifying its version2 integration, to include few commands which are present in the first version but absent in the new version. The response output file from the API is a string file which starts with the error: "Failed to parse json object from response" followed by binary encoded, json data. I need the API response in a csv file as the final output of the command. Currently the _http_request internally converts the csv output to return it in json format(I guess this is where I am getting the error), which then I need to convert to .csv file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The below code was added to the new integration.&lt;/P&gt;&lt;P&gt;This is the function added to the client class:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def get_any_risklist(
        self, risk_list: List[str], cmd_url: str
    )-&amp;gt;str:
        """Get Specified Risk List command."""
        params = {
            'format': 'csv/splunk'
        }
        if risk_list:
            params['list'] = risk_list
        return 
self._http_request(method='get',url_suffix=cmd_url,params=params)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code added to the main function:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;elif command in ["recorded-future-get-domain-risklist","recorded-future-get-url-risklist","recorded-future-get-ip-risklist","recorded-future-get-vulnerability-risklist","recorded-future-get-hash-risklist"]:
            risk_list=demisto_args.get("list")
            if command=="recorded-future-get-domain-risklist":
                cmd_url='domain/risklist'
                file_name='domain_risk_list.csv'
            elif command=="recorded-future-get-url-risklist":
                cmd_url="url/risklist"
                file_name='url_risk_list.csv'
            elif command=="recorded-future-get-ip-risklist":
                cmd_url='ip/risklist'
                file_name='ip_risk_list.csv'
            elif command=="recorded-future-get-vulnerability-risklist":
                cmd_url='vulnerability/risklist'
                file_name='vulnerability_risk_list.csv'
            elif command=="recorded-future-get-hash-risklist":
                cmd_url='hash/risklist'
                file_name='hash_risk_list.csv'

            res = client.get_any_risklist(risk_list,cmd_url)       
            if not res:
                return_error('Received empty response')
            demisto.results(fileResult(filename=file_name, data=res.encode('utf-8'))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 13:29:23 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/quot-failed-to-parse-json-object-from-response-quot-error/m-p/414733#M2702</guid>
      <dc:creator>Naeema</dc:creator>
      <dc:date>2021-06-23T13:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: "Failed to parse json object from response" Error message in output file from the API response</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/quot-failed-to-parse-json-object-from-response-quot-error/m-p/414778#M2703</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/185558"&gt;@Naeema&lt;/a&gt;, it would be best to post this query in the XSOAR discussion area here:&amp;nbsp;&lt;A href="https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/bd-p/Cortex_XSOAR_Discussions" target="_blank"&gt;https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/bd-p/Cortex_XSOAR_Discussions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 15:43:49 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/quot-failed-to-parse-json-object-from-response-quot-error/m-p/414778#M2703</guid>
      <dc:creator>JimmyHolland</dc:creator>
      <dc:date>2021-06-23T15:43:49Z</dc:date>
    </item>
  </channel>
</rss>

