dylanw3000
dylanw3000

Reputation: 38

REST Access Project Information from Different Server PHP

I am able to access my company's dashboards from JIRA's REST api by calling:

<pre>
<?php
    $array = file('https://jira.COMPANYNAME.com/rest/api/2/dashboard');
    $api = json_decode($array[0], true);
    print_r($api['dashboards']);
?>
<pre>

This shows me a nice list of our dashboards and their relevant data. However, when I try to call it as /rest/api/2/project, it returns '[]' to my web page whereas in my browser I have a complete list. Attempting to go deeper (by requesting to look in a specific project ID) returns a 404 error to the server.

I am aware JIRA is able to tell that my browser is logged in whereas the server making the request is not. However, I can not for the life of me figure out how to grant access to my server. All I require is that the server is allowed to do:

<?php
    $array = file('https://jira.COMPANYNAME.com/rest/api/2/project');
?>

A user account can be hard-coded in for this, as my company wishes to use a dummy account that can look at all projects, even those that a given employee personally does not have access to. If it needs to scale up eventually we can do that, but it will only work if we can access the tools in the first place.

Upvotes: 2

Views: 61

Answers (1)

Related Questions