cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1421
Views
5
Helpful
1
Replies

Intersight REST API call with python

akash.meghani
Level 1
Level 1

Hello All,

 

I am new to REST API and recently started working on Cisco Intersight. I am trying to create an API instance for Intersight in my python code. I want to get connected with key_id and private key through python code and perform GET ( let's say get critical alarms). Here is how i am trying to connect :

 

import requests

# api-endpoint
URL = "https://www.intersight.com/api/v1/cond/Alarms"

Key_id = "5fdb89947564612d33a0c071/5ff35f677564612d32f75778/6022c93d7564612d320ac179"

Key_file = open("/Users/akashmeghani/Desktop/intersight_python/SecretKey.txt", "r")

 

I am not able to get connected , is there a different way of getting connected ? Any input will be very helpful. 

 

Thanks in advance 

 

1 Reply 1

cjohanns
Cisco Employee
Cisco Employee

Hi @akash.meghani,

 

there's an example in the python repo that gets the alarms: https://github.com/CiscoDevNet/intersight-python-utils/blob/master/alarms_example.py

and uses the credentials.py helper module in the same directory.

 

Hope this helps,

Christian