cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
490
Views
0
Helpful
8
Replies

How to get Smartnet coverage information via the Cisco API

tnakano03
Level 1
Level 1

Hi,

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 someone direct me to the right direction?

===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)

 

8 Replies 8

mfr-6
Spotlight
Spotlight

hi @tnakano03 

You can register you app here https://apiconsole.cisco.com/

You can also find steps described that you need to follow to get your OAuth2 secrets here: https://apiconsole.cisco.com/docs/read/overview/Platform_Introduction

Another useful resource is documentation itself: https://developer.cisco.com/docs/support-apis/user-onboarding-process/

I hope this helps.

Mateusz Frak NetDevOps | DevNet | Automation
Please mark this post as helpful if it solves your issue, to make this visible for other users, thank you!

Hi mfr-6,

Thank you for the information.

I would like to access "https://api.cisco.com/sn2info/v2/coverage/{serial_number}".

However, on the "Register an Application" page (URI: https://apiconsole.cisco.com/apps/register), I can only select the following APIs. I don't see the "sn2info" API. Which API do I need to select, or does Cisco have another page to register for the "sn2info" API?

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

Thank you,

Toshi

@tnakano03 i would open this support here https://community.cisco.com/t5/smart-net-total-care-portal-and-collector-discussions/bd-p/4891-discussions-smart-net-total-care the team will ask you to 1:1 them the following:

- Email/Cisco ID needing to be Delegated administrator
- Company name:
- Company Physical Address
- Contract Associated

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Hi bigevilbeard,

Thank you. I will look into the smart-net-total-care-portal-and-collector-discussions. 

Toshi

mfr-6
Spotlight
Spotlight

hi @tnakano03 

Based on docs, you need to be a part of Cisco Smart Net Total Care (SNTC) customer or Cisco Partner Support Service (PSS) partners.

https://developer.cisco.com/docs/support-apis/user-onboarding-process/#user-onboarding-process

I believe this is why you cannot get credentials for Support APIs.

Mateusz Frak NetDevOps | DevNet | Automation
Please mark this post as helpful if it solves your issue, to make this visible for other users, thank you!

Hi mfr-6,

Thank you for the additional information.

I work for a Managed Service Provider that manages many enterprise customers, and the account has their Cisco contract numbers and device serial numbers. We are also a Cisco partner. So, I thought the account was already part of SNTC or PSS. However, I am not sure how to check if the account has SNTC or PSS entitlement. I will look into more details.

Thanks!

mfr-6
Spotlight
Spotlight

@tnakano03 

No worries! If your company is a Cisco Partner, then for sure person who takes care of relationship with Cisco will help you. Also you can ask Cisco Support API Team to help you figure out steps to get your account set up so you can generate credentials on your own

apix-support@cisco.com

Mateusz Frak NetDevOps | DevNet | Automation
Please mark this post as helpful if it solves your issue, to make this visible for other users, thank you!

Thank you mfr-6. Yes I send a request to apix-support@cisco.com as well.