Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

creating work item encounter html tags converter issue

Hello,

I using following shell script to create a work item:

Shell script:
 CURL=$HOST"/oslc/contexts/_nO3roXC_EeS6vP4NWXuc2g/workitems"

 curl -D - -k -b $COOKIES -o "$tmpcreatelog" -H "Content-Type: application/x-oslc-cm-change-request+json" -H "Accept: text/json" -X POST --data-binary @createpdtmp.json $CURL

createpdtmp.json file:
"dc:title": "Pricing Service Call Failure:<NS1:PricingResponse (.*)<errFlag>true</errFlag> created by RTC API auto",

And while the title value in the "createpdtmp.json" file contains character '<' and '>', the characters between '<' and '>' will be missed in the created work item's title, it will become to "Pricing Service Call Failure:<NS1:PricingResponse (.*)true" in the work item' title.

I found that if I change the '<' and '>' to html tags:  '&lt;' and '&gt;'as following, it will work. Need I to convert all the special characters to html tags? Is there any other methods to resolve this issue instead of converting to html tags? Kindly please help to check and give some advice. Thanks!

Replace  '<' and '>'  with html tags '&lt;' and '&gt;':
"dc:title": "Pricing Service Call Failure:&lt;NS1:PricingResponse (.*)&lt;errFlag&gt;true&lt;\/errFlag&gt; created by RTC API auto",



0 votes



One answer

Permanent link
The forum may have messed up your original text so it's hard to say what is what in your post. But I will suggest the following.
1. Use the HTTP request header "Content-Type: application/json". I'm not quite sure why you used the one that you have chosen.
2. Escape the double quotes and slashes in your string. In other words, you would use \" and \/.

0 votes

Comments

Hello,

I changed to use the HTTP request header "Content-Type: application/json" you suggested as following:

curl -D - -k -b $COOKIES -o "$tmpcreatelog" -H "Content-Type: application/json" -H "Accept: text/json" -X POST --data-binary @createpdtmp.json $CURL

And I also escape the double quotes as following:
"dc:title": "Pricing Service Call Failure:<NS1:PricingResponse (.)<errFlag>true<\/errFlag> created by RTC API auto"

But, the characters between '<' and '>' will be missed in the created work item's title as following:
Pricing Service Call Failure:<NS1:PricingResponse (.
)true created by RTC API auto

Besides, I got the one I used before in following doc: Is there any more latest doc for creating working item using restapi? Thanks!
https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2#Creating_Work_Items

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938
× 479

Question asked: Jun 24 '16, 3:44 a.m.

Question was seen: 2,512 times

Last updated: Jun 27 '16, 2:25 a.m.

Confirmation Cancel Confirm