Im connecting to JIRA using JIRA::REST through perl script.And i want to create a bug/issue in jira from perl script using JIRA::REST.Can anyone help on this?
see for REST api here https://docs.atlassian.com/jira/REST/latest/#d2e865 for creating issue.
try with this script
my $pass = 'password';
#The basic use case
my $client = REST::Client->new();
#A host can be set for convienience
$client->setHost('url');
my $headers = { Authorization => 'Basic '. encode_base64($user . ':' . $pass)};
my $jsonparams =add input data here
$client->Post( '/rest/api/2/issue',$jsonparams , $headers );
if( $client->responseCode() eq '200' ){
print "Updated\n";
}
# print the result
print $client->responseContent() . "\n";
# to convert the data into a hash, use the JSON module
my $res_data = from_json( $client->responseContent() );
the input string something like this
{"fields": {
"project": {
"id": "10000"
},
"summary": "something's wrong",
"issuetype": {
"id": "10000"
},
"assignee": {
"name": "homer"
},
"priority": {
"id": "20000"
},
"labels": [
"bugfix",
"blitz_test"
],
"timetracking": {
"originalEstimate": "10",
"remainingEstimate": "5"
},
"security": {
"id": "10000"
},
"versions": [
{
"id": "10000"
}
],
"description": "description",
"duedate": "2011-03-11",
"fixVersions": [
{
"id": "10001"
}
],
"components": [
{
"id": "10000"
}
],
"customfield_60000": "jira-developers",
"customfield_20000": "06/Jul/11 3:25 PM",
"customfield_80000": {
"value": "red"
},
"customfield_40000": "this is a text field",
"customfield_30000": [
"10000",
"10002"
],
"customfield_70000": [
"jira-administrators",
"jira-users"
],
"customfield_50000": "this is a text area. big text.",
"customfield_10000": "09/Jun/81"
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.