cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3326
Views
0
Helpful
3
Replies

Cisco Webex Python Request Authentication Header

Godwin_S
Level 1
Level 1

Hi Friends,

I am trying to explore Cisco Webex REST API with Python and somehow I am stuck in Authentication error. I have successfully created token ID(just mentioned 'xyzxyz' as refernce) , but not sure how to input in GET request. Can someone help please?

 

Code:

import requests
r=requests.get('https://webexapis.com/v1/people?email=godwin.nivin@gmail.com', headers={'Authentication': 'xyzxyz'}, verify=False)
print(r.content)

 

Error:

b'{"message":"The request requires a valid access token set in the Authorization request header.","errors":[{"description":"The request requires a valid access token set in the Authorization request header."}],"trackingId":"ROUTER_5F172C02-CCA6-01BB-4D40-AC12DF264D40"}'

Process finished with exit code 0

3 Replies 3

Anush Kuladeepa
Cisco Employee
Cisco Employee

Instead of "Authentication" in your header, use "Authorization" with token.

token = 'Bearer ****'

headers = {
"Authorization" : token,
"Content-Type" : "application/json"
}

Note: The token **** could be obtained from the https://developer.webex.com/docs/getting-started page after you login.

You can try this by adding Bearer before inserting the Authentication header ("xyzxyz")

import requests
r=requests.get('https://webexapis.com/v1/people?email=godwin.nivin@gmail.com', headers={'Authentication': 'Bearer xyzxyz'}, verify=False)
print(r.content)

 

Mike_Brezicky
Cisco Employee
Cisco Employee
I hate to not be able to answer the question, but we have a wonderful DevNet community that would be able to dive into the API structure in more depth.

https://community.cisco.com/t5/cloud-collaboration/bd-p/j-disc-dev-cloud-collab