Forums

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

Create a record using API via VBA

Gustavo Miller
Contributor
September 19, 2021

Is there a way to create a JIRA record using API (post) via VBA??

Perhaps a sample would be great!

1 answer

0 votes
DPKJ
Community Champion
September 19, 2021

@Gustavo Miller this is for sure possible.

As sample you take some inspiration from this post - https://ashuvba.blogspot.com/2014/08/excel-vba-json-rest-with-jira-json-is.html

 

Also, if you can find better library for VBA to call rest api you can use that as well. Documented here - https://medium.com/automation-generation/using-vba-and-excel-to-make-authenticated-requests-for-alpacas-trading-api-2968acaa3776

Gustavo Miller
Contributor
September 22, 2021

Sorry for the tardiness, it is been very busy at work. I will look at this.

Gustavo Miller
Contributor
September 27, 2021

DPK J, I was wondering if you can share a sample of a JSON string. Due to the number of double-quotes, building the string can be quite challenging.

This is what I gather from the samples:

{“fields” :
      {
           “project” : { “key” : “@KEY@” } ,
          “issuetype” : { “name” : “@IssueType@” }
      }
}

I am assuming that the 'at' signs at NOT part of the string; guess in there I replace with my data. If you can help I would appreciate very much.

DPKJ
Community Champion
September 27, 2021

Here is sample curl that I use

curl --request POST \
--url 'https://<DOMAIN>.atlassian.net/rest/api/3/issue' \
--user '<YOUR_EMAIL>:<API_TOKEN>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"fields": {
"summary": "Issue summary",
"issuetype": {
"id": "10000"
},
"project": {
"id": "10000"
}
}
}'

 

On data, sure you need to replace `@`, and data itself is JSON string. So for this you can use any library that has 'stringify' function. For example this - https://github.com/VBA-tools/VBA-JSON

Here you create dictionary and collection and then convert that to json string, which is much more easier than directly writing json string.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, likes for trees, atlassian community, social impact, tree planting campaign, community kudos, atlassian giving, environmental impact, sustainability, likes for good, atlassian social responsibility, community challenge

Make every click count—help us plant 50,000 trees! 🌳

Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!

Help us plant more trees
AUG Leaders

Atlassian Community Events