Step 5: Display the results

ARTIFACTORY: How to Run AQL Commands in Windows Using PowerShell

AuthorFullName__c
Yonatan Hen
articleNumber
000005774
ft:sourceType
Salesforce
FirstPublishedDate
2023-06-08T15:48:02Z
lastModifiedDate
2023-06-08
VersionNumber
1
To present the results in a readable format, you can use the Format-List cmdlet. This will provide a detailed view of the output.

$result | Format-List *

Here is an example output from the AQL query that finds items created or modified in the last day:
results : {@{repo=tst-gems-remote-cache; path=.; name=specs.4.8.gz; type=file; size=5018252; created=2023-05-30T14:30:44.584Z;
created_by=_system_; modified=2023-06-07T08:21:30.062Z; modified_by=_system_; updated=2023-06-07T08:21:30.290Z},
          @{repo=tst-gems-remote-cache; path=.; name=latest_specs.4.8.gz; type=file; size=1494120; created=2023-05-30T14:30:44.630Z;
created_by=_system_; modified=2023-06-07T08:21:30.318Z; modified_by=_system_; updated=2023-06-07T08:21:30.381Z},

The full command input is as follows:
$username = "<username>"
$password = "<password>"
$platformUrl = "http://<url>/artifactory/api/search/aql"

$base64Auth = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("${username}:${password}"))
$headers = @{
    "Authorization" = "Basic $base64Auth"
    "Content-Type" = "text/plain"
}

$data = @'
<AQL query>
'@

$result = Invoke-RestMethod -Uri $platformUrl -Method POST -Headers $headers -Body $data
$result | Format-List *

For more information, refer to the AQL documentation.