I have over 1000 reviews in draft. I need to clean the reviews database in some smart way. How to delete reviews from Crucible??
Is it possible form GUI or do I have to do it on a database?
Thanks in advance,
curl -u <username>:<password> http://localhost:8060/fisheye/rest-service/reviews-v1/<reviewID> -X DELETE -H "Content-Type:application/xml"
Replace the username, password, host url, reviewID accordingly. You can consult more information about reviews structure at crucible's database inside table cru_review. Also this procedure deletes one review so you can create a script to run it against more that one review to automati the process.
Also this procedure delete one review so you can create a script to run
it against more that one review to automati the process.
Thanks for your answer. I tested the REST API method you mentioned. However, it seems that all the reviews must be put in Abandoned state beforehand. (which was quite an astonishing discovery...)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <error><code>IllegalArgument</code> <message> The review PermId:CR-5113 in the Draft is not deletable. </message> <stacktrace> java.lang.IllegalArgumentException: The review PermId:CR-5113 in the Draft is not deletable. at com.atlassian.crucible.spi.impl.DefaultReviewService.deleteReview(DefaultReviewService.java:1679)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ... </stacktrace> </error>
The description I took from here is inconsitent with way this option should be executed:
I think you should correct the description here.
I found the proper way of doing it here:
curl -k -u login:pass http://myCrucibleHost/rest-service/reviews-v1/CR-5113/transition?action=action:deleteReview -X POST -H "Content-Type:application/xml"
Performing the aciton both ways on an abandoned review works fine:
curl -k -u login:pass http://myCrucibleHost/rest-service/reviews-v1/CR-4894 -X DELETE -H "Content-Type:application/xml"
I am still having issues with this.
As I am trying to change the state of a review to abandoned with:
curl -k -u user:pass "http://myCrucibleHost/rest-service/reviews-v1/CR-2197/transition?action=action:abandonReview" -X POST -H "Content-Type:application/xml" <?xml version="1.0" encoding="UTF-8" standalone="yes"?><error> <code>Authorization</code> <message> Crucible unauthorised action. </message><stacktrace>com.atlassian.crucible.spi.services.AuthorizationException: Crucible unauthorised action. at com.cenqua.crucible.model.managers.impl.DefaultReviewManager.changeState(DefaultReviewManager.java:967) at com.atlassian.crucible.spi.impl.DefaultReviewService$27.doInTransaction(DefaultReviewService.java:1703) at com.atlassian.crucible.spi.impl.DefaultReviewService$27.doInTransaction(DefaultReviewService.java:1694) at com.atlassian.fisheye.spi.impl.DefaultTxTemplate.execute(DefaultTxTemplate.java:123) at sun.reflect.GeneratedMethodAccessor1236.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source)
I am using administrator rights and still get this error.
How to be able to abandon a review??
Try the Crucible CLI (see other answer) and use -v to see what it is doing under the covers. I remember it being a royal pain for doing something one would think as being simple.
Here's some ideas that could help you:
1. Take a look into this and see a workaround which actually worked.
2. Make sure your users have permission to ABANDON reviews inside Crucible ADMIN at Permission Scheme and then try again.
3. Try to summarize and then delete:
curl -v -d "" -u youruser:pwd -H "Content-Type: application/xml" http://myCrucible/crucible/rest-service/reviews-v1/CR-2197/transition?action=action:summarizeReview curl -v -d "" -u youruser:pwd -H "Content-Type: application/xml" http://myCrucible/crucible/rest-service/reviews-v1/CR-2197/transition?action=action:closeReview
deleteReview action from the Crucible Command Line Interface can be used in combination with runFromSql to select the reviews you want to remove from the Crucible database. The deleteReview action makes sure the review is in the appropriate state to delete before running the delete (under the covers, the delete is done using the rest api like in Leonardo's answer).
Thanks for quick answer - I knew about that option, however I'd like to make a massive delete of over one thousand reviews in draft mode. I really don't like to do it on a one-by-one basis.
How to delete all draft reviews with single operation? sql query? script?
See how to use Jira on the go! Demo Den Episode 5 is here: meet Jira Mobile with Jira Product Manager Rayen Magpantay. Demo Den is in our monthly series where a Jira PM demonstrates...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events