I am sending the follow data via POST call:
sURL = sJIRAInstance & "/rest/api/latest/issue"
sData = " { ""fields"" : { ""project"" : { ""key"" : """ & sProject & """ }, ""customfield_10229"" : """ & Trim(sText) & """ , ""summary"" : """ & sSummary & """, ""description"" : """ & sDescription & """, ""assignee"" : { ""name"" : """ & sAssigneeName & """ }, ""issuetype"" : { ""name"" : """ & sIssueType & """ } } } "
Debug.Print sData
With JiraService
DoEvents
.Open "POST", sURL, False
.SetRequestHeader "Content-Type", "application/json"
.SetRequestHeader "Accept", "application/json"
.SetRequestHeader "Authorization", "Basic " & UserPassBase64
.SetRequestHeader "X-Atlassian-Token", "nocheck"
.Send (sData)
If .Status = "401" Then
MsgBox "Not authorized or invalid username/password"
Else
End If
End With
However, because there is a newline feed for sText variable, I am getting error response 400. As an example, sText has value like below in two sentences:
ABC
DEF
I am setting sText like below:
sText = sText & Chr(13) & Worksheets("Create JIRA Issues").Cells(k, "C")
How can I pass a variable with two or more lines of data?
Hi @Balaji ,
I guess you are trying to set sText to the customfield_10229 and I guess it is a field similar to description which accepts multi line string. Then try the array of paragraphs as below.
"description": { "type": "doc", "version": 1, "content": [ { "type": "paragraph", "content": [ { "text": "Line1 text bla bla", "type": "text" } ] },
{ "type": "paragraph", "content": [ { "text": "Line2 text bla bla", "type": "text" } ] }
]
}
I suggest that you first make a get rest call for a sample issue you manually created and check the format of the json snippet for customfield_10229. Your VBA code should generate similar json while creating new issue.
Well, it is unlike the description field in that sText gets input from multiple rows in the worksheet. So the "multi-line" is unlike the description field. And secondly, I do not know how many "type" (from your example above) I would have in the request structure. See the picture below for better understanding.
In the picture above, sText gets values from column C (Acceptance criteria). Each story, in the above example, is being created from the grouped rows. So, rows 3 & 4 are a story and the acceptance criteria is extracted in separate lines from column C and need to go into JIRA as separate lines. The next story has 4 ACs. So, I cannot have a static "content" as stated in your code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.