Burp Suite User Forum

Create new post

Calling Burp GraphQL API on python

Lionel-Junzer | Last updated: Aug 05, 2020 08:56AM 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': 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 scanConfigurationsQuery() { scan_configurations() { id name } } } """ result = run_query(query) print(result)

Michelle, PortSwigger Agent | Last updated: Aug 05, 2020 11:35AM UTC

Hi We've replied to the email you set us, please let us know how you get on.

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

Even I am getting the same error. Could you please help me out?

Michelle, PortSwigger Agent | Last updated: Dec 08, 2020 09:52AM UTC

Thanks for your message. Can you confirm the URL you are using to try and connect to the API, please? Is the API key specified in the Authorization header still valid?

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