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

How to get Smartnet coverage information via the Cisco API

tnakano03
Level 1
Level 1

I would like to get Smartnet coverage information via the Cisco API. I need to generate the API key using my client_id and client_secret. However, I don't know where to set up or register my client_id and client_secret. Can you direct me to the right direction?

https://apiconsole.cisco.com/apps/register

I tried to register “api.cisco.com/sn2info” API but it is not listed here. I see only following APIs to register. How can I enable sn2ifo API?

  • CEEM API
  • Cisco On Demand CHIDS API
  • Cisco PSIRT openVuln API
  • Datafoundation-POE
  • HelloCommerce API
  • Workforce Mohit

===Python example

import requests

def get_access_token(client_id, client_secret):
url = "https://id.cisco.com/oauth2/default/v1/token"
headers = {
"Content-Type": "application/x-www-form-urlencoded"
}
body = {
"grant_type": "client_credentials",
"client_id": client_id,
"client_secret": client_secret
}

response = requests.post(url, headers=headers, data=body)

if response.status_code == 200:
token_info = response.json()
return token_info['access_token']
else:
return {"error": response.status_code, "message": response.text}

def check_smartnet_coverage(serial_number, api_key):
url = f"https://api.cisco.com/sn2info/v2/coverage/{serial_number}"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}

response = requests.get(url, headers=headers)

if response.status_code == 200:
coverage_info = response.json()
return coverage_info
else:
return {"error": response.status_code, "message": response.text}

# Replace with your actual client_id and client_secret
CLIENT_ID = "your_client_id_here"
CLIENT_SECRET = "your_client_secret_here"

# Get the access token
access_token = get_access_token(CLIENT_ID, CLIENT_SECRET)

if "error" not in access_token:
# Replace with your actual serial number
SERIAL_NUMBER = "your_serial_number_here"
coverage_info = check_smartnet_coverage(SERIAL_NUMBER, access_token)
print(coverage_info)
else:
print(access_token)

 

1 Accepted Solution

Accepted Solutions

Torbjørn
Spotlight
Spotlight

There should be an option to select "Serial Number to Information API Version 2". It seems that you might be missing authorization to access this API. You can contact support at supportapis-help@cisco.com 

Happy to help! Please mark as helpful/solution if applicable.
Get in touch: https://torbjorn.dev

View solution in original post

5 Replies 5

Torbjørn
Spotlight
Spotlight

There should be an option to select "Serial Number to Information API Version 2". It seems that you might be missing authorization to access this API. You can contact support at supportapis-help@cisco.com 

Happy to help! Please mark as helpful/solution if applicable.
Get in touch: https://torbjorn.dev

Hi Torbjørn,

Thank you for your reply. Yes I sent email to supportapis-help@cisco.com as well. 

enrirami
Cisco Employee
Cisco Employee

Hello,

Thank you for contacting Cisco.

In this case, besides contacting API support team, you also need to confirm that you have the proper role to register and access APIs.

I would like to get more details about this, can you please provide the following information?

• Company name:
• Company address:
• CCOID of the one trying to access API:
• Email of the one trying to access API:

You can send me a private message if you prefer that way.

Kind Regards,

Enrique Ramirez

enrirami
Cisco Employee
Cisco Employee

Closing post due to inactivity.

 

Update:

I sent my API access request email to supportapis-help@cisco.com and I received the "Serial Number to Information API Version 2". access in my apps.  

Thank you,

Toshi