Active IQ Unified Manager Discussions
Active IQ Unified Manager Discussions
I'm looking to get a WFA instance to respond via JSON when making REST-based calls to it. Right now when I query "https://server-name/rest/workflows" or any other REST-based URLs, I get back an XML response. The WFA REST primer shows that it supports JSON, but I'm unsure how to get it to talk this way. Do I need to configure or enable something? Appreciate the help.
Solved! See The Solution
Support for JSON was added in WFA v4.1.
$output
= Invoke
-RestMethod
-Method
Post
-Uri
$workflow_execution_uri
-Credential
$credentials
-Body
$jsonInput
-ContentType
"application/json"
You should "post", not "get".
And pass along a body too with the input
I have did below as i wanted to get filter output
----
For a filter, the method applicable is GET itself.
If you want JSON response for method GET you need to send this information in Request Header. Content type in GET are ignored. See my post in the previous responses to this very thread.
You need to add the following key-value pair in your GET Request header.
'Accept'='application/json'
In powershell, do this
$output = Invoke-RestMethod -Method get -Uri $workflow_execution_uri -Credential $cred -Headers @{"Accept"="application/json"}
sinhaa
$output = Invoke-RestMethod -Method get -Uri $workflow_execution_uri -Credential $cred -Headers @{"Accept"="application/json"}
here is the error i am getting
invoke-RestMethod : The 'Accept' header must be modified using the appropriate property or method
This error is not related to WFA. Its being thrown by powershell. Some searching on the internet suggests you would need to upgrade your Powershell client ( which is calling the Invoke-RestMethod).
The latest version is 5.1. Try that
sinhaa
yes for powershell version 5.1 it worked