Get report data from API

I can make a call to /api/xxx with no problem and it gets a JSON result. This implies my token auth is working.

I'm getting 401 access errors, and my URI looks like:

Python code below.


from urllib2 import Request, urlopen


token = "xxxx"

password = "yyyy"


headers = {

  'Content-Type': 'application/json',

  'Accept': 'application/hal+json',

  'Authorization': "access_token %s" % (token)



# report



url = ''


print headers

print url


request = Request(url, headers=headers)


response_body = urlopen(request).read()

print response_body

4replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi Ryan Choi , The "Authentication" value would need to be access token/access secret (you should get both of these upon generating an access token) base 64 encoded. You can write a small Python/Ruby script to generate that value. The word "access_token" doesn't need to be included in the value. Let me know if that helps! 

  • Leqi Long Can you be more specific?  Typically HTTP Basic auth header looks something like {'Authorization': 'Basic adf98ss98d9s8=='}, where the Base64 encoded string is in the format of user:password.  I believe that what you are saying here is that the encoded string should be "token/secret", but I haven't had success with that.

  • Matt Dreyer I just successfully connected using Postman, basic auth is what you want.
    'Authorization': 'Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==' }

  • Thanks for following up here Mike C !

    You can also use a Basic Auth generator like this one to generate your Authorization header's value.

Like2 Follow
  • Status Answered
  • 1 yr agoLast active
  • 4Replies
  • 1726Views
  • 6 Following