Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Having trouble updating insight from a script

Hi all,

I am getting a weird error when updating insight from Azure AD, even though the records are being updated I am getting an error.  This error is impacting when I find a matching record also (based on a name).

Here is the error

Invoke-RestMethod : {"errorMessages":["IQL \"Name = Lee Gu\" has invalid syntax at position 11 with error message \"mismatched input 'G' expecting {, ' 
At C:\Users\Steven-Admin\Desktop\AddToInsight.ps1:138 char:15
+ ... $result = Invoke-RestMethod -Method Post -Headers $headers -Uri $ur ...


Here is what is getting logged

[2022-09-15 15:44:08] Name = Lee Gu
[2022-09-15 15:44:08] {
"objectSchemaId": 5,
"objectTypeId": 24,
"resultsPerPage": 1,
"iql": "Name = Lee Gu"


Here is what I see when I check the data variable

PS C:\Windows\system32> $data

AD_Name AD_Country
------- ----------
@{name=Name; id=99; value=Lee Gu} @{name=Country; id=448; value=United States}


I am assuming this part if what is wrong, but not sure how to fix it

"Name = Lee Gu"


I am building the IQL like this


$key = $data.AD_Name

$iql = $ + ' = ' + $key.value

$url = "$workspaceId/v1/object/navlist/iql"

$headers = @{
'Authorization' = "Basic $token"
'Content-Type' = 'application/json'
'Accept' = 'application/json'

$resultsPerPage = 1

$body = [PSCustomObject]@{
objectSchemaId = $objectSchemaId
objectTypeId = $objectTypeId
resultsPerPage = $resultsPerPage
iql = $iql
} | ConvertTo-Json

$result = Invoke-RestMethod -Method Post -Headers $headers -Uri $url -Body $body


Not sure how to fix this

1 answer

1 accepted

3 votes
Answer accepted

Azure AD has a unique ID field.. no spaces, so no problem.  Insight is getting new users created from Azure and updating information for existing users.

Suggest an answer

Log in or Sign up to answer
Site Admin

Atlassian Community Events