- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2019 03:44 AM
We are using Rest API via PowerShell (Invoke-RestMethod),
In order to insert records in the event [em_event] table with a single call, using the web service API.
We successfully inserting events to the em_event table,
But the only problem is with the additional_info field.
For some reason,
The JSON structure of my PowerShell script,
Is causing the output of additional_info, to return as an Object and Not as JSON string.
And as a result,
Not showing the values in additional_info properly, but instead as [object Object]:
This is the JSON structure in my PowerShell script:
# Specify request body
$body = @"
{ "records":
[
{
"source":"MyClass",
"event_class":"$AtargetResourceType",
"resource":"$AtargetResourceType",
"node":"$AtargetResourceName",
"metric_name":"$Aname",
"type":"$AsignalType",
"severity":"$Aseverity",
"message_key":"$Aid",
"u_mc_object":"$AtargetResource",
"description":"$Adescription",
"additional_info":"{
'u_mc_object_class':'$AsourceCreatedId',
'u_mc_parameter':'$AmetricName',
'u_mc_parameter_value':'$AmetricValue'
}"
}
]
}
"@
Solved! Go to Solution.
- Labels:
-
Event Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2019 02:35 AM
Turns out,
My Structure was effecting the only the additional_info section in my JSON.
Fixed,
Currently working as it should be:
Thanks for the help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2019 07:38 AM
I thought you had to escape the embedded double-quotes?
Do you have some way you can check the result of the conversion to JSON? Maybe print out the $bodyJson, or, even better, send it to somewhere else that can record the JSON that is received.
Wait - I just noticed something. You have double quotes around the braces after additional_info; is that keeping the data from additional_info from being converted to the appropriate object type before it is converted to JSON?
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2019 10:47 PM
Still Same Problem,
This is my payload:
{
"additional_content" : "[object Object]"
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2019 04:39 AM
I know someone who did a powershell script to push events I'll see if I can get a copy of it and show you how he did the json for additional_info. Gimmie the morning and I'll see if I can get a hold of the person.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2019 07:51 AM
Can you try removing quotes for additional info
"additional_info":{
"u_mc_object_class":"$AsourceCreatedId",
"u_mc_parameter":"$AmetricName",
"u_mc_parameter_value":"$AmetricValue"
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2019 10:46 PM
Still same problem,
This is my payload:
{
"additional_content" : "[object Object]"
}