Extend your use of JIRA.
Solve your unique concerns.
An exposé of the new JIRA 5 REST API


Abhinav Keswani // @wasabhi
Principal, Bespoke Solutions // trineo.com.au // @trineoltd
What lies ahead?
• JIRA 5 REST API
 • Structure, Authentication, and Entity Expansion

• Remote Apps: Key concepts.
• How to begin? Useful resources.
• In the wild: Use cases and examples of web apps.
REST
(an extremely brief overview)
Representational State Transfer
Representational State Transfer
• Client/Server requests/responses are to facilitate the
  transfer of representations of resources.
Representational State Transfer
• Client/Server requests/responses are to facilitate the
  transfer of representations of resources.
• Resources are sources of specific information with a
  unique identifier.
Representational State Transfer
• Client/Server requests/responses are to facilitate the
  transfer of representations of resources.
• Resources are sources of specific information with a
  unique identifier.
• Uniform interface; identify/manipulate resources, self
  descriptive messages, hypermedia used for application
  state.
Hearing @wasabhi talk about the JIRA 5 REST API -
a uniform interface for extensive integration.




     #summit12
JIRA 5 REST API
Resources
ASSIGNEE

 COMMENT

VOTES         ISSUE
WATCHERS

   WORKLOG
ASSIGNEE

 COMMENT

VOTES         ISSUE
WATCHERS

   WORKLOG
                           COMPONENTS
                 PROJECT   VERSIONS
ASSIGNEE

        COMMENT

       VOTES         ISSUE
       WATCHERS


USER      WORKLOG
                                  COMPONENTS
                        PROJECT   VERSIONS
ASSIGNEE
SEARCH    COMMENT

         VOTES         ISSUE
         WATCHERS


USER        WORKLOG
                                    COMPONENTS
                          PROJECT   VERSIONS
ASSIGNEE
SEARCH    COMMENT

         VOTES         ISSUE   FILTER
         WATCHERS


USER        WORKLOG
                                    COMPONENTS
                          PROJECT   VERSIONS
FIELD
            ASSIGNEE
SEARCH    COMMENT

         VOTES         ISSUE       FILTER
         WATCHERS


USER        WORKLOG
                                       COMPONENTS
                          PROJECT      VERSIONS
REST URI Structure
REST URI Structure
http://host:port/context/rest/api-name/api-version/resource-name
REST URI Structure
http://host:port/context/rest/api-name/api-version/resource-name

  http://example.com:8080/jira/rest/api/2/issue [POST]
REST URI Structure
http://host:port/context/rest/api-name/api-version/resource-name

  http://example.com:8080/jira/rest/api/2/issue [POST]
  http://example.com:8080/jira/rest/api/2/issue/{issueIdOrKey} [GET, DELETE, PUT]
REST URI Structure
http://host:port/context/rest/api-name/api-version/resource-name

  http://example.com:8080/jira/rest/api/2/issue [POST]
  http://example.com:8080/jira/rest/api/2/issue/{issueIdOrKey} [GET, DELETE, PUT]
  http://example.com:8080/jira/rest/api/2/issue/{issueIdOrKey}/assignee [PUT]
REST URI Structure
http://host:port/context/rest/api-name/api-version/resource-name

  http://example.com:8080/jira/rest/api/2/issue [POST]
  http://example.com:8080/jira/rest/api/2/issue/{issueIdOrKey} [GET, DELETE, PUT]
  http://example.com:8080/jira/rest/api/2/issue/{issueIdOrKey}/assignee [PUT]
  http://example.com:8080/jira/rest/api/2/issue/{issueIdOrKey}/comments [GET, POST]
