REST API v3: How to edit an asset?

REST API v3: How to edit an asset?

I need help forming my JSON for this. The reply message that I get back is simply "Internal Error" without any other identifying output to help track down the issue. I can update Location by itself just fine, but I cannot update the State with the current JSON parameters.

  1. $id = "111111"
  2. $input = @"
  3. {
  4.     "asset": {
  5.         "state": {
  6.             "name": "In Store",
  7.             "id": "1"
  8.         },
  9.         "location": "Test Location"
  10.     }
  11. }
  12. "@

  13. $header = @{TECHNICIAN_KEY=$ApiKey} 
  14. $params = @{input_data=$input;format='json'}
  15. $Uri = $SdpUri + "/api/v3/assets/$id"
  16. $result = Invoke-RestMethod -Method PUT -Uri $Uri -Headers $header -Body $params -ContentType "application/x-www-form-urlencoded" 

                New to ADManager Plus?

                  New to ADSelfService Plus?