Rest-API call failure after upgrade to Spectrum R10.2.3

book

Article ID: 109656

calendar_today

Updated On:

Products

CA Spectrum

Issue/Introduction

When using previous working rest-api calls accessing CA Spectrum R10.1.1 these may fail when upgrading CA Spectrum to R10.2.* 

Samples:
http[s]://$HOST:<port>/spectrum/restful/alarms/count  
http[s]://$HOST:<port>/spectrum/restful/subscription
http[s]://$HOST:<port>/spectrum/restful/subscription/$SUB

Error reported/reply shows: File "/usr/lib64/python2.6/json/decoder.py", line 338, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded

Doing the rest-call via Browser may reply "http error 405"

CA Spectrum Rest API is changed by R10.2.* upgraded functionality.

Environment

This is related to all support CA Spectrum OS-level platforms

Resolution

The Restful API for CA Spectrum R10.2++ is now changed for some rest-call now requiring updated POST context.

So this could be seen as the rest-call serviced by a R10.1.* OneClick-Spectrum webserver is using default (old) POST context which allows to create a response.

This is not the case then for this same call when send to R10.2.* OneClick-Spectrum webserver.

Please reference the "RESTful Resources (Nouns) section of the documentation for more information.

Sample coding / POST context for ./alarms/count:


POST BODY CONTENT START
-------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<rs:subscription-request
    xmlns:rs="http://www.ca.com/spectrum/restful/schema/request"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.ca.com/spectrum/restful/schema/request ../../../xsd/Request.xsd ">
<rs:pull-delivery-mode>
<rs:max-notifications/>
<rs:pull-interval>5000</rs:pull-interval>

</rs:pull-delivery-mode> 
</rs:subscription-request>
-------------------------------------------
POST BODY CONTENT END

For any additional infor find more per specific examples of Subscription XML, see the following:
* In <$SPECROOT>/RestfulExamples/xml/Alarms:
* PullAlarmsSubscription.xml
* In <$SPECROOT>/RestfulExamples/xml/Models
* PullAttrWatchForAllDevices.xml
* In <$SPECROOT>/RestfulExamples/xml/MTypes:
* PullWatchForNewMTypes.xml
* PushWatchForNewMTypes.xml
* PushWatchForNewMTypesBatchMode.xml
* PushWatchForNewMTypesNoExpiration.xml

Additional Information

Please reference the "Web Services API Reference" section of the documentation for more information.