What is the method to get Spectrum REST call returned in JSON format?
search cancel

What is the method to get Spectrum REST call returned in JSON format?

book

Article ID: 259521

calendar_today

Updated On:

Products

CA Spectrum

Issue/Introduction

I am Issuing the API call below but it returns data in XML format.   

How can I get it to return in JSON format? 

https://OC-SERVER:8443/spectrum/restful/alarms?attr=0x11f4e&attr=0x1006e&attr=0x11f56&attr=0x11f56&&attr=0x12b4c

Environment

Release : 20.x, 21.x, 22.x

Cause

  • You need to pass the correct header allong with the request   
  • The options are:  application/xml OR application/json

Resolution

The script or tool being used for the REST call needs to pass the header as application/json.

Here is an example using the Postman application:

Under headers add Accept - application/json and it will return with correct JSON formatting.

Additional Information

GET action