REST URI Structure
http://host:port/context/rest/api-name/api-version/resource-name

  http://example.com:8080/jira/rest/api/2/issue [POST]
  http://example.com:8080/jira/rest/api/2/issue/{issueIdOrKey} [GET, DELETE, PUT]
  http://example.com:8080/jira/rest/api/2/issue/{issueIdOrKey}/assignee [PUT]
  http://example.com:8080/jira/rest/api/2/issue/{issueIdOrKey}/comments [GET, POST]
  http://example.com:8080/jira/rest/api/2/issue/{issueIdOrKey}/comment/{id} [GET, PUT, DELETE]
Authentication
                 HTTP BASIC (SSL)
                        OAUTH
                        ...and...
HTTP Cookies, Trusted Applications, OS Username & Password
Response Notation


     JSON
OAuth (1.0a)
Your app is the “Consumer”.

     JIRA is the “Service Provider”.

    You must register your app as an
“application link”, which can be identified
 by JIRA using a “consumer key”, and a
      public key (x509 RSA-SHA1).
• You request a token from the service provider.
• Do this by presenting a signed request including
  your consumer key.

Consumer.                          Service Provider

   Request                               Grant
 Request Token                        Request Token
• The service provider grants you a request token.
• The token does not authorize you yet.
• The end user must authenticate with the service
  provider and authorize access for the consumer.

 Consumer.                         Service Provider

Direct End User to                        Obtain
 Service Provider                    User Authorization




                                      Direct End User
                                       To Consumer
• The end user authorized Consumer access, and the
    Consumer was presented with an oauth token.
•   Use the oauth token to request an access token
    from the Service Provider.
  Consumer.                         Service Provider

      Request                             Grant
    Access Token                       Access Token



       Access
Protected Resources
Entity Expansion
Entity Expansion


The expand query parameter allows a comma-separated
list of identifiers to expand.

The motivation is to save CPU and network traffic.
Entity Expansion

Specify expansion of entities within another entity using
dot notation. For example

              ?expand=starships.warp

expands the starships collection and also the warp
property on each starship.
remoteapps
Remoteapps Key Concepts

A Remote App is a web application that
runs outside the Atlassian application, and
yet is accessible by it.
Remoteapps Key Concepts
As a result, no code is executed on the
Atlassian application, but instead, content
from the Remote App is included in
Atlassian application pages or rendering
processes.
Remoteapps Key Concepts
In the other direction, a Remote App can
subscribe to key events via web hooks to
enable more complex workflow
integrations.
Remoteapps Key Concepts

Communication to and from the Remote
App is secured through OAuth.
Remoteapps Key Concepts
Remote Apps can be written in any
application language and deployed on any
server, as long as it is reachable from the
Atlassian application over web protocols.
Key Concepts
   ★ Secure
   ★ You are in control of
     ★ form and function
     ★ performance and scale
   ★ Bi directional communication yields
     superb efficient result
Go learn more ...

Don Brown: Plugins OnDemand
with RemoteApps.

            ...tomorrow 11:20-12:00
Useful Resources
Choose your weapon.
• Customise your integration. CLI or Web usage.
 • JIRA Java REST Client (JRJC)
 • JIRA Ruby Gem
 • Python CLI for JIRA
 • JIRA Issue Collector (JavaScript)
Go learn more ...

Ben Speakmon: JIRA REST Client
for Python.

           ...tomorrow 14:50-15:00
Oodles of great docs...
Quick look at the Ruby gem.
In The Wild
JIRA on Ruby Console
JIRA on Rails
Thanks @wizzfiz for letting @wasabhi come out to
play!




        #summit12
Documentation
https://developer.atlassian.com/static/rest/jira/5.0.html
https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API
+Tutorials
https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API
+Example+-+OAuth+authentication
https://developer.atlassian.com/display/REST/REST+API
+Developer+Documentation
http://www.25hoursaday.com/weblog/2008/08/17/
ExplainingRESTToDamienKatz.aspx
Thank you!

Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New JIRA 5 REST API

