Pretty much what the title says. I’ve managed to do some pretty cool stuff with the API and PowerShell scripts running on a schedule. Unfortunately, this isn’t something I’ve been able to do.
If someone could provide an example of a JSON File containing the body on how an asset is added, that would be great. So far, this is what I have:
$APIKey = 'MyApiKey'
$EncodedCredentials = iConvert]::ToBase64String(SText.Encoding]::ASCII.GetBytes(('{0}:{1}' -f $APIKey, $null)))
$Header = @{}
$Header.Add('Authorization', ('Basic {0}' -f $EncodedCredentials))
$parameters = @{
assets = @{
display_id = "8232"
}
}
$Parameters = ConvertTo-Json $parameters
invoke-RestMethod -URI 'https://MyDomain.freshservice.com/api/v2/tickets/147710' -Headers $Header -ContentType "application/json" -Method PUT -Body $Parameters
For clarity, that would make the JSON contents:
{
"assets": {
"display_id": "8232"
}
}
I probably am missing something but just wanted to see if anyone has any ideas?