Rest API output

Hi, can i get Rest API output in Json or any other format instead of XML while using get ?

You can with certain resources. Check out IBM BigFix 9.1 REST API Serve in JSON? for more information.

1 Like

Hi @Aram,

I am running the below command and getting output in xml?

c:\curl>curl -k --insecure --user admin:admin --data-urlencode "relevance=(name of bes computers)" https://server1:52311/api/query?output=json 

<?xml version="1.0" encoding="UTF-8"?>
<BESAPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BESAPI.xsd">
	<Query Resource="(name of bes computers)">
		<Result>
			<Answer type="string">WIN1</Answer>
		</Result>
		<Error>Singular expression refers to non-unique object.</Error>
	</Query>
</BESAPI>

am i running the correct syntax?

1 Like

@mail2vij try passing ouput=json to –data-urlencode as well. Like this:

c:\ curl --insecure --user admin:admin --data-urlencode "output=json" --data-urlencode "relevance=(names of bes computers)" https://server1:52311/api/query

3 Likes

awesome , it works this time…

thanks for your great help

1 Like