Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Create Jira Project using PHP client

Steve Owen January 13, 2013

I am looking for a code example of creating a Jira Project using SOAP and PHP.

Thank you.

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

4 votes
Answer accepted
OmarA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 13, 2013

Hi Steve,

I have created this PHP code somewhile ago to fetch some projects from JIRA, you may change the URL and the request type to add new issues :

<?php

$username = 'test';
$password = 'test';
 
$url = "https://xxxxx.xxxxxxx.net/rest/api/2/project";
$ch = curl_init();
 
$headers = array(
    'Accept: application/json',
    'Content-Type: application/json'
);
 
$test = "This is the content of the custom field.";
 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
//curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
 
$result = curl_exec($ch);
$ch_error = curl_error($ch);
 
if ($ch_error) {
    echo "cURL Error: $ch_error";
} else {
    echo $result;
}
 
curl_close($ch);

?>

Please look here for more information regarding REST API:

http://docs.atlassian.com/jira/REST/latest/

Cheers,

Omar

Steve Owen January 13, 2013

Tks for the example Omar, but I was looking for a method to add a new Project, not an issue.

vibha jadwani October 31, 2014

Thanks.. It helped me a lot...

2 votes
Rachel Smith April 7, 2013

<?php
$admin = 'username';
$password = 'password';
$soapClient = new SoapClient('http://urlhere:8080/rpc/soap/jirasoapservice-v2?wsdl');
$token = $soapClient->login($admin,$password);

try{

            $soapClient->createProject($token, 'KEY' , 'projectname' , 'Description' , 'URL' , 'lead',  array('id' =>'permission scheme id'), array('id' =>'notification sheme id') );


        }
        catch(Exception $ex){

            die('JIRA add Project failed: ' . $ex->getMessage());
        }

0 votes
Ravikiran Annaswamy February 10, 2015

Hi Steve, Did you find a method to create Jira Project using php with curl or http-streams?

0 votes
Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 13, 2013

If you look hard enough, you find this method:

RemoteProject createProject(java.lang.String token,

java.lang.String key,

java.lang.String name,

java.lang.String description,

java.lang.String url,

java.lang.String lead,

RemotePermissionScheme permissionScheme,

RemoteScheme notificationScheme,

RemoteScheme issueSecurityScheme)

Steve Owen January 13, 2013

Tks for your reply Timothy. I did find that method in the API documentation. I am looking for an example of how to implement it with PHP. Perhaps someone has PHP code to share as an example.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events