Editor's Notes

  • #2 \n
  • #3 Quick intro to Abhinav. Mention Trineo (nothing OTT).\n
  • #4 Quick intro to the talk.\n
  • #5 This slide can be used to break up the chapters of your talk - this would be the start to a new chapter\n- OR -\nThis could be used for making a single statement of a few words or a sentence.\n\nYou should choose one or the other, so that there’s a consistent system.\n
  • #6 Move fast through this, and illustrate the reason why REST is well loved today.\nAll resources share a uniform interface.\n
  • #7 Move fast through this, and illustrate the reason why REST is well loved today.\nAll resources share a uniform interface.\n
  • #8 Move fast through this, and illustrate the reason why REST is well loved today.\nAll resources share a uniform interface.\n
  • #9 this can be used for key ideas that you want people to tweet\n
  • #10 \n
  • #11 \n
  • #12 Quickly illustrate how the well known data within JIRA can be accessed via the API.\n
  • #13 Quickly illustrate how the well known data within JIRA can be accessed via the API.\n
  • #14 Quickly illustrate how the well known data within JIRA can be accessed via the API.\n
  • #15 Quickly illustrate how the well known data within JIRA can be accessed via the API.\n
  • #16 Quickly illustrate how the well known data within JIRA can be accessed via the API.\n
  • #17 Quickly illustrate how the well known data within JIRA can be accessed via the API.\n
  • #18 Expand on the HTTP verbs as well as illustrate the uniform interface.\n
  • #19 Expand on the HTTP verbs as well as illustrate the uniform interface.\n
  • #20 Expand on the HTTP verbs as well as illustrate the uniform interface.\n
  • #21 Expand on the HTTP verbs as well as illustrate the uniform interface.\n
  • #22 Expand on the HTTP verbs as well as illustrate the uniform interface.\n
  • #23 Expand on the HTTP verbs as well as illustrate the uniform interface.\n
  • #24 Will elaborate on cookies in particular apart from the preferred http-basic and oauth approaches. Will point out the nice Rich Manalang oauth dance examples repo.\n
  • #25 Will elaborate on cookies in particular apart from the preferred http-basic and oauth approaches. Will point out the nice Rich Manalang oauth dance examples repo.\n
  • #26 \n
  • #27 oauth basics - important to cover this\n
  • #28 oauth basics - important to cover this\n
  • #29 oauth basics - important to cover this\n
  • #30 oauth basics - important to cover this\n
  • #31 \n
  • #32 \n
  • #33 \n
  • #34 \n
  • #35 \n
  • #36 \n
  • #37 \n
  • #38 \n
  • #39 \n
  • #40 Just meditating on what else I should cover...not sure whether I want to launch into the JIRA REST Browser here, or subsequently in the “useful resources” section. Either way I would like to show JSON representations, some auth patterns.\n
  • #41 Just meditating on what else I should cover...not sure whether I want to launch into the JIRA REST Browser here, or subsequently in the “useful resources” section. Either way I would like to show JSON representations, some auth patterns.\n
  • #42 \n
  • #43 \n
  • #44 Just meditating on what else I should cover...not sure whether I want to launch into the JIRA REST Browser here, or subsequently in the “useful resources” section. Either way I would like to show JSON representations, some auth patterns.\n
  • #45 Flip over to my browser to show great docs on Atlassian developer site, docs site, and studio for JRJC.\n
  • #46 Browse to the Trineo Ruby gem to flick through the README quickly.\n
  • #47 \n
  • #48 WIP. Not showing code, perhaps will show the console connecting to a locally running instance of JIRA. Follow the README in the Trineo gem repo.\n\n
  • #49 WIP. Not showing code, perhaps will show the console connecting to a locally running instance of JIRA. Follow the README in the Trineo gem repo.\n\n
  • #50 this can be used for key ideas that you want people to tweet\n
  • #51 WIP. Idea is to show adding comments to an existing issue in JIRA using conversational theming (speech bubbles). Here’s one I prepared earlier ...\n
  • #52 fin\n