Resource Scan Info POST Fields filtering

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

Resource Scan Info POST Fields filtering

L0 Member

Hello,

 

I'm trying to use this endpoint:

https://pan.dev/prisma-cloud/api/cspm/post-resource-scan-info/

WIth this payload:

{
"limit": 2,
"timeRange": {"type": "to_now"},
"fields": ["id","name","accountId","accountName","regionId","resourceDetailsAvailable","resourceConfigJsonAvailable"]
}
 
But the results that we get contains all the fields, it seems that is not applying the 'fields' filter.
 
Is that an API bug or a documentation mistake and 'fields' doesn't apply for this endpoint?
 
Thanks in advanced

 

3 REPLIES 3

L2 Linker

Hello Fran.Paris,

 

Yes, this is to be expected.
The filters used on the body are used to filter a specific resource. It seems as the response does not follow the fields and will give you information about the resource.

 

You can also test this by using Developer tools and seeing the response and call to match the payload.

L2 Linker

Hello Fran.Paris

 

If you want to filter your results, use the "filters" field as it is in the payload example below.

 

{"filters":[
{"name":"cloud.service","operator":"=","value":"Google Kubernetes Engine"},
{"name":"cloud.type","operator":"=","value":"gcp"},
{"name":"resource.type","operator":"=","value":"Google Kubernetes Engine Container Cluster"},
{"name":"scan.status","operator":"=","value":"all"}
],
"limit":100,
"timeRange": {
"type": "to_now",
"value": "login"
}
}

Hello OOmotayo,

 

Thanks for your answer.

 

I'm trying to use both filters: 

 

- fields string[]
Array of specific fields to return

- filters object[]
Filtering parameters.

For filter names, refer to List Filters API.

For filter values, refer to List filter suggestions.

The only exception is resource.tagv2 filter name, provide filter value for it in the following format: "{"key":"'CustomerTagKey'","value":"'CustomerTagValue'"}"

 

filters is working as expected and I can get only the resources that I want. But, I want to limit the fields for each resource that I want to get, fields filters is not working

  • 1232 Views
  • 3 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!