Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an example of issue creation #44

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 5 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,10 @@
# Jira Api Rest Client
# Jira Api Rest Client (Forked)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert changes to this file.


[![Build Status](https://secure.travis-ci.org/chobie/jira-api-restclient.png)](http://travis-ci.org/chobie/jira-api-restclient)
For usage, example and licence please see the original README : https://github.com/chobie/jira-api-restclient/blob/master/README.md

## Improvements

you know JIRA5 supports REST API. this is very useful to make some custom notifications and automated jobs.
(JIRA also supports email notification, but it's too much to custom templates, notification timing. unfortunately it requires Administration permission.)
this API library will help your problems regarding JIRA. hope you enjoy it.
* Curl Driver : Enable support for file upload (PHP >= 5.6)
* New example for Issue creation

# Usage

composer.json

```
composer require chobie/jira-api-restclient 2.0.*
```


````php
<?php
$api = new chobie\Jira\Api(
"https://your-jira-project.net",
new chobie\Jira\Api\Authentication\Basic("yourname", "password")
);

$walker = new chobie\Jira\Issues\Walker($api);
$walker->push("project = YOURPROJECT AND (status != closed and status != resolved) ORDER BY priority DESC");
foreach ($walker as $issue) {
var_dump($issue);
// send custom notification here.
}
````

# License

MIT License

# JIRA5 Rest API Documents

https://developer.atlassian.com/static/rest/jira/6.0.html
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert changes to this file.

"name": "chobie/jira-api-restclient",
"description": "JIRA REST API.",
"name": "t-keller/jira-api-restclient",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To use your fork instead of original package you need to specify this in your composer.json file:

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/t-keller/jira-api-restclient"
    }
],

"description": "Jira REST API Wrapper",
"keywords": ["jira","rest","api"],
"type": "library",
"license": "MIT",
Expand All @@ -9,6 +9,10 @@
"name": "Shuhei Tanuma",
"homepage": "http://chobie.github.io/",
"email": "[email protected]"
},
{
"name": "Thomas Keller",
"homepage": "https://github.com/t-keller"
}
],
"minimum-stability": "dev",
Expand Down
7 changes: 7 additions & 0 deletions examples/create_issue.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
require dirname(__FILE__) ."/common.php";

$api = getApiClient();
$api->createIssue('<Projet Key>', '<Summary>', '<Task Type Id>', array(
'description' => '<Issue Description>'
));
1 change: 1 addition & 0 deletions src/Jira/Api/Client/CurlClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public function sendRequest($method, $url, $data = array(), $endpoint, Authentic
if ($method == "POST") {
curl_setopt($curl, CURLOPT_POST, 1);
if ($isFile) {
curl_setopt($curl, CURLOPT_SAFE_UPLOAD, false);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would result in an error prior PHP 5.5, where this option was added. Please remove from this PR.

This was fixed in #52 .

curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
} else {
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
Expand Down