AnsweredAssumed Answered

Getting 403 error when requested user infomation

Question asked by Hiroyuki Oka Employee on Jul 10, 2016
Latest reply on Jul 29, 2016 by Hiroyuki Oka

Hi Everyone,

 

I got 403 error when I requested /user-admin/v1/accounts/hioka/users.

Do you know why ?

 

hioka@:~/work/Code/api-kickstart/examples/python $ python test.py

https://akab-pbeg6vwx5dhbyfpe-okfscwaihe7p52po.luna.akamaiapis.net//

ERROR: Call to /user-admin/v1/accounts/hioka/users failed with a 403 result

ERROR: This indicates a problem with authorization.

ERROR: Please ensure that the credentials you created for this script

ERROR: have the necessary permissions in the Luna portal.

ERROR: Problem details: Not Authorized to view this resource.

 

hioka@:~/work/Code/api-kickstart/examples/python $

 

I already executed diagnostic_tools.py of api-kickstart. It is working .

so I think .edgerc file is no-problem.

 

Authorized API is following this.

Diagnostic Tools - READ-ONLY

Property Manager - READ-ONLY

User Admin - READ-ONLY

 

test.py is following this. basically same as diagnostic_tools.py

==test.py=================

hioka@:~/work/Code/api-kickstart/examples/python $ cat test.py

#! /usr/bin/env python

# Very basic script demonstrating diagnostic tools functionality

#

import requests, logging, json, sys

from http_calls import EdgeGridHttpCaller

from random import randint

from akamai.edgegrid import EdgeGridAuth

from config import EdgeGridConfig

import urllib

session = requests.Session()

debug = False

verbose = False

section_name = "default"

 

# If all parameters are set already, use them.  Otherwise

# use the config

config = EdgeGridConfig({},section_name)

 

if hasattr(config, "debug") and config.debug:

  debug = True

 

if hasattr(config, "verbose") and config.verbose:

  verbose = True

 

 

# Set the config options

session.auth = EdgeGridAuth(

            client_token=config.client_token,

            client_secret=config.client_secret,

            access_token=config.access_token

)

 

if hasattr(config, 'headers'):

  session.headers.update(config.headers)

 

baseurl = '%s://%s/' % ('https', config.host)

print baseurl

httpCaller = EdgeGridHttpCaller(session, debug,verbose, baseurl)

 

 

# Request the dig request the {OPEN} Developer Site IP informantion

dig_result = httpCaller.getResult("/user-admin/v1/accounts/hioka/users")

 

# Display the results from dig

print (dig_result['dig']['result'])

===============================

 

best regards

Hiro

Outcomes