接口访问金蝶

erp系统通过IP访问数据,同时可以当无头系统来实现UI重定义

自动化了关联关系

文档介绍

金蝶云api

程序调用API

k3cloud_webapi_sdk.ipynb

kingdee.cdp.webapi.sdk-8.0.4-py3-none-any.whl
https://openapi.open.kingdee.com/ApiSdkCenter

1.01.01.0001

调用配置文件

[config]
# 第三方系统登录授权的账套ID
X-KDApi-AcctID = 6476f2c24443ea
# 第三方系统登录授权的用户
X-KDApi-UserName = Administrator
# 第三方系统登录授权的应用ID
X-KDApi-AppID = 276123_753PQzjOQOHZ38UtWZxoScVLTuwd7rqo
# 第三方系统登录授权的应用密钥
X-KDApi-AppSec = xxxxxxxxxxxxxxxxxxxxxxxxxxx
# 服务Url地址(私有云需要配置自己的K3Cloud地址,公有云无需配置)
X-KDApi-ServerUrl = http://127.0.0.1/k3cloud/
#账套语系,默认2052
#X-KDApi-LCID = 2052
#组织编码,启用多组织时配置对应的组织编码才有效
#X-KDApi-OrgNum = 100
#允许的最大连接延时,单位为秒
#X-KDApi-ConnectTimeout = 120
#允许的最大读取延时,单位为秒
#X-KDApi-RequestTimeout = 120
#若使用代理,配置此参数
;X-KDApi-Proxy = http://localhost:8888/

官方例子

# 注意 1:此处不再使用参数形式传入用户名及密码等敏感信息,改为在登录配置文件中设置。
# 注意 2:必须先配置第三方系统登录授权信息后,再进行业务操作,详情参考各语言版本SDK介绍中的登录配置文件说明。
# 读取配置,初始化SDK
api_sdk = K3CloudApiSdk()
api_sdk.Init(config_path='../conf.ini', config_node='config')
# 请求参数
para =  {"CreateOrgId":0,"Number":"","Id":"","IsSortBySeq":"false"}
# 业务对象标识
formId = "ER_ExpenseRequest"
# 调用接口
response = api_sdk.View(formId, para)

print("接口返回结果:" + response)
# 对返回结果进行解析和校验
res = json.loads(response)
if res["Result"]["ResponseStatus"]["IsSuccess"]:
	return True
else:
	logging.error(res)
	return False

申请启用API

需要admin登入

查看密钥需要二次验权。

低层api

文档

Kingdee.BOS.WebApi

常用接口地址

http://192.168.0.48/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.AuthService.LoginByAppSecret.common.kdsvc
http://192.168.0.48/k3cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc
http://192.168.0.48/k3cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillListQuery.common.kdsvc

可参考 apifox

curl例子

登入

rid == uuid

curl --location --request POST 'http://192.168.0.48/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.AuthService.LoginByAppSecret.common.kdsvc' \
--header 'Content-Type: application/json' \
--data-raw '{
  "format": 1,
  "useragent": "ApiClient",
  "rid": "166be14d-f9e2-4870-b9d7-6237e1edb862",
  "parameters": [
    "6476f2c24443ea",
    "Administrator",
    "276123_753PQzjOQOHZ38UtWZxoScVLTuwd7rqo",
    "6e4595a91a844c51bc97a04ef04db54e",
    "2052"
  ],
  "timestamp": "1757397209",
  "v": "1.0"
}'

查询表单

curl --location --request POST 'http://192.168.0.48/k3cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc' \
--header 'kdservice-sessionid: 9656fada-58be-484a-b647-7563afda83ff' \
--header 'Content-Type: application/json' \
--data-raw '{
    "parameters": [
        {
            "FormId": "SAL_MATERIALGROUP",
            "FieldKeys": "fid,fnumber,fname",
            "FilterString":"fid=121347",
            "TopRowCount": 0,
            "StartRow": 0,
            "Limit": 3

        }
    ]
}'

读取列表

curl --location --request POST 'http://192.168.0.48/k3cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillListQuery.common.kdsvc' \
--header 'kdservice-sessionid: 9656fada-58be-484a-b647-7563afda83ff' \
--header 'Content-Type: application/json' \
--data-raw '{
  "data": {
    "FormId": "PUR_PurchaseOrder",
  
    "FieldKeys": "FID,FBILLNo",
    "FilterString": [ ],
    "CustomParams": "",
    "OrderString": "",
    "StartRow": 0,
    "Limit": 10
  }
}'