Hi, I am trying to generate a review, I am getting 404 Not Found{"status-code":404}, earlier I got 500 internal error, Please let me know any issues on parsing the data below. How can I generate the review and add changeset using this rest api
use LWP::UserAgent;
use HTTP::Request::Common qw(POST);
my $client = LWP::UserAgent->new;
my $data =<<'EOF';
POST /rest-service/reviews-v1 HTTP/1.1
Host: http://localhost:8060/crucible
Content-Length: 269
Authorization: Basic am9lOmpvZQ==
Accept: application/json
Content-Type: application/json
{"createReview":
{"reviewData": {
"allowReviewersToJoin":false,
"author":{"userName":"test"},
"creator":{"userName":"test"},
"moderator":{"userName":"test"},
"description":"JSON Review",
"metricsVersion":1,
"name":"readme ",
"projectKey":"CR"},
"patch":"Adding a patch"}
}
EOF
my $body = '{"CreateReview":{"repository":"TEST","patch":"$data"}}';
my $response = $client->request(POST 'http://localhost:8060/crucible/rest-service/reviews-v1/TEST-1/CreateReview', 'Content-Type' => 'appl
ication/json', 'Content' => $body);
print $response->status_line;
print $response->content;
Community moderators have prevented the ability to post new answers.
curl -X POST --cookie "remember=INSERT_TOKEN" -H "Content-Type: application/xml" -H "Accept: application/xml" --url "http://HOST:PORT/rest-service/reviews-v1" -d @newReview.xml
newReview.xml:
<createReview>
<reviewData>
<author> <!-- required element -->
<userName>migutman</userName>
</author>
<creator> <!-- required element -->
<userName> migutman </userName>
</creator>
<moderator> <!-- required element -->
<userName>migutman</userName>
</moderator>
<description>These is the Statement of Objectives.</description>
<name>Title of the new review</name> <!-- required element -->
<projectKey>CR</projectKey> <!-- required element -->
<allowReviewersToJoin>true</allowReviewersToJoin>
<state>Review</state>
</reviewData>
</createReview>
thank you, Please share the options for uploading the files and directory structure for review files , is there a way I can add changset without push using restapi option,
curl -X POST --cookie "remember=INSERT_TOKEN" -H "Content-Type: application/xml" -H "Accept: application/xml" --url "http://HOST:PORT/rest-service/reviews-v1" -d @newReview.xml |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i got it working. I have posted by Code in another link
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Gopinath, do you have sample for create a review using the rest API ? Do you have information about authentication using soap , during review I dont want user need to enter thier windows password . I am using curl for upload the file .
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Were you able to get this working? what change you have to make. I am trying to use the crucible rest API to create review and add changesets.
It would be great if you can provide me with a sample code that is working for you
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You should be posting to http://localhost:8060/crucible/rest-service/reviews-v1 to create the review. I am not sure what this TEST-1 is added to the URL?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Renjith,
I tried that also, I removed TEST-1/CreateReview , I got this error
500 Internal Server Error{"code":"JsonMapping","message":"Unrecognized field \"CreateReview\" (Class com.atlassian.fecrurestplugin.crucible.RestReviewService$CreateReview),
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you want to give a local patch or use a change set id for review?
The reason why I asked this is that the patch contents seems to be not valid. See the diff example at
http://docs.atlassian.com/fisheye-crucible/latest/wadl/crucible.html#d2e116
Also in the $body variable, you seem to be repeating the CreateVewi json part again, or am I missing something?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am trying to add change set, I removed the "patch":"Adding a patch"} as well and tried to generate the review , but receive this error. what is the right syntex of $body for changeset review
500 Internal Server Error{"code":"JsonMapping","message":"Unrecognized field \"CreateReview\" (Class com.atlassian.fecrurestplugin.crucible.RestReviewService$CreateReview),
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually you didnt notice the second part of my comment "Also in the $body variable, you seem to be repeating the CreateVewi json part again, or am I missing something?"
AThe error string is reporting that 'CreateReview' is an unknown option, which is true. You are adding that in this line "my $body = '{"CreateReview":{"repository":"TEST","patch":"$data"}}';"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.