Forum Discussion
3 minutes ago, Mike Moniz said:The multipart boundary stuff is more related to sending large amount of data like XML file contents while most API calls including widget updates just need to pass direct JSON content. You might want to look at the examples at https://www.logicmonitor.com/support/rest-api-developers-guide/v1/rest-api-v1-examples/#Example-PowerShell-GET which uses JSON content.
I also think that JSON always starts and ends with "{" or "}" so you might need to add that to your $data string. Also since you are using PowerShell, you can use ConvertTo-JSON to convert PSObjects to JSON if that makes it easier to build and modify.
Hi Mike,
Thanks for the response. My inhouse json guru advised me of the braces before and after my data. Was half way through adding an update when you responded.
The Content-Type was wrong, so you also depicted, so changing this to application/json fixed that error also.
I was also missing specific dashboard/widget information at the start of my json data ("type":"deviceNOC","dashboardId":"##","name":"##").
Ran into an issue now where updating the widget actually requires me to post the actual widget config each time instead of being able to just add a NOC item.
Related Content
- 7 months ago
- 10 months ago
- 2 years ago