<?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: Unable to use the Prisma Cloud CSPM API to POST the Compliance Trend in Prisma Cloud Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/unable-to-use-the-prisma-cloud-cspm-api-to-post-the-compliance/m-p/559682#M1053</link>
    <description>&lt;P&gt;Hello, can you try this with &lt;A href="https://pan.dev/prisma-cloud/api/cspm/get-compliance-posture-trend/" target="_self"&gt;GET method&lt;/A&gt;&amp;nbsp;as below in your powershell script.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;curl --location 'https://api2.prismacloud.io/compliance/posture/trend?timeType=relative&amp;amp;timeAmount=1&amp;amp;timeUnit=month' \
--header 'accept: application/json; charset=UTF-8' \
--header 'content-type: application/json' \
--header 'x-redlock-auth: JWT_TOKEN'&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Sep 2023 14:25:05 GMT</pubDate>
    <dc:creator>bpachauli</dc:creator>
    <dc:date>2023-09-27T14:25:05Z</dc:date>
    <item>
      <title>Unable to use the Prisma Cloud CSPM API to POST the Compliance Trend</title>
      <link>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/unable-to-use-the-prisma-cloud-cspm-api-to-post-the-compliance/m-p/559536#M1052</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have been unable to retrieve using the&lt;SPAN&gt;&amp;nbsp;Prisma Cloud CSPM&amp;nbsp;&lt;/SPAN&gt;API the Compliance Posture Trend using the following &lt;A title="POST COMPLIANCE POSTURE TREND" href="https://pan.dev/prisma-cloud/api/cspm/post-compliance-posture-trend/" target="_blank" rel="noopener"&gt;function.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The PowerShell function is as follows, taking into account that the $URI variable is already set to the correct &lt;A href="https://pan.dev/prisma-cloud/api/cspm/api-urls/" target="_self"&gt;URL API&lt;/A&gt;:&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;function Get-PrismaCloudComplianceTrendV2{
    param (
        #String with the JWT token
        [Parameter(
        Mandatory=$true,
        HelpMessage="Introduce a valid token in String format",
        ValueFromPipeline=$true)]
        [String]
        $Token,
        
        [Parameter(
        Mandatory=$true,
        HelpMessage="Introduce a valid token in String format",
        ValueFromPipeline=$true)]
        
        [string]
        $Negocio_N

                
)


$PrismaComplianceTrendV2 = @{
    Uri = "$URI" + "compliance/posture/trend"
    Method= "POST"
    Headers= @{"x-redlock-auth"= $token;"Accept"= "application/json";"charset"="UTF-8";"content-type"="application/json"}
    Body = @{
        "fields" = @("account.group")
        # "filters" = @{
        #     "name"="account.group"
        #     "operator"="="
        #     "value"="$Negocio_N"
        # }
        "timeRange"=@{
            "type"="relative"
            "value"= @{
                "amount" ="1"
                "unit" = "month"
            
            }
            
        }
        }
    | ConvertTo-Json -Depth 3
}
 
try{
Invoke-RestMethod @PrismaComplianceTrendV2 -Verbose
}
catch {
    $_.Exception.Response
    
    
}

}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The response every time, regardless of filter, type of Time Type or TimeRange is a 500 Internal Server Error, as seen here:&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Response       : StatusCode: 500, ReasonPhrase: 'Internal Server Error', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
                 {
                   Date: Tue, 26 Sep 2023 15:37:32 GMT
                   Connection: keep-alive
                   Access-Control-Allow-Origin: *
                   Access-Control-Allow-Headers: x-redlock-request-id,x-redlock-auth,rl-json-rule,terraform-version,terraform-012-parameters,rl-variable-file-names,rl-parameters,Content-Type,x-b3-traceid,x-b3-spanid,sentry-trace
                   Access-Control-Allow-Methods: POST, PUT, GET, OPTIONS, DELETE, PATCH
                   Access-Control-Expose-Headers: x-redlock-auth,x-redlock-request-id,x-redlock-status, x-redlock-fileName,Content-Disposition
                   Access-Control-Max-Age: 60
                   Strict-Transport-Security: max-age=31536000; includeSubDomains
                   X-Content-Type-Options: nosniff
                   X-Frame-Options: DENY
                   X-XSS-Protection: 1; mode=block
                   Content-Security-Policy: default-src 'self'
                   x-redlock-request-id: 9ff33857315145e483c586bed4b377f7
                   Vary: Origin
                   Vary: Access-Control-Request-Method
                   Vary: Access-Control-Request-Headers
                   Vary: x-redlock-auth
                   Referrer-Policy: no-referrer
                   X-Download-Options: noopen
                   X-Permitted-Cross-Domain-Policies: none
                   Content-Length: 0
                 }
StatusCode     : 
TargetSite     : Void ThrowTerminatingError(System.Management.Automation.ErrorRecord)
Message        : Response status code does not indicate success: 500 (Internal Server Error).
Data           : {}
InnerException : 
HelpLink       : 
Source         : System.Management.Automation
HResult        : -2146233088
StackTrace     :    at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)


