HTTP 400 error on API call https://api2.eu.prismacloud.io/search/history/xxxxxxxx

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

HTTP 400 error on API call https://api2.eu.prismacloud.io/search/history/xxxxxxxx

L0 Member

Hi,

 

I'm trying to inject custom policies using API call , however before doing that i need to create "Saved search" , that is later used as described in https://api.docs.prismacloud.io/reference#add-policy

 

So i tried simple curl-based call to create (actually update an existing saved search as advised in prisma API doc) 

 

curl -v --request POST --url https://api2.eu.prismacloud.io/search/history/a8a69686-65e4-46fb-a43d-b07c48163xxx

--header 'accept: application/json; charset=UTF-8'

--header 'content-type: application/json'

--header 'x-redlock-auth: my_JWT_goes_here'

--data '{"cloudType":"AWS","saved":false,"query":"config where api.name ='\''aws-ec2-describe-security-groups'\'' and cloud.account = \"Sample AWS Account\""}'

 

But i get :

< HTTP/2 400

<--removed-->
< x-redlock-status: [{"i18nKey":"bad_request","severity":"error","subject":null}]
< server: Jetty(9.4.24.v20191120)

 

In Prisma cloud web console audit logs i see:

"'xxx.xxx@xxx.com'(with role 'System Admin':'System Admin') failed to save the search."

 

I guess im missing some mandatory parameters in my query. Anyone got an idea whats wrong with this query? 

2 REPLIES 2

L0 Member

Ok i moved one step further. Now i get HTTP 500 🙂

 

It looks that i was missing mandatory "name" parameter (this sounds reasonable to have config Query name as a required parameter). 

LChelek_0-1584705564155.png

 

Unfortunately API docs , do not mention anything about that this field is mandatory.

 

 

So now i get HTTP 500 error (internal server error)

 

'x-redlock-status': '[{"i18nKey":"internal_error","severity":"error","subject":null}]'

 

I invoke POST against URL (where suffix of the url ismy successfuly invoked search Query id):

https://api2.eu.prismacloud.io/search/history/3ae5e3e7-532c-4c69-b858-xxxxxxxxxx

 

My HTTP request body  :

 

{"cloudType":"aws","searchType":"config","description":"","saved":true,"query":"config where api.name = 'aws-ec2-describe-subnets'","name":"MySavedQueryName-1"}

 

My HTTP headers:

 

{'accept'"application/json; charset=UTF-8",
               'x-redlock-auth': HERE_MY_JWT,
                'content-type''application/json',
                'User-Agent''Python3.7 script'
               }
 
What im missing here?
 

L4 Transporter

Greetings LChelek,

 

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.

 

Kind Regards,

J. Avery King

J. Avery King | Prisma Cloud | Customer Success Engineer
  • 4835 Views
  • 2 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!