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: '<' and '>'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 '<' and '>':
"dc:title": "Pricing Service Call Failure:<NS1:PricingResponse (.*)<errFlag>true<\/errFlag> created by RTC API auto",
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: '<' and '>'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 '<' and '>':
"dc:title": "Pricing Service Call Failure:<NS1:PricingResponse (.*)<errFlag>true<\/errFlag> created by RTC API auto",
One answer
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 \/.
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 \/.