Prisma Cloud Compute API filtering

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

Prisma Cloud Compute API filtering

L0 Member

Hello,

 

I'm using the Compute/Twistlock API to query image statuses, but I'd like to filter the fields returned to reduce the size of the payload, which contains many things I don't care about for now. I looked at https://cdn.twistlock.com/docs/api/twistlock_api.html#images_get and it mentions a fields query parameter which sounds perfect for my needs, but I haven't been able to find which value has an effect. Passing ?compact=true does work, but it removes things that I need.

 

Any idea?

 

Thanks.

5 REPLIES 5

L1 Bithead

Hi,

Here are the list values that you can pass in this API call:

Query Parameters

  • compact: (boolean)

    Compact indicates that only minimum image data should be sent (vulnerabilities, compliance and extended image metadata should be skipped)

  • fields: (string)

    Fields is used to fetch specific image fields

  • filterBaseImage: (boolean)

    FilterBaseImageVulns filters base image vulnerabilities. Requires an existing scan of the base image

  • hostname: (string)

    Hosts is the host filter

  • id: (string)

    IDs is the image id filter

  • layers: (boolean)

    IncludeImageLayers adds image CVEs to image layers

  • name: (string)

    Names is a list of full image names to query by

  • registry: (string)

    Registries is the image registries filter

  • repository: (string)

    Repositories is the image repositories filter

  • trustStatuses: (string)

    TrustStatuses is the trust statuses filter

L0 Member

Any idea how do you pass a list of fields to the query parameters. 

Hi please the following page for example on how you can pass a list of fields to the query parameters:
https://github.com/twistlock/sample-code/tree/master/computeAPI

 

L0 Member

I'd think it would help if we could know the expected format. 

E.G. on line 5 we can see the setup for search

https://github.com/twistlock/sample-code/blob/master/computeAPI/scans/getRegistryScan#L5

 

but what we do not have is any help for the other fields.

E.G.

from
string <date-time>

Filters results by start datetime. Based on scan time.

?from=2021-09-01T04:00:00.000Z

to
string <date-time>

Filters results by end datetime. Based on scan time.

&to=2034-05-11T04:00:00.000Z

sort
string

Key on which to sort.

&sort=entityInfo.scanTime

type
Array of strings (string)

Scan type.

&type=ciImage

 

But the fields option fails to work in testing with expected values from the json payload.  

fields
Array of strings (string)

List of fields to retrieve.

what are valid options?

L0 Member

https://github.com/PaloAltoNetworks/prisma.pan.dev/issues/150 Trying to get us some more info... try the LIVE community the nice voice on hold said.....

  • 6204 Views
  • 5 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!