Code Monkey home page Code Monkey logo

module-jira's Introduction

Build Status

Ballerina JIRA Connector

This Ballerina client connector allows to connect to Atlassian JIRA, which provides bug tracking, issue tracking, and project management functions. It uses the JIRA REST API to connect to JIRA, work with JIRA projects, view and update issues, work with jira user accounts, and more. It also handles basic authentication, provides auto completion and type conversions.

Overview

Compatibility

Ballerina Version JIRA REST API Version
0.991.0 7.2.2

Why do you need the REST API for JIRA

The JIRA REST API is an ideal solution for the developers who want to integrate JIRA with other standalone or web applications, and administrators who want to script interactions with the JIRA server. Because the JIRA REST API is based on open standards, you can use any web development language to access the API.

The following sections provide information on how to use Ballerina JIRA Connector.

Getting started

  • Refer https://ballerina.io/learn/getting-started/ to download Ballerina and install tools.

  • Create a new Ballerina project by executing the following command.

    <PROJECT_ROOT_DIRECTORY>$ ballerina init

  • Import the jira module to your Ballerina program as follows.This will download the jira7 artifacts from the ballerina central to your local repository.

   import wso2/jira7;

Authentication

Note - JIRA’s REST API is protected by the same restrictions which are provided via JIRAs standard web interface. This means that if you do not have valid jira credentials, you are accessing JIRA anonymously. Furthermore, if you log in and do not have permission to view something in JIRA, you will not be able to view it using the Ballerina JIRA Connector as well.

Ballerina JIRA connector currently provides basic authentication as the authentication method.
Please follow the following steps to authenticate your connector.

  • Obtain your JIRA user account credentials(username and password). If you currently dont have a JIRA account, you can create a new JIRA account from JIRA Sign-Up Page.

  • Provide the credentials to your endpoint in the initialization step, as shown in the following sample code.

import ballerina/http;
import wso2/jira7;

//Creation of connector endpoint
jira7:JiraConfiguration jiraConfig = {
    baseUrl: config:getAsString("test_url"),
    clientConfig: {
        auth: {
            scheme: http:BASIC_AUTH,
            config: {
                username: config:getAsString("test_username"),
                password: config:getAsString("test_password")
            }
        }
    }
};

jira7:Client jiraConnectorEP = new(jiraConfig);

Working with JIRA connector actions

All actions of the JIRA connector return either the response or an error.

If a action was successfull, then the requested struct object or boolean true response will be returned or otherwise will returns an Connector error with error message,error type and cause.

Example

  • Request
import ballerina/http;
import ballerina/io;
import wso2/jira7;

// Create the jira client.
jira7:JiraConfiguration jiraConfig = {
    baseUrl: config:getAsString("test_url"),
    clientConfig: {
        auth: {
            scheme: http:BASIC_AUTH,
            config: {
                username: config:getAsString("test_username"),
                password: config:getAsString("test_password")
            }
        }
    }
};

jira7:Client jiraClient = new(jiraConfig);

public function main(string... args) {

    string projectKey = "RRDEVSPRT";

    var output = jiraClient->getProject(projectKey);
    if (output is jira7:Project) {
        io:println("Project Details: ", output);
    } else {
        io:println("Error: ", output.message);
    }
}
  • Response Object
public type Project record {
    string self;
    string id;
    string key;
    string name;
    string description;
    string leadName;
    string projectTypeKey;
    AvatarUrls avatarUrls;
    ProjectCategory projectCategory;
    IssueType[] issueTypes;
    ProjectComponentSummary[] components;
    ProjectVersion[] versions;
}

Now that you have basic knowledge about to how Ballerina JIRA endpoint works, use the information in the following sections to perform various operations with the endpoint.


Working with Projects in JIRA


API Reference

  • getAllProjectSummaries()
  • getAllDetailsFromProjectSummary()
  • getProject()
  • createProject()
  • updateProject()
  • deleteProject()
  • getLeadUserDetailsOfProject()
  • getRoleDetailsOfProject()
  • addUserToRoleOfProject()
  • addGroupToRoleOfProject()
  • removeUserFromRoleOfProject()
  • removeGroupFromRoleOfProject()
  • getAllIssueTypeStatusesOfProject()
  • changeTypeOfProject()

Working with Project Categories in JIRA


API Reference

  • getAllProjectCategories()
  • createProjectCategory()
  • getProjectCategory()
  • deleteProjectCategory()

Working with Project Components in JIRA


API Reference

  • createProjectComponent()
  • getProjectComponent()
  • deleteProjectComponent()
  • getAssigneeUserDetailsOfProjectComponent()
  • getLeadUserDetailsOfProjectComponent()

Working with Issues in JIRA


API Reference

  • createIssue()
  • updateIssue()
  • deleteIssue()

module-jira's People

Contributors

anupama-pathirage avatar bhashinee avatar biruntha avatar chamil321 avatar copenat avatar dushaniw avatar kalaiyarasiganeshalingam avatar keerthu avatar keizer619 avatar kesavany avatar ldclakmal avatar maheshika avatar manuri avatar maryamzi avatar megala21 avatar muthulee avatar nipunaranasinghe avatar rosensilva avatar vijithaekanayake avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.