Skip to content

RESTful API For Product

Echo edited this page Mar 9, 2019 · 7 revisions
获取指定产品信息
Request
GET /saltshaker/api/v1.0/product/p-ac5c74c821d611e894b0000c298454d8

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

{
    "data": {
        "id": "p-ac5c74c821d611e894b0000c298454d8",
        "name": "test",
        "description": "test",
        "salt_master_url": "http://10.10.10.10:8000",
        "salt_master_user": "salt",
        "salt_master_password": "salt"
    },
    "status": true,
    "message": ""
}
获取产品列表
Request
GET /saltshaker/api/v1.0/product

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

{
    "data": [
            {
                "id": "p-b4aaef1e322611e8ab56000c298454d8",
                "name": "test",
                "email": "",
                "project": "test",
                "password": "",
                "gitlab_url": "http://test.com.cn",
                "api_version": "3",
                "description": "test",
                "oauth_token": "",
                "http_password": "",
                "http_username": "",
                "private_token": "oKi5YVj1Ji6ifffvsy_H",
                "salt_master_url": "http://127.0.0.1:8000",
                "salt_master_user": "saltapi",
                "salt_master_password": "saltapi"
            },
            {
                "id": "p-1dead8ee322811e8ab56000c298454d8",
                "name": "fffff",
                "email": "",
                "project": "",
                "password": "",
                "gitlab_url": "",
                "api_version": "",
                "description": "fff",
                "oauth_token": "",
                "http_password": "",
                "http_username": "",
                "private_token": "",
                "salt_master_url": "http://10.10.10.10:8000",
                "salt_master_user": "saltapi",
                "salt_master_password": "saltshaker"
            }
        ]
    "status": true,
    "message": ""
}
添加产品 GitLab >= 9.0 api_version 请填 4 否则请填 3
Request
POST /saltshaker/api/v1.0/product

POST Body
{
    "name": "test",
    "description": "test",
    "salt_master_url": "http://127.0.0.1:8000",
    "salt_master_user": "saltapi",
    "salt_master_password": "saltapi",
    "gitlab_url": "http://test.com.cn",
    "private_token": "oKi5YVj5rr1Ji6ivsy_H",
    "http_password": "",
    "oauth_token": "",
    "email": "",
    "password": "",
    "http_username": "",
    "http_password": "",
    "project":"test",
    "api_version":3
    
}
Response
HTTP/1.1 200 OK
Content-Type: application/json

{
    "status": true,
    "message": ""
}
删除产品
Request
DELETE /saltshaker/api/v1.0/product/p-72f9c9c82b2311e886cb000c298454d8

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

{
    "status": true,
    "message": ""
}
修改产品
Request
PUT /saltshaker/api/v1.0/product/p-72f9c9c82b2311e886cb000c298454d8

PUT Body
{
    "name": "test",
    "description": "test",
    "salt_master_url": "http://127.0.0.1:8000",
    "salt_master_user": "saltapi",
    "salt_master_password": "saltapi",
    "gitlab_url": "http://test.com.cn",
    "private_token": "oKi5YVj5rr1Ji6ivsy_H",
    "http_password": "",
    "oauth_token": "",
    "email": "",
    "password": "",
    "http_username": "",
    "http_password": "",
    "project":"test",
    "api_version":3
    
}
Response
HTTP/1.1 200 OK
Content-Type: application/json

{
    "status": true,
    "message": ""
}
检查salt api 及gitlab api的可用性
Request
GET /saltshaker/api/v1.0/product/check/{salt_api|gitlab_api}

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

{
    "data": {},
    "status": true,
    "message": ""
}