- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
04-07-2020 12:04 AM - last edited on 09-02-2020 10:58 AM by CHopson
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.
04-24-2020 08:27 AM
Hi,
Here are the list values that you can pass in this API call:
Query Parameters
Compact indicates that only minimum image data should be sent (vulnerabilities, compliance and extended image metadata should be skipped)
Fields is used to fetch specific image fields
FilterBaseImageVulns filters base image vulnerabilities. Requires an existing scan of the base image
Hosts is the host filter
IDs is the image id filter
IncludeImageLayers adds image CVEs to image layers
Names is a list of full image names to query by
Registries is the image registries filter
Repositories is the image repositories filter
TrustStatuses is the trust statuses filter
07-28-2021 09:07 AM
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
09-21-2021 01:22 PM
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?
10-06-2021 11:26 AM
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.....
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!