NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform. You will still be able to view content, but posting and replying will be temporarily disabled.
We're excited to launch our new Community experience on July 30 and more information will follow soon.
Stay connected during the transition - Join our Discord community today.

Active IQ Unified Manager Discussions

WFA - Enabling JSON Responses

lil_baby_james
29,786 Views

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.

1 ACCEPTED SOLUTION

yaron
29,281 Views

Support for JSON was added in WFA v4.1.

View solution in original post

26 REPLIES 26

mirko
5,811 Views

$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

sinhaa
5,767 Views

@CAPATEL_NET1984

 

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

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

CAPATEL_NET1984
5,747 Views
$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

 

 

 

 

 

sinhaa
5,727 Views

@CAPATEL_NET1984

 

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

 

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

CAPATEL_NET1984
5,708 Views

yes for powershell version 5.1 it worked

Public