# 同步成本中心

# 简介

同步成本中心,支持新增、更新及删除,更新时需携带新增时返回的唯一标识

# 服务提供方

享道

# 接口URL

/openapi/ent/costcenter/add

# 请求方式

POST

# 请求频次

单次

# 请求参数

参数名称 类型 必选 说明
timestamp long 请求时间,Unix Timestamp单位毫秒
ent_id string 企业唯一标识
costcenters list 成本中心信息
costcenters[].cost_center_id string 成本中心唯一标识,更新时必传
costcenters[].cost_center_name string 成本中心名称
costcenters[].outer_cost_center_id string 合作方成本中心唯一标识
costcenters[].date_limit int 有效期限制 0-不限制 1-限制
costcenters[].start_date string 有效期开始
costcenters[].end_date string 有效期结束
costcenters[].quota_type int 额度类型 1-月额度 2-总额度
costcenters[].quota_amount long 额度,单位分
costcenters[].quota_limit int 额度限制 0-不限制 1-限制
costcenters[].is_del string 是否删除 0-否 1-是

# 响应参数

参数名称 类型 必有 说明
retCode int 服务响应状态,参见附录5
retMsg string 服务响应状态说明,参见附录5
content object 响应内容
content.results list 所有同步结果
content.results[].success boolean 是否成功
content.results[].fail_msg string 失败原因
content.results[].cost_center_id string 成本中心唯一标识
content.results[].outer_cost_center_id string 外部成本中心唯一标识

# 请求事例

请求

curl --location --request POST 'https://xxx/v1/openapi/ent/costcenter/add' \
--header 'X-Sign: 5e9745dea27fc8b7b4b90aa2565868c0ebf847fd' \
--header 'X-SignAlgorithm: 1' \
--header 'X-Timestamp: 20201020164300' \
--header 'X-MerchantId: open_xxx' \
--header 'Content-Type: application/json' \
--data-raw '{"timestamp":20201020164300,"ent_id":"ent_xxx","costcenters":[{"cost_center_name":"测试创建企业中心","outer_cost_center_id":"111","date_limit":"0","start_date":"2022-06-08","end_date":"2029-06-08","quota_type":"2","quota_amount":"999999","quota_limit":"0","is_del":"0"},{"cost_center_name":"测试创建企业中心2","outer_cost_center_id":"112","date_limit":"0","start_date":"2022-06-08","end_date":"2099-06-08","quota_type":"2","quota_amount":"10000000","quota_limit":"0","is_del":"0"}]}'

响应

{
  "errCode": 10000,
  "errMsg": "successful",
  "content": {
    "results": [
        {
          "success": true,
          "cost_center_id": "xxx",
          "outer_cost_center_id": "xxx"
        }
    ]
  }
}