Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Login to jira soap api

Tags:

c#

soap

api

jira

I try use jira soap api on c#:

  1. create new project in VS2010
  2. add web service reference (JiraTest): http://jira.atlassian.com/rpc/soap/jirasoapservice-v2?wsdl
  3. write next code:

    static void Main(string[] args)
    {
        var jiraLogin = "soaptester";
        var jiraPassword = "soaptester";
        var jiraClient = new JiraTest.JiraSoapServiceClient();
        var projects = jiraClient.getProjects();
    }
    

But this code throw exepition that I'm not autentificate yet. I try find login method, but it have next signature:

public void login();

Where are no loginname and password parameters. When I use this login method code throw exeption that login or password invalid. And I don't known where I must set my credentials.

How I can login with jira soap api before call needed method?

Added: see https://developer.atlassian.com/display/JIRADEV/Creating+a+JIRA+SOAP+Client

like image 995
tbicr Avatar asked Jan 09 '12 10:01

tbicr


People also ask

How do I access API in Jira?

To authorise access to the Jira API, you need to provide the base URL of your Jira instance. If you're a Jira Cloud user, the base URL is the part that ends with atlassian.net e.g. https://mycompany.atlassian.net. When using Jira Cloud, you have to authenticate with Jira API by using the API token instead of password.

Is there an API for Jira?

The Jira Software and Jira Service Management applications have REST APIs for their application-specific features, like sprints (Jira Software) or customer requests (Jira Service Management). If you haven't used the Jira REST APIs before, make sure you read the Atlassian REST API policy.


1 Answers

I had the same problem and found the answer. You need to add it as a Web Reference. It will bring in the parameters but as they appear in the WSDL so login(string username, string password) become login(string in0, string in1) but atleast it's usable.

So steps:

  • Right-click Project and click "Add Service References..." (just like before)
  • Click "Advanced..." in the bottom left of the dialog
  • Click "Add Web Reference..." in the bottom left of the dialog
  • Enter the WSDL Url in the Url Box for example "https://jira.atlassian.com/rpc/soap/jirasoapservice-v2?WSDL"
  • Click the green go arrow
  • Name your reference in the Web reference name: box
  • Click "Add Reference"
like image 143
Monso Avatar answered Sep 24 '22 15:09

Monso