I am currently working on a PowerShell script that we’ll be using to process assets in FreshService. Two of the fields I’d like to update in particular are the asset_state and last_audit_date fields.
I did pull the appropriate ID for the asset_type and saw that these are two fields that are included in the Update Assets API call example.
$parameters = @{
asset = @{
name = "Super Test Laptop2"
description = "Test Description 1"
user_id = $null
location_id = $In_IT_Cabinet
assigned_on = "$today_date"
updated_at = "$today_date"
type_fields = @{
asset_state_11000923165 = "In Stock"
last_audit_date_11000923165 = "$today_date"
}
}
}
invoke-RestMethod -URI "https://novinium.freshservice.com/api/v2/assets/$display_id" -Headers $Header -ContentType "application/json" -Method Put -Body (ConvertTo-Json $parameters)
When I pass in my request using the type_fields array I am getting a 400 bad request return. If I remove the type_fields array it works just fine.
Any help on this would be greatly appreciated!