Skip to content

RESTful API For GitLab

Echo edited this page Apr 12, 2018 · 5 revisions
获取指定产品GitLab项目分支 项目类型(state_project, pillar_project)
Request
GET /saltshaker/api/v1.0/gitlab/branch?product_id=p-b4aaef1e322611e8ab56000c298454d8&project_type=state_project

Response
HTTP/1.1 200 OK
Content-Type: application/json

{
    "branchs": {
        "branch": [
            "dev",
            "master"
        ]
    },
    "status": true,
    "message": ""
}
获取指定产品GitLab项目文件及目录 path为目录结构如: a/b/c , branch为分支名
Request
GET /saltshaker/api/v1.0/gitlab/file?product_id=p-b4aaef1e322611e8ab56000c298454d8&path=vip&branch=master&project_type=state_project

Response
HTTP/1.1 200 OK
Content-Type: application/json

{
    "files": {
        "file": [
            {
                "name": "migrations",
                "type": "tree"
            },
            {
                "name": "__init__.py",
                "type": "blob"
            },
            {
                "name": "admin.py",
                "type": "blob"
            },
            {
                "name": "models.py",
                "type": "blob"
            },
            {
                "name": "tests.py",
                "type": "blob"
            },
            {
                "name": "urls.py",
                "type": "blob"
            },
            {
                "name": "views.py",
                "type": "blob"
            }
        ]
    },
    "status": true,
    "message": ""
}
获取指定产品GitLab项目文件内容 path为文件路径如: a/b/c.py , branch为分支名
Request
GET /saltshaker/api/v1.0/gitlab/content?product_id=p-b4aaef1e322611e8ab56000c298454d8&path=common/views.py&branch=master&project_type=pillar_project

Response
HTTP/1.1 200 OK
Content-Type: application/json

{
    "content": "# -*- coding:utf-8 -*-\nfrom django.shortcuts import render\n",
    "status": true,
    "message": ""
}

Clone this wiki locally