How to list all inventory assets via Prisma Cloud API

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

How to list all inventory assets via Prisma Cloud API

L0 Member

Hi, 

Was looking for some guidance in using the Prisma Cloud API to retrieve information. I am wanting to list all inventory assets (and hopefully their detail) via the API. Basically similar to information that can viewed via the portal e.g. listing all assets in the explorer for say Resource Type=EC2 Instance....

 

asset explorer.png

...I can see the total number of assets using the /v2/Inventory endpoint...

ec2 instance.png

 

...but would like to retrieve all the assets/details of those 15408 resources. I can see /uai/v1/asset call but that requires an asset ID to passed. Is there a way to list all assets based on a filter and return detailed information about them via the API?

 

Thanks

3 REPLIES 3

L1 Bithead

Hello,

Please refer the following link https://github.com/PaloAltoNetworks/prismacloud-api-python/tree/main/prismacloud/api/cspm

Sugathri Tumiki, Prisma Cloud Customer Success Engineer (PCCSE)

L1 Bithead

Hi, 

 

Following up on Asset Inventory API, please let us know if any questions. Complete resource inventory from Prisma Cloud can be pulled using the below API https://github.com/PaloAltoNetworks/prismacloud-api-python/blob/feature/add-asset-inventory-v2/scrip...pcs_resources_export.py. Output will be full inventory of the assets and related metadata. Ref: s3 inventory attached

L2 Linker

Hello Flipcode,

 

You can also use the following endpoint to get the list of resources similar to what you have in your screenshot

 

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

 

You can use the example payload as below ;

{"filters":[
{"name":"cloud.service","operator":"=","value":"Amazon EC2"},
{"name":"cloud.type","operator":"=","value":"aws"},
{"name":"resource.type","operator":"=","value":"EC2 Instance"},
{"name":"scan.status","operator":"=","value":"all"}],
"limit":100,
"timeRange": {
"type": "to_now",
"value": "login"
}
}
 
Please replace the Time range section of the Payload with the appropriate one that fit your search criteria. refer to the below for details ;
 
  • 3450 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!