crucible restapi xml parsing fail

Hi I am trying to send a file through restapi which it has special characters (I am using git , I commiited the file and tried to send through restapi), I am using below rest call, but its not anchoring or not generating the review link if the file contains any special characters,

Please let me know hpw to fix this issue

$headers = {"Accept" =>'application/xml', "Content-Type" => 'application/xml', "Authorization" =>'Basic '};
my $responseContent = $client->POST('/rest-service/reviews-v1/?FEAUTH='.$token, $file, $headers);

Thanks

Dandu

3 answers

1 accepted

This widget could not be displayed.

its working now, I've added ![CDATA , its working now, thanks

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<addPatch>
<patch><![CDATA[
patchdiff here..
]]>
</patch>
<anchor>
<anchorPath>/</anchorPath>
<anchorRepository>$repo</anchorRepository>
<stripCount>2</stripCount>
</anchor>
</addPatch>

This widget could not be displayed.

I am doing diff of my file which it contains special characters, If I am parsing this text into restapi format , it is not working, it doesn't accept the special characters.

patchcontent

DIFF IS diff --git x.txt x.txt
index dec2cbe..d0c7fbe 100644
--- x.txt
+++ x.txt
@@ -1,2 +1,4 @@
test
test
+test
+test
diff --git y.txt y.txt
index 8164a18..a58ee72 100644
--- y.txt
+++ y.txt
@@ -1,2 +1,3 @@
test;
&del
+&del

I used this restapi call

<addPatch>
<patch>
patchcontent
</patch>
<anchor>
<anchorPath>/</anchorPath>
<anchorRepository>reponame</anchorRepository>
<stripCount>2</stripCount>
</anchor>
</addPatch>

This widget could not be displayed.

As you send the patch in XML format, some special characters must be encoded.
One page where these are described is http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML

If you are using an "&" (ampersand) in your patch, then you need to replace it with "&amp;" if you want to send it as XML.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

115 views 2 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you