Burp Suite User Forum

Create new post

Getting 401 error when query getScanConfigurations

Siva | Last updated: Dec 07, 2020 05:46PM UTC

Hello, I seem to be having trouble making a simple query on the Burp Suite Enterprise GraphQL API. I keep getting a 401 error. This is my code snippet. Would greatly appreciate any help! ============================= burpEndpoint = '<Enterprise_server_url>/api/graphql/v1' apiToken = <Token that I was given> #Checked that token is still valid headers = {"Authorization": "bearer {}".format(apiToken)} def run_query(query): request = requests.post(burpEndpoint, query, headers) if request.status_code == 200: return request.json() else: raise Exception("Query failed to run by returning code of {}. {}".format(request.status_code, query)) query = """ { query getScanConfigurations { scan_configurations { id name } } } """ result = run_query(query) print(result)

Michelle, PortSwigger Agent | Last updated: Dec 08, 2020 01:30PM UTC

Thanks for your message When you specify the URL for the GraphQL API you just need to use <ENTERPRISE-SERVER-URL>/graphql/v1, there's an extra API lurking in the URL in your code which is probably what's causing the issue. Please let us know how you get on and if you have any further questions.

You must be an existing, logged-in customer to reply to a thread. Please email us for additional support.