cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
11655
Views
5
Helpful
12
Replies

403 permissions denied when using SNTC services api - csapi-customer

steffenwebb
Level 4
Level 4

1. I have access to my customer SNTC portal.

2. I have been granted as both customer user and API developer.

3. I have added csapi-customer api to my application

4. When I request a token with postman using clients & client secret from my application -it works

5. when I do a get from postman to https://apx.cisco.com/cs/api/v1/customer-info/customer-details/ with my bearer token

I says 403 permission denied.

 

What is wrong? Could this be because of missing contract access on my cco account?

When using the product info api it works perfect.

 

Best regards Steffen Webb

1 Accepted Solution

Accepted Solutions

Hernani Crespi Di Palma
Cisco Employee
Cisco Employee

Good Morning Steffen,

 

We will reach out to you offline to validate the credentials and assist you with this issue. 

 

Thanks,

Hernani Crespi

View solution in original post

12 Replies 12

Hernani Crespi Di Palma
Cisco Employee
Cisco Employee

Good Morning Steffen,

 

We will reach out to you offline to validate the credentials and assist you with this issue. 

 

Thanks,

Hernani Crespi

Hello, would you be able to contact me as well ? We have the same issue 403 with valid Token?
many thanks
marek

I'm having this very same issue, and have developer api access.  I've created the application in Mulesoft and got ID's for customer and inventory api's.  I can get a token, but just like everyone else, when I attempt to get the customer data, it returns a 403 error.  The program returns the same.

 

Can anyone help?

 

Thanks,

Lon.

Hello @Hernani Crespi Di Palma I see that you have helped @arionl resolve his issue of getting empty data set ({data[];}) I am getting the same thing with success 200 when i try to use customerId to get contract details, can you please help me with this. I see you have explained him about some "sync issue between the Mulesoft platform for his Cisco ID" but i do not understand what it is or how to solve, please help

arionl
Level 1
Level 1

I'm having a similar problem. I don't get a 403 error, I get a 200 response but an empty set ('[]') for customer details. My app is registered, it has access to 'csapi-customer' and I'm using 'client credentials' for auth. My user account has all of the appropriate roles in SNTC (APIDeveloper, CustomerAdmin, CustomerUser). I can see data in SNTC fine. Not sure what else to try! Anyone face a similar issue? What am I missing?

 


@arionl wrote:

I'm having a similar problem. I don't get a 403 error, I get a 200 response but an empty set ('[]') for customer details. My app is registered, it has access to 'csapi-customer' and I'm using 'client credentials' for auth. My user account has all of the appropriate roles in SNTC (APIDeveloper, CustomerAdmin, CustomerUser). I can see data in SNTC fine. Not sure what else to try! Anyone face a similar issue? What am I missing?

 


Hi Arionl

 

I first get my token with this link (using my clientid and secret from my app registration):

https://cloudsso.cisco.com/as/token.oauth2?grant_type=client_credentials&client_id={{CLIENTID}}&client_secret={{CLIENTSECRET}}

 

Then I call (with the token provided from oauth2 request)

https://apx.cisco.com/cs/api/v1/customer-info/customer-details?access_token={{token}}

 

Output with status 200=OK is get as list of customers i have access to.

 

If you don't get the same result with token as I did, try to delete the app, and create it again and add csapi-customer + csapi-inventory. http://cs.co/apiplatform

 

Best regards Steffen

 

Thanks for the reply. I tried these steps but I'm still getting the same results. My API calls seem to work fine (so the token is OK). I can even see the successful 200 requests in the API dashboard screen.. I'm just not getting any results from the 'customer-details' call. I'm using some sample Python code I found (can't remember where). Below is the relevant snippet. Any assistance would be appreciated.

 

Thanks,

Arion

 

 

import os
import requests

class CiscoSerial(object):
def __init__(self):
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
client_id = os.getenv('client_id')
client_secret = os.getenv('client_secret')

data = [
('client_id', client_id),
('client_secret', client_secret),
('grant_type', 'client_credentials'),
]

r = requests.post('https://cloudsso.cisco.com/as/token.oauth2', headers=headers, data=data, verify=False)
json_data = r.json()
print(json_data)
self.bearer_token = json_data['access_token']

def get_customer_details(self):
get_headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {}'.format(self.bearer_token),
'Access-Control-Allow-Origin': '*'}
output = requests.get('https://apx.cisco.com/cs/api/v1/customer-info/customer-details',
headers=get_headers, verify=True)
return output

if __name__ == '__main__':
lookup = CiscoSerial()
data = lookup.get_customer_details()
if data.status_code >= 200 and data.status_code < 400:
print(data.headers)
print("{} - {}".format(data.status_code,data.reason))
print(data.json())
else:
print(data.headers)
print("{} - {}".format(data.status_code,data.reason))

 

Thanks for the reply. I tried deleting and recreating the app but I'm still getting the same results. The API calls are all successful (returning 200 codes) but I'm just not getting any results from 'customer-details'. Any ideas? I tried to post a code snippet but my message then got marked as SPAM :(

Actually, I got your snippet code, and just tried it with success. So the python code works.

It must be some permissions or relationship with your cco account maybe. 

Thanks. I'll reach out to my Cisco account team and see if they can sort it out.. Glad the code and approach is solid though. Hoping to get this access in place soon so I can do some reconciliation of SNTC with our internal CMDB..

Try to write Hernani from cisco whi helped me in this thread :)

Just closing the loop here -- Hernani was able to help me get this sorted out.. apparently there was a sync issue between the Mulesoft platform for my Cisco ID.. after correcting it everything is working as expected. Thanks!