&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does this function in particular follow a different request body type?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your suggestions.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 15:39:10 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/unable-to-use-the-prisma-cloud-cspm-api-to-post-the-compliance/m-p/559536#M1052</guid>
      <dc:creator>JLlorente</dc:creator>
      <dc:date>2023-09-26T15:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to use the Prisma Cloud CSPM API to POST the Compliance Trend</title>
      <link>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/unable-to-use-the-prisma-cloud-cspm-api-to-post-the-compliance/m-p/559682#M1053</link>
      <description>&lt;P&gt;Hello, can you try this with &lt;A href="https://pan.dev/prisma-cloud/api/cspm/get-compliance-posture-trend/" target="_self"&gt;GET method&lt;/A&gt;&amp;nbsp;as below in your powershell script.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;curl --location 'https://api2.prismacloud.io/compliance/posture/trend?timeType=relative&amp;amp;timeAmount=1&amp;amp;timeUnit=month' \
--header 'accept: application/json; charset=UTF-8' \
--header 'content-type: application/json' \
--header 'x-redlock-auth: JWT_TOKEN'&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 14:25:05 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/unable-to-use-the-prisma-cloud-cspm-api-to-post-the-compliance/m-p/559682#M1053</guid>
      <dc:creator>bpachauli</dc:creator>
      <dc:date>2023-09-27T14:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to use the Prisma Cloud CSPM API to POST the Compliance Trend</title>
      <link>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/unable-to-use-the-prisma-cloud-cspm-api-to-post-the-compliance/m-p/559715#M1054</link>
      <description>&lt;P&gt;Hello Bpauchauli,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, I have already implemented the GET method on a PS function. However, the GET method cannot filter through account group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have an example with the POST method?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 16:10:57 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/unable-to-use-the-prisma-cloud-cspm-api-to-post-the-compliance/m-p/559715#M1054</guid>
      <dc:creator>JLlorente</dc:creator>
      <dc:date>2023-09-27T16:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to use the Prisma Cloud CSPM API to POST the Compliance Trend</title>
      <link>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/unable-to-use-the-prisma-cloud-cspm-api-to-post-the-compliance/m-p/559717#M1055</link>
      <description>&lt;P&gt;Hello, the GET method should filter through the account group (see the API call below), however, if you are not able to get the results, let me know, and I will help you with the POST call.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;curl --location 'https://api2.prismacloud.io/compliance/posture/trend?timeType=relative&amp;amp;timeAmount=1&amp;amp;timeUnit=month&amp;amp;account.group=account-group' \
--header 'accept: application/json; charset=UTF-8' \
--header 'content-type: application/json' \
--header 'x-redlock-auth: JWT_TOKEN'&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="messageEditor_2ac55368717a25_0" class="MessageEditor"&gt;
&lt;DIV class="lia-js-block-events"&gt;
&lt;DIV class="lia-form-row lia-form-body-entry"&gt;
&lt;DIV class="lia-quilt-row lia-quilt-row-standard"&gt;
&lt;DIV class="lia-quilt-column lia-quilt-column-24 lia-quilt-column-single"&gt;
&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-single"&gt;
&lt;DIV class="lia-form-input-wrapper"&gt;
&lt;DIV id="rich_2ac55368717a25_2d7c4" class="message-body-editor lia-inline-message-body-editor"&gt;
&lt;DIV id="mceu_143" class="mce-tinymce mce-container mce-panel lia-editor-gte-2" tabindex="-1" role="application"&gt;
&lt;DIV id="mceu_143-body" class="mce-container-body mce-stack-layout"&gt;
&lt;DIV id="mceu_144" class="mce-top-part mce-container mce-stack-layout-item mce-first"&gt;
&lt;DIV id="mceu_144-body" class="mce-container-body"&gt;
&lt;DIV id="mceu_145" class="mce-toolbar-grp mce-container mce-panel mce-first mce-last" tabindex="-1" role="group"&gt;
&lt;DIV id="mceu_145-body" class="mce-container-body mce-stack-layout"&gt;
&lt;DIV id="mceu_146" class="mce-container mce-toolbar mce-stack-layout-item mce-first" role="toolbar"&gt;
&lt;DIV id="mceu_146-body" class="mce-container-body mce-flow-layout"&gt;
&lt;DIV id="mceu_147" class="mce-container mce-flow-layout-item mce-first mce-last mce-btn-group" role="group"&gt;
&lt;DIV id="mceu_147-body"&gt;
&lt;DIV id="mceu_104" class="mce-widget mce-btn mce-btn-small mce-first" tabindex="-1" role="button" aria-label="Undo" aria-disabled="false"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="mceu_105" class="mce-widget mce-btn mce-btn-small lia-mce-toolbar-bold" tabindex="-1" role="button" aria-pressed="false" aria-label="Bold"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 27 Sep 2023 16:26:05 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/unable-to-use-the-prisma-cloud-cspm-api-to-post-the-compliance/m-p/559717#M1055</guid>
      <dc:creator>bpachauli</dc:creator>
      <dc:date>2023-09-27T16:26:05Z</dc:date>
    </item>
  </channel>
</rss>

