Crucible REST API: Cannot Add Reviewer

I am trying to use the Crucible REST API to add reviewers to the review I just created (also using REST). According to the Atlassian docs, I have to send a POST:

/rest-service/reviews-v1/{id}/reviewers 

with what? Documents do not display a valid request for adding reviewers. When you click expand, it doesn’t show anything, it just says “Comma Separated Replicators” that don't seem to work.

I tried:

 user1,user2 {"user1","user2"} {reviewers:[reviewer:{"userName":"user1"},reviewer:{"userName":"user2"}]} 

All this leads to the following answer:

 {"code":"NotFound","message":"The user named '{\"user1\"' is not a Crucible user.","stacktrace":"com.atlassian.crucible.spi.services.NotFoundException: The user named '{\"user1\"' is not a Crucible user. at com.atlassian.crucible.spi.impl.DefaultReviewService.getUser(DefaultReviewService.java:2011) at com.atlassian.crucible.spi.impl.DefaultReviewService.access$3500(DefaultReviewService.java:95) at com.atlassian.crucible.spi.impl.DefaultReviewService$32.doInTransaction(DefaultReviewService.java:1973) at com.atlassian.crucible.spi.impl.DefaultReviewService$32.doInTransaction(DefaultReviewService.java:1965) at com.atlassian.fisheye.spi.impl.DefaultTxTemplate.execute(DefaultTxTemplate.java:123) at sun.reflect.GeneratedMethodAccessor1317.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) ... 

This stacktrace function continues and continues ...

user1 and user2 are valid names because I can see them in other reviews when I do a GET with the same url.

Does anyone have any ideas?

Thanks!

+4
source share
1 answer

Well, for what it's worth, here's how to add reviewers to an existing review:

  • make a POST for Crucible URL: protocol: // server: port / context / rest-service / reviews-v1 / {id} / reviewers

  • The message body must contain a literal value: user1, user2, user3

  • Resist JSON-ify data requests - no quotes, no brackets, shortcuts, etc. This is a literally comma separated list of usernames to add.

  • Do not expect a response from the server, it seems to return a status code of 204. Although this is acceptable as a calm response, it seems strange since many other URLs of this API return something when you do a POST to confirm that the job is complete .

In fairness for Atlassian, the documents document the data to be sent:

"comma separated list of browsers"

But the documents should probably be updated with an example, since I think it would be normal for someone (at least for me) to assume that when using the RESTful API they need to format the data as JSON. In addition, the documents should indicate more carefully that the server does not send a response to success. That is, IMHO.

Hope this helps someone!

+2
source

All Articles