1.0.0 • Published 6 months ago
sapb1-service-layer v1.0.0
SAP Service Layer Library
Library for integrating with SAP Business One Service Layer, providing simplified methods for CRUD operations and API queries.
📦 Installation
npm install sapb1-service-layer
🚀 How to Use
Import and Configuration
import ServiceLayer from 'sapb1-service-layer';
const config = {
host: 'https://myserver',
port: 50000,
company: 'SBODEMO',
username: 'manager',
password: 'mypassword',
version: 'v2',
debug: true
};
await ServiceLayer.createSession(config);
Get a Record
const response = await ServiceLayer.get('BusinessPartners(\'C0001\')');
console.log(response);
Creating a Business Partner
const partner = {
CardCode: "C0001",
CardName: "Example Customer",
CardType: "C"
};
const response = await ServiceLayer.post('BusinessPartners', partner);
console.log(response);
Fetching Items
const items = await ServiceLayer.find('Items?$select=ItemCode,ItemName');
console.log(items);
Updating an Order
const updatedOrder = {
DocumentStatus: "C"
};
const response = await ServiceLayer.patch('Orders(10)', updatedOrder);
console.log(response);
Deleting a Record
const response = await ServiceLayer.delete('BusinessPartners(\'C0001\')');
console.log(response);
📖 Documentation
For more details on the available methods, refer to the Official Service Layer Documentation.
🛠️ Development
Run Tests
npm test
Generate Documentation
npm run doc
📜 License
MIT License
1.0.0
6 months ago