Skip to content

RESTful API For Product

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

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

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

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

{
    "products": {
        "product": [
            {
                "id": "p-bbfc8b5221d611e894b0000c298454d8",
                "name": "test",
                "description": "ad",
                "salt_master_url": "http://127.0.0.1:8000",
                "salt_master_user": "salt",
                "salt_master_password": "salt"
            },
            {
                "id": "p-c5008b0421d611e894b0000c298454d8",
                "name": "test_ok",
                "description": "ad",
                "salt_master_url": "http://127.0.0.1:8000",
                "salt_master_user": "saltapi",
                "salt_master_password": "saltapi"
            }
        ]
    }
}
添加产品
Request
POST /saltshaker/api/v1.0/product

POST Body
{
	"name":"test01",
	"description": "test",
	"salt_master_url": "http://127.0.0.1:8000",
	"salt_master_user": "saltapi",
	"salt_master_password": "saltapi"
}
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":"test01",
	"description": "test",
	"salt_master_url": "http://127.0.0.1:8000",
	"salt_master_user": "saltapi",
	"salt_master_password": "saltapi"
}
Response
HTTP/1.1 200 OK
Content-Type: application/json

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

Clone this wiki locally