I want to user Jira API.
Here is what I did:
first I searched for some php api frameworks and I found one:
https://github.com/lesstif/php-jira-rest-client
Then I installed on my localhost on mac jira (7.9.2)
All works fine and I made one project and it is called TEST
if I loggin and go in the browser with this url: http://localhost:8080/rest/api/2/project/TEST works perfect, I get the json back.
Ok then I go and try to do it with php framework https://github.com/lesstif/php-jira-rest-client and nothing al the time access denied.
Then I tried to go with cloud version and still same authorized 401.
I made issue on they github account and here is the link, maybe you will know the answer:
https://github.com/lesstif/php-jira-rest-client/issues/153
It is frustrating that I get no access :( so any idea would be helpfull
thank you all
Please post your code snippet and we will be able to help!
library that is used is: https://github.com/lesstif/php-jira-rest-client
class Jira extends Controller
{
private $jiraHost;
private $jiraUsername;
private $jiraPassword;
private $config;
/**
* @Route("/", name="devops_jira")
*/
public function index()
{
$this->jira_auth();
var_dump($this->config);
try {
$proj = new ProjectService($this->config);
$prjs = $proj->getAllProjects();
var_dump($prjs);
foreach ($prjs as $p) {
echo sprintf("Project Key:%s, Id:%s, Name:%s, projectCategory: %s\n",
$p->key, $p->id, $p->name, $p->projectCategory['name']
);
}
} catch (JiraException $e) {
print("Error Occured! " . $e->getMessage());
}
return new Response('');
}
public function jira_auth()
{
$user = $this->getUser();
$this->jiraHost = $user->getJiraHost();
$this->jiraUsername = $user->getJiraUsername();
$this->jiraPassword = $user->getJiraPassword();
$this->config = new ArrayConfiguration(
array(
'jiraHost' => 'https://username.atlassian.net',//$this->jiraHost,
// for basic authorization:
'jiraUser' => $this->jiraUsername,
'jiraPassword' => 'api token',//$this->jiraPassword,
// to enable session cookie authorization (with basic authorization only)
///'cookieAuthEnabled' => true,
'jiraLogFile' => 'DEBUG',
//'curlOptSslVerifyHost' => true
)
);
}
}
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.