Closed benjivm closed 7 years ago
There is no shortcut method for that, but you can easily make necessary call yourself like so:
use chobie\Jira\Api;
$api = new ...Api(...);
$result = $api->api(
Api:: REQUEST_POST,
'/rest/api/2/project',
array(...)
);
@aik099 Thanks, I believe I did something similar using Guzzle, I was not aware that invoking the $api>api() method would allow me to interact directly with all available JIRA REST API functionality, that's cool.
Here's what I did with Guzzle, though I am going to refactor to your solution:
$client = new GuzzleHttp\Client([
'base_uri' => config('app.jira_url'),
'auth' => [
'username',
'password',
],
]);
$properties = json_encode([
'key' => $project_key,
'name' => $name,
'projectTypeKey' => 'software',
'description' => $description,
'lead' => 'daves',
'assigneeType' => 'UNASSIGNED',
]);
return $client->request('POST', '/rest/project-templates/1.0/createshared/10331', [
'headers' => ['Content-Type' => 'application/json', 'Accept' => 'application/json'],
'body' => $properties,
]);
If you'd like you can submit a PR with new createProject
method and tests for it.
Is it possible to create a new project using this package? I can't seem to find a method to do so anywhere.