Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to create a Jira Ticket by using VBA?

I am trying to create a ticket by using VBA, would like to get some tips from experts here. Thanks

2 answers


Thank you for your resposne. Don't worry. I have figured out and fixed the bug in the code.

Best regards,

Li Chai

0 votes
Pavel Junek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 18, 2023

Hi Li,

You can check this thread - VBA code to get issue from JIRA using REST API 


Pavel Junek:

Thank you for your response. I did read this thread and tried to follow the code. However, it is for GET mothod while I am lookiing for a POST method to create a new issue on Jira. I worte a sub and got Response status: 403 error. It seems there is a permission iissue. 

Below is the code. Please take a look and provide me with your advce.


Li Chai




Option Explicit

Sub CreateJiraTicket()
' Define the Jira REST API URL and authentication details
Const JiraUrl As String = ""
Const JiraUser As String = "glouser"
Const JiraPass As String = "glouser"

' Print the values of JiraUser and JiraPass for debugging
Debug.Print "JiraUser: " & JiraUser
Debug.Print "JiraPass: " & JiraPass

' Define the Jira ticket data
Dim IssueType As String
Dim Summary As String
Dim Description As String
Dim Campus As String
Dim Lab As String
Dim Watcher As String

' Set the Jira ticket data
IssueType = "GLO Lab Support"
Summary = "This is a test ticket please ignore."
Description = "This is a test ticket please ignore."
Campus = "Sunnyvale Building B"
Lab = "San Francisco Lab (B.5.210)"
Watcher = "glouser"

' Create an XMLHTTP object
Dim http As Object
Set http = CreateObject("MSXML2.XMLHTTP")

' Prepare the Jira REST API request
Debug.Print "Preparing request..."
http.Open "POST", JiraUrl, False
http.setRequestHeader "Content-Type", "application/json"
http.setRequestHeader "Authorization", "Basic " & Base64Encode(JiraUser & ":" & JiraPass)

' Construct the Jira ticket JSON payload
Dim payload As String
payload = "{""fields"": {""project"": {""key"": ""GLO""}, ""summary"": """ & Summary & """, ""watcher"": """ & Watcher & """, ""description"": """ & Description & """, ""issuetype"": {""name"": """ & IssueType & """}, ""customfield_10371"": {""value"": """ & Campus & """, ""child"": {""value"": """ & Lab & """}}}}"
''' payload = "{""fields"": {""project"": {""key"": ""Project""}}}"

 ' Send the Jira REST API request
http.Send payload
Debug.Print "Sending request..."
Debug.Print ("This is the payload: " & payload)
Debug.Print ("This is the URL: " & JiraUrl)

' Check the response status
Debug.Print "Response status: " & http.Status
If http.Status = 201 Then
' Get the ticket key from the response
Dim JSON As Object
Set JSON = JsonConverter.ParseJson(http.responseText)
Dim ticketKey As String
ticketKey = JSON("key")

' Display the Jira ticket key
MsgBox "Jira ticket " & ticketKey & " created."
''' Else
''' ' Display an error message
''' MsgBox "Failed to create Jira ticket. Response status: " & http.Status
End If
End Sub

Function Base64Encode(ByVal sText As String) As String
Dim arrData() As Byte
arrData = StrConv(sText, vbFromUnicode)

Dim objXML As Object
Set objXML = CreateObject("MSXML2.DOMDocument")

Dim objNode As Object
Set objNode = objXML.createElement("b64")
objNode.DataType = "bin.base64"
objNode.nodeTypedValue = arrData
Base64Encode = objNode.Text

Set objNode = Nothing
Set objXML = Nothing
End Function

Pavel Junek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 23, 2023

Hi Li,

Unfortunately, I don't know how to program in VBA, so I can't advise you.


Suggest an answer

Log in or Sign up to answer