Hello,
I have a template that needs to be run against Windows hosts that make use the callback URL to initiate the job against them.
This works for that purpose:
Invoke-WebRequest -Method POST -Body @{host_config_key=‘<auth_key>’}
However, I also need to pass extra_vars as a part of the callback. I’ve tried this several ways and I can’t seem to get it right (I assume it’s some kind of syntax or forwarding thing.).
I don’t know if some of the syntax rules outline in the documentation (i.e. escaping spaces) apply to PowerShell or not, but I tried them anyway to no success. Here’s an example of what I’m trying:
$extra_vars = ‘{"instance_id" : "12345"}’
$body = @{}
$body.Add(‘host_config_key’, ‘54321’)
$body.Add(‘extra_vars’, $extra_vars)
$response = Invoke-WebRequest -Method POST -Body $body
This will still launch the template, but when I reference the instance_id var it isn’t defined.
Any help would be greatly appreciated.