Spectrum restful query using curl not returning expected information.
search cancel

Spectrum restful query using curl not returning expected information.

book

Article ID: 246484

calendar_today

Updated On:

Products

DX NetOps CA Spectrum

Issue/Introduction

API using CURL is not working for me.

I try to get all Rtr_Cisco devices from Spectrum database along with some attribute values but it still gives me everything. The CURL command is below.

D:\XMLfiles>curl -v -X GET --header 'content-type:application/xml' --user <user>:<password> "https://Spectrum.com:8443/spectrum/restful/devices?attr=0x10000&val=Rtr_Cisco&attr=0x1006e&attr=0x12d7f&attr=0x12aaa&attr=0x12ac6"

How to get only the Rtr_Cisco models and their attributes?

Environment

Release : Any

Component : Spectrum Applications / Web API / Resful

Cause

The restful "devices" is defined as all models returned by the SpectroSERVER action FIND_ALL_DEVICE_MODELS (0x1023a).

Resolution

The $SPECROOT/RestfulExamples/xml/Models/GetCiscoRouterModels.xml file is a good example of what you are trying to accomplish.

I ran this in the OneClick API Documentation (Swagger UI) page under the Models POST /models and it works pretty good.

To test:

- Log into the OneClick web pages as an ADMIN user

- Click on the API Documentation link

- Scroll down to the models section and open the second POST "/models"

- Click on the Try it out button

- Copy the contents of the $SPECROOT/RestfulExamples/xml/Models/GetCiscoRouterModels.xml file into the body

- Click on the Execute button

Convert this to a curl query.