Creating a Jira Issue from VB.Net with Web Services

Posted by Blake on 8/16/2011

I’m going to outline the steps necessary to create an Issue in Jira from VB.Net. This will be pretty basic, but it will give you the idea of what you need to do:

  1. Create a web reference to:
    • To do this, right click on your solution in the solution explorer and choose “Add Service Reference”
    • Basically, take your Jira’s root link and start appending the “rpc” part after it. This will allow Visual Studio to read in the schema.
  2. Here is a basic snippet that will create an issue and then shell out to it in the explorer. You’ll need to change the URL to your Jira installation:

Dim jiraSoap As New Jira.JiraSoapServiceClient()
Dim token As String = jiraSoap.login("YOUR USERNAME", "YOUR PASSWORD")

Dim newIssue As New Jira.RemoteIssue
newIssue.assignee = "assignee username"
newIssue.summary = "Test Issue"
newIssue.description = "This is a test issue automatically created via the SOAP web services."
newIssue.project = "MISC"
newIssue.type = 3
newIssue.priority = 3

Dim createdIssue As Jira.RemoteIssue = jiraSoap.createIssue(token, newIssue)
Dim url As String = String.Format("{0}", createdIssue.key)


Basically with the above, you create the client, authenticate to the site then setup the new issue. I’ve hard coded the project type code and priority. I obtained the value’s from my setup’s database tables and the project code I just got from the site. I could have also gotten the project from the database. Here are a few SQL queries to obtain that information quickly:

select * from jiraschema.issuetype;
select * from jiraschema.priority;
select * from jiraschema.project;