# SAP Business One integration: Integration Framework (B1i), Service Layer, DI API and connectors

> Source: https://netray.co/erp-help/sap-business-one-integration-framework-service-layer-di-api-which-to-use
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: ERP Help

## Short answer

Business One offers four main ways to integrate: the Service Layer (REST/OData, the default for new work), the Integration Framework B1i (scenario based middleware), the DI API (COM/.NET, for legacy and add-ons) and third party or SaaS connectors. Pick the Service Layer for new web integrations and B1i when you want packaged scenarios and message flows.

## Kind

how-to

## System

sap

## Erp

SAP Business One

## Module

Integration / APIs

## Query

sap business one integration framework

## Alternate Queries

- sap business one saas integration
- sap business one api documentation
- sap b1 service layer vs di api
- sap b1i

## Applies To

SAP Business One 10.0 (SQL Server and HANA). Service Layer endpoint path and version differ by release.

## Steps

### Choose and set up an integration approach

**Items:**

- List the integration needs: direction (in, out, both), volume, latency, who owns the other system, and whether you need transformation or only calls.
- For REST based integrations, use the Service Layer. Log in with a POST to /b1s/v1/Login with CompanyDB, UserName and Password, then reuse the B1SESSION cookie for requests.
- For scenario based flows with transformation, monitoring and packaged content, use the Integration Framework (B1i) and its scenario packages.
- For in-process add-ons or older systems on Windows, use the DI API (and UI API for screens).
- For SaaS apps such as e-commerce, CRM or banking, check for an existing certified connector before building your own.
- Secure the integration: dedicated API user with minimal authorizations, TLS, secrets in a vault and logging of calls.
- Test with production-like volume and handle session timeouts, retries and idempotency.

## Sections

### Comparing the options

**Body:**

Service Layer: web service on the Business One server exposing business objects as OData REST resources with JSON. It is stateful with a session, supports batch requests, queries with $filter and $select, and user-defined objects. It is the recommended route for new external integrations and for custom web apps. The API documentation is on the SAP Help Portal and the service exposes its metadata at the service root.

DI API: a COM/.NET library installed on a Windows machine that connects to the company database. It is mature and rich, used by many add-ons, but couples you to Windows and to the client version. Integration Framework (B1i): a middleware engine with scenario packages, message routing and transformation, and monitoring, good for connecting to other systems in a structured way, though more heavyweight than a direct API call.

**Code:**

- POST https://b1server:50000/b1s/v1/Login
- { "CompanyDB": "SBODEMO", "UserName": "api_user", "Password": "***" }
- 
- GET /b1s/v1/Items?$select=ItemCode,ItemName&$filter=ItemCode eq 'A100'

### SaaS and cloud integration

**Body:**

For cloud applications, the usual patterns are a certified connector from a partner, an iPaaS platform calling the Service Layer, or a small middleware you host. If your Business One runs on-prem behind a firewall, expose the Service Layer through a reverse proxy or VPN with authentication, rather than opening it directly to the internet.

Plan for the session model: Service Layer sessions time out and a worker pool should re-login and retry safely. Keep calls idempotent where you can, for example by storing an external reference in a user-defined field and checking before creating a document.

### When AI joins the picture

**Body:**

AI assistants need the same things any integration does: authenticated, least-privilege access and an audit trail. Read paths can use the Service Layer or a read-only database user, and write paths should go through the Service Layer with approval by a person, so the standard validation applies.

A private deployment keeps documents and master data inside your network while still letting users ask questions in plain language.

## Pitfalls

- Using the DI API from a web service on Linux or in a container where it is not supported.
- Ignoring session timeouts so calls start failing in the middle of a batch.
- Exposing the Service Layer port directly to the internet.
- Using a super user for the integration account.
- Updating tables directly because the API call felt slow.

## Ai Angle

For question answering over Business One, a read-only layer works against the Service Layer or a reporting replica, and writes are proposed and approved by a person before the Service Layer call. Netray builds this as an on-prem or private cloud deployment so the model and the data stay in your environment.

## Faq

### What is the difference between B1i and the Service Layer?

**Answer:** The Service Layer is a REST/OData API for calling Business One objects directly. B1i is an integration middleware with scenario packages, message routing and transformation. Many projects use the Service Layer directly, and B1i when they want its packaged flows.

### Is the DI API deprecated?

**Answer:** It remains available and widely used by add-ons, but for new external integrations SAP guidance favours the Service Layer. Check the current documentation for your version before you commit to the DI API.

### Where is the SAP Business One API documentation?

**Answer:** On the SAP Help Portal under SAP Business One, which has the Service Layer API reference and the DI API reference, and on the SAP Business Accelerator Hub for sample content.

### How do I avoid Service Layer session errors?

**Answer:** Reuse the session cookie, handle timeouts by logging in again and retrying, and keep a limited number of concurrent sessions per licence. Do not log in for every request.

## Search terms

sap business one integration framework, sap b1i, sap business one service layer, sap business one di api, sap business one api documentation, sap business one saas integration, sap b1 rest api, sap business one connector

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
