SonarQube 6.0: /api/project/delete not working

1,423 views
Skip to first unread message

Michael Rüegg

unread,
Aug 18, 2016, 8:26:07 AM8/18/16
to SonarQube, Michael Rüegg
Hi,

I’ve just tried to use /api/project/delete in SonarQube 6.0 but I always encounter the following error:

$ curl -v -u admin -H "Content-Type: application/json" -X POST -d ‘{"key": “myproject:master"}' http://localhost:9000/api/projects/delete

HTTP/1.1 400 Bad Request
{"errors":[{"msg":"Either 'id' or 'key' must be provided, not both"}]}

It doesn’t matter if I use ‘id' OR ‘key', I always get the same error message.

Is this a known behaviour?

Best regards,
Michael

Julien Lancelot

unread,
Aug 18, 2016, 8:30:22 AM8/18/16
to Michael Rüegg, SonarQube
Hi Micheal,

I'm not very familiar with the "-d" option of curl, but I know that if you would try the following command it will work : 


Regards,


--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/23F4B82D-DA5A-4C44-B307-6AE9D2A0B309%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
Julien LANCELOT | SonarSource

Julien Lancelot

unread,
Aug 18, 2016, 8:46:14 AM8/18/16
to Michael Rüegg, SonarQube
In fact the -d option is working, but without the curly braces :

$ curl -v -u admin:admin -d "key=sample" http://localhost:9000/api/projects/delete

Michael Rüegg

unread,
Aug 18, 2016, 9:04:36 AM8/18/16
to Julien Lancelot, SonarQube
Hi Julien,

You are right, using URL parameters works. By using “-d”, the JSON is sent in the body of the HTTP POST request.

Thanks,
Michael
Reply all
Reply to author
Forward
0 new messages