Package Exports
- k3cloudapi
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (k3cloudapi) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
金蝶星空云webapi nodejs SDK
kingdee webapi nodejs sdk.
Usgae
$ npm install k3cloudqpi --save配置信息
配置相关的基础信息
其中
auth节点需要金蝶k3cloud管理员进入系统管理->第三方系统认证->新增生成密钥和填写appid和app名称
{
baseURL: 'http://erp.kingdee.com',
accid: 'it dc id', // 数据中心
lcid: 2052,
auth: { // 第三方系统认证
appid: 'appid',
appname: 'appid',
appsecret: 'appsecret'
},
apis: { // webapi
authPath: '/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.AuthService.LoginByAppSecret.common.kdsvc',
listPath: '/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc',
getPath: '/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.View.common.kdsvc'
}
}const K3cloudapi = requrie('k3cloudapi')
const config = require('config').kingdee // 配置信息参照上面⬆️
const k3cloudapi = new K3cloudapi(config)
k3cloudapi.auth().then(cookie => {
// cookie 建议本地缓存 避免每次请求都重新获取
const formId = 'BD_Empinfo' // 表单ID
const fieldKeys = ['FID', 'FName'] // 需要返回的字段
k3cloudapi.list({ cookie, formId, fieldKeys })
.then(r => console.log(r)).catch(e => console.log(e))
k3cloudapi.get({ cookie, formId, id: 143494 })
.then(r => console.log(r)).catch(e => console.log(e))
})// 支持await
const K3cloudapi = requrie('k3cloudapi')
const config = require('config').kingdee // 配置信息参照上面⬆️
const k3cloudapi = new K3cloudapi(config)
const cookie = await k3cloudapi.auth()
const formId = 'BD_Empinfo' // 表单ID
const fieldKeys = ['FID', 'FName'] // 需要返回的字段
const results = await k3cloudapi.list({ cookie, formId, fieldKeys })