SAP B1 Service Layer is a C# client library for the SAP Business One Service Layer. The repository wraps SAP Business One REST and OData endpoints behind adapter-based resource clients so consuming applications can use a more consistent API shape across documents, business partners, inventory operations, and master data.
- Adapter-based client model for SAP Business One resources
- Shared
IB1Clientinterface for common CRUD-style operations - Coverage for business partners, items, orders, invoices, credit notes, warehouses, and stock movements
- .NET 8 class library with no external host application required
Sap.B1ServiceLayer: main class librarySap.B1ServiceLayer/Adapters: adapter classes that expose a common client shapeSap.B1ServiceLayer/Services: resource-specific endpoint implementationsSap.B1ServiceLayer/System: shared helpers, configuration types, and low-level support codedocs: architecture and resource coverage notes
- business partners
- business places
- items
- sales orders
- purchase orders
- invoices
- credit notes
- sales people
- warehouses
- unit of measurement
- stock entries
- stock exits
- stock transfers
- stock transfer requests
dotnet build sap-service-layer.slndotnet add <your-app>.csproj reference Sap.B1ServiceLayer/Sap.B1ServiceLayer.csprojusing Sap.B1Client.Adapters;
using Sap.B1Client.System;
using Sap.B1Client.System.Interfaces;
var options = SAPHelper.BuildB1Option(
"https://your-service-layer-host:50000",
"CompanyDB",
"UserName",
"Password"
);
IB1Client client = new B1CreditNoteAdapter(options);
var response = client.Retrieve("123");Servicesknow the SAP Business One endpoint path and operation details for a specific resource.Adaptersexpose those resource-specific operations through the sharedIB1Clientinterface.- Consumers configure options once, choose the adapter that matches the target resource, and issue requests through a stable interface.
- The library does not provide a public login or session lifecycle API.
- Request payloads are mostly passed as
object, so consumers are responsible for shaping document payloads correctly. - The library does not include a sample application, CLI, or integration test project.
- Namespaces such as
Sap.B1Clientstill reflect legacy naming and were intentionally left unchanged to avoid breaking consumers.
Requests rely on a cookie header managed by the underlying client base. The codebase contains protected login behavior, but it is not surfaced as a public session management API. Consumers are expected to manage session cookies themselves or extend the adapter layer when they need first-class login support.
- C#
- .NET 8
- RestSharp
- Newtonsoft.Json
- Microsoft.Extensions.Options
The repository name now reflects SAP Business One more explicitly. A few public API names inside the library are still older or less expressive than they could be, for example:
SAPHelper.BuildB1OptionrequiredTemplatechangeContent
These names can be improved later, but changing them now would create avoidable breaking changes in the public API.
- SAP Business One Service Layer API: https://api.sap.com/api/SAPBusinessOneServiceLayer/overview
- Adapter Pattern: https://refactoring.guru/design-patterns/adapter
- This repository is shared for learning, technical review, and knowledge sharing.
- No permission is granted to copy, reuse, modify, redistribute, sublicense, sell, deploy, or use this code in another repository, product, service, or internal system without prior written approval from the repository owner.
- See LICENSE, NOTICE.md, DISCLAIMER.md, CONTRIBUTING.md, and CODE_OF_CONDUCT.md.