@42technologies/netsuite-js 中文文档教程
netsuite-js
NetSuite SOAP API 的节点包装器。
Install
$ npm install --save netsuite-js
Usage
var NetSuite = require('netsuite-js');
var credentials = {
"email": "test@test.com",
"password": "password",
"account": 123456,
"role": 3
};
var config = new NetSuite.Configuration(credentials);
var service = new NetSuite.Service(config);
service
.init()
.then(function(/*client*/) {
console.log('WSDL processed. Service description:');
console.log(service.config.client.describe());
var recordRef = new NetSuite.Records.RecordRef();
recordRef.internalId = 5084;
recordRef.type = 'employee';
console.log('Getting Employee record');
return service.get(recordRef);
})
.then(function(result, raw, soapHeader) {
if (result.readResponse.status.$attributes.isSuccess !== 'true') {
console.error('Error');
console.error(result.readResponse.status.statusDetail);
}
console.log(result);
console.log('Last Request:');
console.log(service.config.client.lastRequest);
})
.catch(function(err) {
console.error(err);
});
Running the examples
- Copy
example/credentials.json.sample
toexample/credentials.json
- Fill in with your NetSuite credentials
- Run
node example/simple.js
or other examples
API
您可以在以下位置找到自动生成的文档:http
://crosslead.github.io/netsuite-js/docs/lib/index.js.html 自动生成的文档是通过 gulp docs
任务创建并推送到gh-pages
分支。
(即将推出端到端使用场景的更多示例)
Contributing
代替正式的风格指南,请注意维护现有的编码风格。 为任何新的或更改的功能添加单元测试。 使用 gulp 检查和测试您的代码。
License
版权所有 (c) 2015 McChrystal Group。 根据 Apache 许可证获得许可。
netsuite-js
A Node wrapper for the NetSuite SOAP API.
Install
$ npm install --save netsuite-js
Usage
var NetSuite = require('netsuite-js');
var credentials = {
"email": "test@test.com",
"password": "password",
"account": 123456,
"role": 3
};
var config = new NetSuite.Configuration(credentials);
var service = new NetSuite.Service(config);
service
.init()
.then(function(/*client*/) {
console.log('WSDL processed. Service description:');
console.log(service.config.client.describe());
var recordRef = new NetSuite.Records.RecordRef();
recordRef.internalId = 5084;
recordRef.type = 'employee';
console.log('Getting Employee record');
return service.get(recordRef);
})
.then(function(result, raw, soapHeader) {
if (result.readResponse.status.$attributes.isSuccess !== 'true') {
console.error('Error');
console.error(result.readResponse.status.statusDetail);
}
console.log(result);
console.log('Last Request:');
console.log(service.config.client.lastRequest);
})
.catch(function(err) {
console.error(err);
});
Running the examples
- Copy
example/credentials.json.sample
toexample/credentials.json
- Fill in with your NetSuite credentials
- Run
node example/simple.js
or other examples
API
You can find autogenerated docs at: http://crosslead.github.io/netsuite-js/docs/lib/index.js.html
The autogenerated docs are created via the gulp docs
task and pushed to the gh-pages
branch.
(More examples of end-to-end usage scenarios coming soon)
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using gulp.
License
Copyright (c) 2015 McChrystal Group. Licensed under the Apache license.