chobie / jira-api-restclient

php JIRA REST API
MIT License
217 stars 123 forks source link

Support new JIRA Service Desk API #75

Closed shudder closed 8 years ago

shudder commented 8 years ago

Atlassian recently added API support for JIRA Service Desk. Would be great to have this covered.

https://developer.atlassian.com/blog/2016/01/new-JIRA-Service-Desk-and-JIRA-Software-REST-APIs/

aik099 commented 8 years ago

Are you talking about configurable API prefix? Right now we have /rest/api/2/ hardcoded in all API calls. The article you've mentioned talks about /rest/agile/1.0 and /rest/servicedeskapi/ prefixes.

If you're not mixing regular API calls with service desk ones, then setting a prefix once during initialization of an API client can be sufficient, but that in turn would break all existing calls, that expect /rest/api/2/ prefix.

Any specific idea how you want this to be implemented?

shudder commented 8 years ago

Well, making the prefix configurable on API client initialization would be sufficient for me specifically since I don't plan to mix /rest/servicedeskapi/ and /rest/api/2/. I don't really know whether this would make sense either since a Service Desk user should not have the privileges to access /rest/api/2/ and a regular JIRA user should not need to access /rest/servicedeskapi/ since all information should be available from /rest/api/2/ as well.

Not sure if I'm missing something, but this is how I would use it.

aik099 commented 8 years ago

Maybe you're more interested in adding nice wrapper methods (e.g. getRoleDetails) for Service Desk API calls instead? If that is ok, then you can send a PR with methods you need (no need to create all methods possible).

aik099 commented 8 years ago

Looking closely at Service Desk API document at https://docs.atlassian.com/jira-servicedesk/REST/latest/ I've found, that all API calls in there are marked as Experimental, which means, that:

Maybe instead:

  1. the $experimental = false parameter to the CurlClient and PHPClient classes
  2. store value of above given $experimental parameter as class property
  3. when making a request in sendRequest methods of above classes and experimental property is thrusy, then add X-ExperimentalApi : true header

When above is implemented (you can send a PR) then following construct will be possible:

$api = new \chobie\Jira\Api(
    "https://your-jira-project.net",
    new \chobie\Jira\Api\Authentication\Basic("yourname", "password"),
    new \chobie\Jira\Api\Client\CurlClient(true)
);

$result = $api->api(\chobie\Jira\Api::REQUEST_GET, '/rest/servicedeskapi/info');
shudder commented 8 years ago

As I'm not really sure whether or not some wrapper methods will work, let me just tell you what I'm up to. Basically, the plan is to replace the current JIRA Service Desk UI. I just don't like the way Atlassian done it and certain people doesn't either, even though the Service Desk functionalities are quite good. I'm going to have a closer look at the documentation. Thanks for your input.

aik099 commented 8 years ago

Good. Send PR, when you're ready.

benjivm commented 8 years ago

I am also looking for this integration so I don't have to start over or fork the project to replace the hardcoded URLs.

aik099 commented 8 years ago

Sure @gmask . If you have any ideas on how to make it usable, then please share.

aik099 commented 8 years ago

I am also looking for this integration so I don't have to start over or fork the project to replace the hardcoded URLs.

@gmask , the URL prefix is only hardcoded in Api class methods (e.g. updateVersion), that make API calls. The Api::api method isn't hardcoding anything so you can use it already.

@shudder , any update on PR?

aik099 commented 8 years ago

Closing due no activity for 2 months. Feel free to reopen if needed.