Prisma Cloud: How to list assets and pull data via API

Prisma Cloud: How to list assets and pull data via API

6668
Created On 05/04/23 21:53 PM - Last Modified 02/21/24 17:06 PM


Objective


How we can pull the data for asset filters/parameters via API.

Environment


  • Prisma Cloud
  • API
  • Asset Inventory 


Procedure


  • Please have the Prisma Cloud Postman collection set up to complete the following API call. 
  • Below is API call for resource/scan_info as it will assist to get the desired
  • Also, for this a parameter has dependency --> limit number: Maximum number of items to return. When data is paginated, maximum number of items per page.The maximum cannot exceed 10,000. The default is 10,000.
curl -L -X POST 'https://api.prismacloud.io/resource/scan_info' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-redlock-auth: <API_KEY_VALUE>' \
--data-raw '{
  "detailed": true,
  "fields": [
    "string"
  ],
  "filters": [
    {
      "name": "string",
      "operator": "=",
      "value": "string"
    }
  ],
  "groupBy": [
    "string"
  ],
  "limit": 0,
  "offset": 0,
  "pageToken": "string",
  "sortBy": [
    "string"
  ],
  "timeRange": {
    "relativeTimeType": "BACKWARD",
    "type": "relative",
    "value": {
      "amount": 0,
      "unit": "minute"
    }
  }
}'

Pagination [what it is and how we can utilize]

  • You can limit the number of items in a response list from API resources that support pagination.
  • The API requests to list asset inventory, that supports pagination will accept the following request parameters.
Request ParameterDescription
limitMaximum number of items to return per page. Without pagination, maximum number of items to return in a response.
offsetNumber of items to skip before selecting items to return. Default is zero.
pageTokenSet to the nextPageToken value from the previous response object to return the next page of data.


Additional Information


Prisma Cloud Asset Inventory API Overview.   

Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA14u000000g1guCAA&lang=en_US&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail