Burp Suite User Forum

Login to post

Creating new site using graphql

Mike | Last updated: Jul 01, 2020 06:21PM UTC

I am new to graphql. I've been able to run queries, but have not been able to run any mutations. Trying to create a new site using the following query: Python: query = {"mutation": "{create_site(input{name: Mysite, scope:{included_urls: https://target/}, parent_id:0, scan_configurations:[{id:000}, {id:001}]}})}{site{id,parent_id,scope:{included_urls}}}"} Result: {'errors': [{'message': 'query may not be null', 'extensions': {'code': 3}}]} Any idea what I might be doing wrong?

Ben, PortSwigger Agent | Last updated: Jul 02, 2020 09:27AM UTC

Hi Mike, The query should look something like this (where you can replace the scan configuration IDs with your own): mutation CreateSite { create_site(input: {name: "Mysite", scope: {included_urls: "https://target/"}, parent_id: "0", scan_configuration_ids: ["a4bfa3ae-ebde-4a2e-8911-87a22feadf04", "347c3f46-0112-4ece-8567-48d5e4b8007d"]}) { site { id parent_id scope { included_urls } } } } You should be able to test these using Curl (the Insomnia API client allows you to copy the query as a Curl request): curl --request POST \ --url <ENTERPRISE-SERVER-URL> \ --header 'authorization: <API-KEY>’ \ --header 'content-type: application/json' \ --data '{"query":"mutation CreateSite {\n create_site(input: {name: \"Mysite\", scope: {included_urls: \"https://target/\"}, parent_id: \"0\", scan_configuration_ids: [\"a4bfa3ae-ebde-4a2e-8911-87a22feadf04\", \"347c3f46-0112-4ece-8567-48d5e4b8007d\"]}) {\n site {\n id\n parent_id\n scope {\n included_urls\n }\n }\n }\n}","operationName":"CreateSite"}'

Mike | Last updated: Jul 02, 2020 12:45PM UTC

That works. Thank you!

You need to Log in to post a reply. Or register here, for free.