JIRA API Introduction

Agenda

  1. Basic Introduction

  2. Common Resources

  3. Practicing with Postman

  4. Practicing in JS

Basic Introduction

Authentication

curl -D- -X GET -H "Authorization: Basic ZnJlZDpmcmVk" -H "Content-Type: application/json" "https://example.com:8081/rest/api/2/issue/QA-31"

URI Structure

  • Provide access to resouces via URI path
  • HTTP Request
    • GET
    • PUT
    • POST
    • DELETE
  • JSON

Expansion

https://jira.atlassian.com/rest/api/latest/issue/JRA-9?expand=names,renderedFields
{
    "expand": "widgets",
    "self": "http://www.example.com/jira/rest/api/resource/KEY-1",
    "widgets": {
        "widgets": [],
        "size": 5
    }
}

Pagination

 {
        "startAt" : 0,
        "maxResults" : 10,
        "total": 200,
        "values": [
            { /* result 0 */ },
            { /* result 1 */ },
            { /* result 2 */ }
        ]
    }

JIRA uses pagination to limit the response size for resources that return a potentially large collection of items. A request to a paged API will result in a values array wrapped in a JSON object with some paging metadata, for example:

Ordering

?orderBy=name
//Order by "name" ascending
?orderBy=+name
//Order by "name" ascending
?orderBy=-name
//Order by "name" descendin

Common Resources

api/2/filter

api/2/issue

Adv of API

Fast

Recurring

Massive

Integration

Practicing with Postman

Practicing with JS

References

Thank you and Questions?

JIRA API Introduction

By Shawn Shao

JIRA API Introduction

  • 540