Hi I am trying to import assets into Insight using there API.
I have worked out how to view objects but I'm a little lost on how to add new objects.
I can't work out how to attach the JSON to invoke-restMethod.
I have my sample input JSON like this.
$InputJSON = @"
{
"objectTypeId": $6,
"attributes": [{
"objectTypeAttributeId": 22,
"objectAttributeValues": [{
"Default": "$room_name"
}],
"attributes": [{
"objectTypeAttributeId": 46,
"objectAttributeValues": [{
"Default": "$calendar_name"
}]
}]
}
And I'm trying to add it to this call.
$InsightURL = "https://insight-api.riada.io/rest/insight/1.0/object/create"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
$Headers = {
Authorization = "Bearer e6292...597f"
'Content-Type' = 'application/json'
}
$r = Invoke-RestMethod -Uri $InsightURL -Headers $headers -Method POST
Is it supposed to go in the headers? Is there a particular way to attach it?
Any help would be awesome or if anyone has a script example that they could show me that would be even better!
I'm using cloud version if that matters.