Coder Social home page Coder Social logo

jiragitlabapi's Introduction

JiraGitLabAPI

Jira

Jira的API有多种认证方式,最简单的是用Basic Auth的方式,请参考
https://developer.atlassian.com/cloud/jira/platform/jira-rest-api-basic-authentication/
简单来说就是把用户名密码按user:password的方式做base64加密,然后设置在HTTP头部即可
node.js代码例

var request = require("request");
var jiraoptions ={ method: 'POST',
    url: 'http://jiurl:jiraport/rest/api/2/issue/'+issueid+'/transitions',
    headers: {'Content-Type': 'application/json',
        Authorization: 'Basic 加密后的user:password==' },
    body: { 请求主体 },
    json: true };
request(jiraoptions, function (error, response, body) {
    if (error) throw new Error(error);
    res.status(200).end();
});

API文档请参考
https://docs.atlassian.com/DAC/rest/jira/6.1.html#d2e1074

Gitlab

Gitlab可以使用private token的方式,token可以在settings->access token里发行,在HTTP请求头里加上'PRIVATE-TOKEN': 'access token'即可
node.js代码例

var request = require("request");
var options = {
        method: 'POST',
        url: 'http://gitlaburl:gitlabport/api/v4/projects/29/repository/branches',
        headers:{'PRIVATE-TOKEN': 'accesstoken'},
        formData: { 请求参数 };
request(options, function (error, response, body) {
    if (error) throw new Error(error);
});

API文档请参考
https://docs.gitlab.com/ee/api/README.html

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.