云星空 k3cloud webapi Nodejs SDK
金蝶云社区-云社区用户309F6428
云社区用户309F6428
0人赞赏了该文章 1752次浏览 未经作者许可,禁止转载编辑于2019年06月13日 16:28:25

金蝶星空云webapi nodejs SDKkingdee webapi nodejs sdk.[list]
[*]项目地址(github):https://github.com/CNBlackJ/k3cloudapi
[/list][float=left][/float]Usgae[list]
[*]$ npm install k3cloudqpi --save
[*]配置信息
[list]
[*]配置相关的基础信息
[*]其中auth节点需要金蝶k3cloud管理员进入 系统管理->第三方系统认证->新增 生成密钥和填写appid和app名称
[/list][/list][code]{
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',
auditPath: '/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit.common.kdsvc'
}
}[/code]
[code]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))
})[/code]
[code]// 支持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 })
[/code]
[float=left][/float]Contact[list]
[*]Email: yes.heng@icloud.com
[*]github: https://github.com/CNBlackJ
[/list][float=left][/float]Change Log[list]
[*]2019-05-27: 添加审核接口
[*]2019-05-23: 权限验证/列表/详情接口
[/list]