Hi guys,
i coming back to my "problem" months ago.
Currently i want to start a workflow from outside Automic passing some Prompset variables to the RestMethod.
my script:
$user = "XX"
$pass= "XX"
$uri = "http://vXXXX:8088/ae/api/v1/1***/executions"
$Headers = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($user):$($pass)"))};
$json =
@{
object_name ="JOBS.XX.XX"
"ENVIRONMENT#" ="PRD"
"EXEC_LOGLEVEL#" ="DEBUG"
} | ConvertTo-Json
Invoke-RestMethod -Uri $uri -Headers $headers -ContentType "application/json" -Method Post -Body $json
Error message:
Invoke-RestMethod : {
"code" : 45106,
"error" : "The request is invalid and cannot be processed by the Automation Engine.",
"details" : "Unrecognized field \"EXEC_LOGLEVEL#\" (class com.automic.rest.executions.executeobject.InExecutionParameters), not marked as ignorable (3 known
properties: \"inputs\", \"object_name\", \"execution_option\"])\n at [Source: org.eclipse.jetty.server.HttpInput@76ee87ea; line: 2, column: 25] (through reference
chain: com.automic.rest.executions.executeobject.InExecutionParameters[\"EXEC_LOGLEVEL#\"])"
}
At line:21 char:1
+ Invoke-RestMethod -Uri $uri -Headers $headers -ContentType "applicati ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
I want to start JOBS "JOBS.XX.XX with promptset varialbes ENVIRONMENT#=PRD and EXEC_LOGLEVEL#=DEBUG
When i do it in Postman its working fine. Postman syntax:
{
"object_name": "JOBS.XX.XX",
"inputs":
{
"ENVIRONMENT#":"PRD",
"EXEC_LOGLEVEL#":"DEBUG"
}
}
Anyone here who solved this using powershell Invoke-RestMethod ?
Thanks in advance.
Regards,
Ben