Sub CreateJiraIssue()
Dim xmlhttp As Object
Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP.6.0")
' JIRA-URL für das Erstellen von Issues
Dim jiraUrl As String
jiraUrl = "https://XXX.atlassian.net/jira/servicedesk/projects/TEST/queues/custom"
' JIRA-Benutzername und API-Token
Dim username As String
Dim apiToken As String
username = "XXX"
apiToken = "XXX"
' JSON-Daten für das neue Issue
Dim postData As String
postData = "{""fields"":{""project"":""Test""}, {" & _
"""key"":""TEST""}," & _
"""summary"":""Test Issue""," & _
"""description"":""This is a test issue created using VBA""," & _
"""issuetype"":{""name"":""Task""}}}"
' Setzen Sie die Anmeldeinformationen
xmlhttp.Open "POST", jiraUrl, False, username, apiToken
' Setzen Sie den Header für JSON-Daten
xmlhttp.setRequestHeader "Content-Type", "application/json"
' Senden Sie die Anfrage
xmlhttp.send postData
' Überprüfen Sie die Antwort
Debug.Print "Statuscode: " & xmlhttp.Status
Debug.Print "Antworttext: " & xmlhttp.statusText
Debug.Print "Antwortinhalt: " & xmlhttp.responseText
' Überprüfen Sie die Antwort
If xmlhttp.Status = 201 Then
MsgBox "Issue wurde erfolgreich erstellt!"
Else
MsgBox "Fehler beim Erstellen des Issues. Status: " & xmlhttp.Status & " - " & xmlhttp.statusText
End If
End Sub
Hi @Lde Buhr and welcome to the Atlassian Community!
Have you authenticated yourself with this code? You probably need a Base64 encode, right? And is the URL for creating an issue not correct as well?
What do these return?
Debug.Print "Status code: " & xmlhttp.Status
Debug.Print "Response text: " & xmlhttp.statusText
Debug.Print "Response content: " & xmlhttp.responseText
I have created an VBA open-source project that you can use for inspiration. You can find the project here. If you add this as an Excel Add-in and include it as a reference, you can create a new Jira issue with the following code:
Dim jiraKey As String
jiraKey = Jira.CreateIssue(project, issueType, summary, description)
Hope this helps!
Doesn't help. Sry.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.