API Help: Unable to parse JSON

API Help: Unable to parse JSON

Hi, I'm trying to get comfortable adding assets to ME through API with the intention to build a tool in Powershell that my colleagues can use to quickly add assets too. We use the web browser to add these usually.

I was trying out the Self-Client set up and I am able to generate the authorization code I need and I can generate my refresh token however when trying to send a POST request to add an asset I get the error:

`Invoke-RestMethod : 
{"response_status":{"status_code":4000,"messages":[{"status_code":4001,"field":"input_data","type":"failed","message":"Unable to parse JSON for 
: input_data"}],"status":"failed"}}`



My JSON has been put through multiple parsers to ensure it is readable so I'm unsure what the issue is. I've also tried XML but it produces the same error.

Code: 

`#Powershell version - 5.1

$url = "https://<URL>.sdpondemand.manageengine.com/api/v3/workstations"
$headers = @{ "Accept" = "application/vnd.manageengine.sdp.v3+json"
    "Authorization" = "Zoho-oauthtoken 1000.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    "Content-Type" = "application/x-www-form-urlencoded"}
$input_data = @'
{
  {
    "workstation":{
        "vm_type":"0",
        "site":{"id":"14581000038091259"},
        "udf_fields":{
            "udf_boolean2":false,
            "udf_boolean1":false
            },
        "state":{"id":"14581000000006135"},
        "name":"TEST1_self",
        "computer_system":{
         "service_tag":"TEST1_self",
         "system_manufacturer":"HP",
         "model":"ProBook 440 G9"
        },
      "product":{"id":"14581000036367007"},
      "memory":{"physical_memory":17179869184},
      "asset_tag":"TEST1",
      "serial_number":"TEST1",
      "vendor":{"id":"14581000010580765"},
      "purchase_cost":809,
      "acquisition_date":{"value":1716850800000},
      "workstation_udf_fields":{"udf_char1":"LAPTOP"},
      "processors":[],
      "network_adapters":[],
      "hard_disks":[],
      "monitors":[]
    }
  }
}'
'@
$data = @{ 'input_data' = $input_data}
$response = Invoke-RestMethod -Uri $url -Method post -Body $data -Headers $headers
$response

`

Any help would be appreciated, please explain like I am 5 years old!

Thanks

                New to ADSelfService Plus?