This page last changed on Sep 16, 2010 by mknight.
Perl
Logging In
#!/usr/bin/perl
use SOAP::Lite;
use Data::Dumper;
my $soap = SOAP::Lite->proxy("http://localhost:8090/rpc/soap/jirasoapservice-v2?wsdl");
my $auth = $soap->login("admin", "admin");
Creating Issue
$issueMap = {"project" => SOAP::Data->type(string => "YQ"),
"components" => [{"id" => SOAP::Data->type(string => "10010")}],
# this is definitely not working as "10010" will be 'autotyped' to int:
# "components" => [{"id" => "10010"}],
"type" => SOAP::Data->type(string => "1"),
"summary" => SOAP::Data->type(string => "Issue created via Perl/SOAP")
};
my $issue = $soap->createIssue($auth->result(), $issueMap);
Python
Logging In
#!/usr/bin/python
import SOAPpy, getpass, datetime, array, base64, random
from SOAPpy import Types
soap = SOAPpy.WSDL.Proxy('http://localhost:8090/rpc/soap/jirasoapservice-v2?wsdl')
jirauser='admin'
passwd='admin'
auth = soap.login(jirauser, passwd)
Adding User to Group
group = soap.getGroup(auth, 'foo')
user = soap.getUser(auth, 'admin')
user = {'name': user['name']} # without this line, you might be facing some funny problems. see JRA-7920.
soap.addUserToGroup(auth, group, user)
Listing Workflow Actions and associated Fields and Progressing
# List
actions = soap.getAvailableActions(auth, 'MYC-28')
print "actions:"
for action in actions:
print action
fields = soap.getFieldsForAction(auth, 'MYC-28', action['id'])
for field in fields:
print field;
print "-----"
# Progress
issue = soap.progressWorkflowAction(auth, 'MYC-28', '5', [{'id': 'resolution', 'values': ['2']}, {'id': 'assignee', 'values': ['admin']}, {'id': 'comment', 'values': ['testo!']}])
Ruby
#!/usr/bin/env ruby
require 'rubygems'
gem 'soap4r' # The soap4r gem is actually an updated version of the built-in SOAP driver, so we need to override it.
require 'soap/wsdlDriver'
soap = SOAP::WSDLDriverFactory.new('http://localhost:8080/rpc/soap/jirasoapservice-v2?wsdl').create_rpc_driver
# Login.
token = soap.login('admin', 'admin')
# Create an issue.
issue_map = {
:type => "1",
:project => "TEST",
:summary => "Created with soap4r",
:description => "This is the description.",
:assignee => "admin"
};
issue = soap.createIssue(token, issue_map);
# Close the issue with a resolution of "Fixed".
action = "2" # 2 = "Close". Note how this is actually a string, not an integer.
resolution_type = "1" # 1 = "Fixed". Also a string.
issue = soap.progressWorkflowAction(token, issue.key, action, [{ :id => "resolution", :values => resolution_type }])
|