HPE Morpheus Enterprise
1827961 Members
2634 Online
109973 Solutions
New Discussion

How to use workflow API

 
Not applicable

How to use workflow API

I have a workflow that runs on servers. I want to call the workflow using API.
If I run just the retrieve information (via PowerShell):
Invoke-WebRequest -URI “$serverUrl/api/task-sets” -Method GET -Headers @{“Authorization”= “Bearer $accessToken”} I get 200
but now I want to execute the workflow.
I tried
Invoke-WebRequest -URI “$serverUrl/api/servers/27708/workflow?workflowId=108” -Method PUT -Headers @{“Authorization”= “Bearer $accessToken”}
and
Invoke-WebRequest -URI “$serverUrl/api/instances/27708/workflow?workflowId=108” -Method PUT -Headers @{“Authorization”= “Bearer $accessToken”}
and in both cases I get the same error
Invoke-WebRequest : The remote server returned an error: (404) Not Found.

Can someone know why?

2 REPLIES 2
cbunge
HPE Pro

Re: How to use workflow API

Make sure you are defining the payload of which phase to run per the apidocs here.

This for example, works for me. (Note: Operational Workflows are a provisioning phase)

0c18fa03f019beb438eeedf3cd578637d13b812c.png

Not applicable

Re: How to use workflow API

I added the taskPhase and customOptions, the error is the same.