Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to create issue in JIRA using REST API with the description field

Deleted user November 23, 2023

I am trying to create issue (bug) in JIRA cloud using RST API with bearer token. I am using the regular VBScript and  MSXML2.XMLHTTP

I have a simple summary. However my description of the bug is like below:

 

1: Links must be distinguishable without relying on color
Description: Ensure links are distinguished from surrounding text in a way that does not rely on color
Help: Links must be distinguishable without relying on color
Help URL: https://dequeuniversity.com/rules/axe/4.6/link-in-text-block?application=axeAPI
Impact: serious
Tags: cat.color, wcag2a, wcag141
Element(s):
Html:
<a href="https://www.itsmywebsite.com/US/en-US/cookie-settings" target="_blank">Cookie Preference Centre</a>

Selector:
p:nth-child(25) > a[target="_blank"]

To solve:
Fix at least one of the following issues:

SERIOUS: The link has insufficient color contrast of 2.88:1 with the surrounding text. (Minimum contrast is 3:1, link text: #1343de, surrounding text: #000000)
SERIOUS: The link has no styling (such as underline) to distinguish it from the surrounding text
Html:
<a href="https://www.itsmywebsite.com/US/en-US/cookie-settings" target="_blank">Cookie Preference Centre</a>

Selector:
p:nth-child(37) > a[target="_blank"]

To solve:
Fix at least one of the following issues:

SERIOUS: The link has insufficient color contrast of 2.88:1 with the surrounding text. (Minimum contrast is 3:1, link text: #1343de, surrounding text: #000000)
SERIOUS: The link has no styling (such as underline) to distinguish it from the surrounding text
Html:
<a href="https://tools.google.com/dlpage/gaoptout" target="_blank">here</a>

Selector:
p:nth-child(38) > a[target="_blank"]

To solve:
Fix at least one of the following issues:

SERIOUS: The link has insufficient color contrast of 2.88:1 with the surrounding text. (Minimum contrast is 3:1, link text: #1343de, surrounding text: #000000)
SERIOUS: The link has no styling (such as underline) to distinguish it from the surrounding text
Html:
<a href="https://www.itsmywebsite.com/cookie-settings" target="_blank">Cookie Preference Centre</a>

Selector:
p:nth-child(42) > a[target="_blank"]

To solve:
Fix at least one of the following issues:

SERIOUS: The link has insufficient color contrast of 2.88:1 with the surrounding text. (Minimum contrast is 3:1, link text: #1343de, surrounding text: #000000)
SERIOUS: The link has no styling (such as underline) to distinguish it from the surrounding text
Html:
<a href="http://youronlinechoices.eu/" target="_blank">http://youronlinechoices.eu/</a>

Selector:
a[href$="youronlinechoices.eu/"]

To solve:
Fix at least one of the following issues:

SERIOUS: The link has insufficient color contrast of 2.88:1 with the surrounding text. (Minimum contrast is 3:1, link text: #1343de, surrounding text: #000000)
SERIOUS: The link has no styling (such as underline) to distinguish it from the surrounding text


When this is posted, I am getting 400 with the following error 

{"errorMessages":["There was an error parsing JSON. Check that your request body is valid."]}

I suspect the paragraphs and the special characters are not liked by the API.

Has anyone encountered this issue before? I would appreciate some pointers to get the description field text to be accepted by the API.

I am using REST API v2.

Appreciate any help with this.

2 answers

1 accepted

1 vote
Answer accepted
Deleted user November 23, 2023

I reckon this would help someone.

The following function did the trick.

 

Function escapeJsonData(jsonData)
    jsonData = Replace(jsonData, "\", "\\")
    jsonData = Replace(jsonData, """", "\""")
    jsonData = Replace(jsonData, "/", "\/")
    jsonData = Replace(jsonData, Chr(8), "\b")
    jsonData = Replace(jsonData, Chr(12), "\f")
    jsonData = Replace(jsonData, Chr(10), "\n")
    jsonData = Replace(jsonData, Chr(13), "\r")
    jsonData = Replace(jsonData, Chr(9), "\t")
 
    escapeJsonData = jsonData
End Function
0 votes
Danyal Iqbal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 23, 2023

Your Json string is malformed. You need to escape special characters in the json. Doing this in VBscript is a painful process but if you want to try you could split the string > escape the problematic characters>put it back together and than send the REST request. Good Luck fighting with VBscript!

Any other modern language with a json parser would make the process much less painful. Use python or powershell for example.

Deleted user November 23, 2023

Thank You! I know its a painful process. however invested quite an effort already with VBScript and just the last leg of posting this issue to JIRA.

Yes, I will try and do that. Appreciate that.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events