供应商
供应商查询接口
根据关键字(支持供应商的名称和编号的查询),得到与之匹配的供应商。
curl -i "http://example.com/api/suppliers/query.json"
请求返回JSON数据:
{
"status": {
"code": "200",
"message": "OK"
},
"suppliers": [
{
"id": 1,
"name": "Fluffums",
"number": "S0001",
"category": "经销商",
"balance": 1000.0
},
{
"id": 2,
"name": "Max",
"number": "S0002",
"category": "代理商",
"balance": 0.0
}
]
}
HTTP 请求
GET http://example.com/api/suppliers/query.json
请求参数
参数名 | 是否必须 | 说明 |
---|---|---|
keyword | 必须 | 根据用户输入的关键字,得到相关供应商列表 |
- 返回字段说明
返回值字段 | 字段类型 | 说明 |
---|---|---|
id | integer | 供应商ID |
name | string | 供应商名称 |
number | string | 供应商编号 |
category | string | 供应商类型 |
balance | decimal | 应付款余额 |
供应商详情
根据供应商ID,获取供应商详细信息。
curl -i "http://example.com/api/suppliers/:id.json"
{
"status": {
"code": "200",
"message": "OK"
},
"supplier": {
"id": 1,
"name": "Fluffums",
"number": "S0001",
"category": "经销商",
"default_amount": 500.0,
"balance": 1000.0,
"contacts": [
{
"name": "张经理",
"phone": "021-22839823",
"mobile": "13928399382",
"address": "上海市虹口区嘉兴路267号",
"note": "客户经理",
"is_primary" : true
},
{
"name": "刘经理",
"phone": "021-22839823",
"mobile": "13928399382",
"address": "上海市虹口区嘉兴路264号",
"note": "渠道经理",
"is_primary" : false
}
]
}
}
HTTP 请求
GET http://example.com/api/suppliers/:id.json
请求参数
参数名 | 是否必须 | 说明 |
---|---|---|
id | 必须 | 供应商ID |
- 返回字段说明
返回值字段 | 字段类型 | 说明 |
---|---|---|
id | integer | 供应商ID |
name | string | 供应商名称 |
number | string | 供应商编号 |
category | string | 供应商类型 |
default_amount | decimal | 期初应付款金额 |
balance | decimal | 应付款余额 |
contacts/name | string | 联系人姓名 |
contacts/phone | string | 联系人电话 |
contacts/mobile | string | 联系人手机 |
contacts/address | string | 联系人地址 |
contacts/note | string | 备注 |
contacts/is_primary | boolean | 是否主要联系人 |
创建供应商
根据提供的数据,创建供应商。
curl -i -X "http://example.com/api/suppliers.json"
{
"id": 1,
"name": "Fluffums",
"number": "S0001",
"category": "经销商",
"default_amount": 500.0,
"balance": 1000.0
}
HTTP 请求
POST http://example.com/api/suppliers.json
请求参数
参数名 | 是否必须 | 说明 |
---|---|---|
number | 必须 | 供应商ID |
name | 必须 | 名称 |
category | 必须 | 类型 |
assignee | 必须 | 负责人 |
default_amount | 必须 | 期初应付款金额 |
note | 不必须 | 备注 |
contact_attributes/name | string | 联系人姓名 |
contact_attributes/mobile | string | 联系人手机 |
contact_attributes/is_primary | boolean | 是否主要联系人 |
contact_attributes/phone | string | 联系人电话 |
contact_attributes/address | string | 联系人地址 |
contact_attributes/note | string | 备注 |
- 返回字段说明
返回值字段 | 字段类型 | 说明 |
---|---|---|
id | integer | 供应商ID |
name | string | 供应商名称 |
number | string | 供应商编号 |
category | string | 供应商类型 |
default_amount | decimal | 期初应付款金额 |
balance | decimal | 应付款余额 |
编辑供应商
根据提供的数据,创建供应商。
curl -i -X "http://example.com/api/suppliers/ID.json"
{
"id": 1,
"name": "Fluffums",
"number": "S0001",
"category": "经销商",
"default_amount": 500.0,
"balance": 1000.0
}
HTTP 请求
PUT http://example.com/api/suppliers/ID.json
请求参数
参数名 | 是否必须 | 说明 |
---|---|---|
number | 必须 | 供应商ID |
name | 必须 | 名称 |
category | 必须 | 类型 |
assignee_id | 必须 | 负责人 |
default_amount | 必须 | 期初应付款金额 |
note | 不必须 | 备注 |
contact_attributes/name | string | 联系人姓名 |
contact_attributes/mobile | string | 联系人手机 |
contact_attributes/is_primary | boolean | 是否主要联系人 |
contact_attributes/phone | string | 联系人电话 |
contact_attributes/address | string | 联系人地址 |
contact_attributes/note | string | 备注 |
- 返回字段说明
返回值字段 | 字段类型 | 说明 |
---|---|---|
id | integer | 供应商ID |
name | string | 供应商名称 |
number | string | 供应商编号 |
category | string | 供应商类型 |
default_amount | decimal | 期初应付款金额 |
balance | decimal | 应付款余额 |
文档更新时间: 2025-03-17 14:52 作者:姜河