Hi there,
I am trying to build a little powershell script just to pull out some information from Assets.
Below is part of the code I am using to try and build out the GET but I keep getting an error that is show below. If I remove the $encodedQuery after the qlQuery= the whole thing works fine but I get EVERYTHING.
$objectSchema = "IT Assets"
$objectType = "IT Hardware"
# Remove the space before URL-encoding the query string
$encodedQuery = [System.Web.HttpUtility]::UrlEncode("objectSchema='$objectSchema' AND objectType='$objectType'")
$assetUrl = "https://api.atlassian.com/jsm/assets/workspace/$jira_workspace_id/v1/aql/objects?qlQuery=($encodedQuery)"
$response = Invoke-RestMethod -Uri $assetUrl -Headers $JiraHeaders -Method GET
Invoke-RestMethod : {"errorMessages":["AQL \"(objectSchema='IT Assets')\" has invalid syntax at position 18 with error message \"no viable alternative at input '(objectSchema='IT A'\""],"errors":{}}
At line:27 char:13
+ $response = Invoke-RestMethod -Uri $assetUrl -Headers $JiraHeaders -M ...
Next challenge will be just exporting the name and display value to CSV but I can't get past this query issue first.