I did more than 10 ways to put the incident connected with the component but no one works correctly .
Structured array:
$array = array();
foreach ($components as $component)
{
$array[$component['id']] = $components_status;
}
$postparams = array();
$postparams["incident[components]"] = json_encode($array);
foreach ($components as $component)
{
$cid = $component['id'];
$postparams["incident[components][$cid]"] = $components_status;
}
My output is similar to the API documentation but not work
Array
(
[incident[component_ids]] => [".....3j0qxc",".....38ds4m",".....h59d9"]
[incident[components]] => {".....j0qxc":"partial_outage",",,,,,,8ds4m":"partial_outage",".....7h59d9":"partial_outage"}
)
The incident always is created with no component associated, and I need make this relationship under statuspage.
I shared the function of my class here :
https://pastebin.com/TmyZHZbJ
Any idea?