Trying to update custom attribute fields on a ticket

Hi all,

I am trying to update a custom attribute that is on a ticket, although I cannot seem to get anything to populate there. I am able to update other fields such as the title with no issues. The way the code is right now it runs with no issues, but the attribute field never updates. This is written in powershell, I also ommitted the code to grab the jwt,, and the endpoint

 

 

$headers = @{
    'Content-Type' ='application/json'
    Authorization = "Bearer $jwt"
}


$attributeInfo = @{
    ID = 134674
    Value =' 87'
}

$Attribute = (ConvertTo-Json $attributeInfo)

$update = @{
    RequestorUid = 'ommited'
    ResponsibleUid = 'ommited'
    AccountID = 103117
    PriorityID = 6260
    StatusID = 128627
    TypeID = 39643
    FormID = 58191
    Title = 'Ticket Title Ommited'
    Attributes = $Attribute

}

$Body = (ConvertTo-Json $update)


$Params = @{
    Method = 'Post'
    Uri = $APIRequest
    Headers = $headers
    Body = $Body
}
Invoke-RestMethod @Params | ConvertTo-Json

Tags API custom-attributes
Asked by Brandon Ferrotta on Tue 2/14/23 1:01 PM
Sign In to leave feedback or contribute an answer

Answer (1)

This answer has been marked as the accepted answer
Mark Sayers Tue 2/14/23 1:23 PM

Hello Brandon,

I'm not sure if your code is specifying it or not, but the Attributes property is expecting an *array* of attribute objects to be passed to it. I *think*, though I'm not a PowerShell expert, you're just providing a single attribute object but not within an array for that property.

Sincerely,

Mark Sayers

Sr Support Consultant, CS

No feedback
Hi Mark,
Thank you for your insight, I am learning powershell at the same time I am working on learning the API so no expert hear either haha, I will take a look into this!

I appreciate your time,
Brandon
- Brandon Ferrotta Tue 2/14/23 2:16 PM