<?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: Json Error when sending POST request to https://api.prismacloud.io/search/config in Prisma Cloud Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/json-error-when-sending-post-request-to-https-api-prismacloud-io/m-p/511695#M587</link>
    <description>&lt;P&gt;Greetings PPrabhakar,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope that this note finds you well! I know that it has been a while since you had posted this question but I wanted to see if you still potentially needed any help. Thank you for your time and I hope that you have a good remainder of your day.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind Regards,&lt;/P&gt;
&lt;P&gt;J. Avery King&lt;/P&gt;</description>
    <pubDate>Fri, 12 Aug 2022 14:24:34 GMT</pubDate>
    <dc:creator>AKing9</dc:creator>
    <dc:date>2022-08-12T14:24:34Z</dc:date>
    <item>
      <title>Json Error when sending POST request to https://api.prismacloud.io/search/config</title>
      <link>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/json-error-when-sending-post-request-to-https-api-prismacloud-io/m-p/400920#M367</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am getting the below error when sending the POST request to "&lt;SPAN&gt;&lt;A href="https://api.prismacloud.io/search/config&amp;quot;," target="_blank" rel="noopener"&gt;https://api.prismacloud.io/search/config",&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;Error:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
"errorMessage": "Expecting value: line 1 column 1 (char 0)",
"errorType": "JSONDecodeError",
"stackTrace": [
" File \"/var/task/lambda_function.py\", line 49, in lambda_handler\n queryRQL(REQ_HEADER,url,requestbodyAWS)\n",
" File \"/var/task/lambda_function.py\", line 14, in queryRQL\n json_string = json.dumps(response.json())\n",
" File \"/opt/python/requests/models.py\", line 900, in json\n return complexjson.loads(self.text, **kwargs)\n",
" File \"/var/lang/lib/python3.8/json/__init__.py\", line 357, in loads\n return _default_decoder.decode(s)\n",
" File \"/var/lang/lib/python3.8/json/decoder.py\", line 337, in decode\n obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n",
" File \"/var/lang/lib/python3.8/json/decoder.py\", line 355, in raw_decode\n raise JSONDecodeError(\"Expecting value\", s, err.value) from None\n"
]
}&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;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;Here is my python code:&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import requests
import json
import csv
import re
import sys

Query_ACM = "{\"timeRange\":{\"value\":{\"unit\":\"hour\",\"amount\":24},\"type\":\"relative\"},\"withResourceJson\":true,\"query\":\"config from cloud.resource where cloud.type = 'aws' AND api.name = 'aws-acm-describe-certificate'\"}"
 
def login():
    header = {'Content-Type':'application/json'}
    payload = {"username":"AccessKey","password":"SecretAccessKey"}
    API = "https://api.prismacloud.io"
    response = requests.request('POST', '{}/login'.format(API), json=payload, headers=header)
    json_response = response.json()
    return json_response['token']
 
    JWT_TOKEN = login()
    url = "https://api.prismacloud.io/search/config"
    REQ_HEADER = {'Content-Type':'application/json','x-redlock-auth':JWT_TOKEN}

def queryRQL(REQ_HEADER,url,RQLquery):
    response = requests.request("POST", url, data=RQLquery, headers=REQ_HEADER)
    json_string = json.dumps(response.json())
    json_data = json.loads(json_string)
    return json_data
 
 json_output = queryRQL(REQ_HEADER,url,Query_ACM)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;FONT face="inherit"&gt;Note: When this script is run locally it perfectly runs fine, but when deployed to a lambda function it gives the error mentioned in the &lt;/FONT&gt;beginning&lt;FONT face="inherit"&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;Can anyone suggest why the lambda function fails to run this?&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;Thanks &amp;amp; Regards,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;Pavan&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 21 Apr 2021 13:55:38 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/json-error-when-sending-post-request-to-https-api-prismacloud-io/m-p/400920#M367</guid>
      <dc:creator>PPrabhakar</dc:creator>
      <dc:date>2021-04-21T13:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: Json Error when sending POST request to https://api.prismacloud.io/search/config</title>
      <link>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/json-error-when-sending-post-request-to-https-api-prismacloud-io/m-p/511695#M587</link>
      <description>&lt;P&gt;Greetings PPrabhakar,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope that this note finds you well! I know that it has been a while since you had posted this question but I wanted to see if you still potentially needed any help. Thank you for your time and I hope that you have a good remainder of your day.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind Regards,&lt;/P&gt;
&lt;P&gt;J. Avery King&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 14:24:34 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/json-error-when-sending-post-request-to-https-api-prismacloud-io/m-p/511695#M587</guid>
      <dc:creator>AKing9</dc:creator>
      <dc:date>2022-08-12T14:24:34Z</dc:date>
    </item>
  </channel>
</rss>

