SAP Business One Service Layer Request Builder
The Service Layer is the REST and OData interface of SAP Business One, running as the b1s service on top of the database. This builder writes the usual requests so you can paste them into Postman, curl or an HTTP client.
Fill in
1. Login (returns the B1SESSION cookie)
POST https://b1server.example.com:50000/b1s/v1/Login
Content-Type: application/json
{
"CompanyDB": "SBODEMOUS",
"UserName": "manager",
"Password": "<password>"
}2. Read an item with selected fields
GET https://b1server.example.com:50000/b1s/v1/Items('FG-1001')?$select=ItemCode,ItemName,InventoryItem,ItemWarehouseInfoCollection
Cookie: B1SESSION=<session id from login>3. Find open sales orders of a customer
GET https://b1server.example.com:50000/b1s/v1/Orders?$select=DocEntry,DocNum,CardCode,DocDueDate,DocumentStatus&$filter=CardCode eq 'C20000' and DocumentStatus eq 'bost_Open'&$orderby=DocDueDate Cookie: B1SESSION=<session id from login>
4. Create a sales order
POST https://b1server.example.com:50000/b1s/v1/Orders
Content-Type: application/json
Cookie: B1SESSION=<session id from login>
{
"CardCode": "C20000",
"DocDueDate": "2026-11-15",
"DocumentLines": [
{
"ItemCode": "FG-1001",
"Quantity": 25,
"WarehouseCode": "01"
}
]
}5. Create a production order
POST https://b1server.example.com:50000/b1s/v1/ProductionOrders
Content-Type: application/json
Cookie: B1SESSION=<session id from login>
{
"ItemNo": "FG-1001",
"PlannedQuantity": 25,
"DueDate": "2026-11-15",
"Warehouse": "01",
"ProductionOrderType": "bopotStandard"
}6. Logout
POST https://b1server.example.com:50000/b1s/v1/Logout Cookie: B1SESSION=<session id from login>
Entity and property names follow the Service Layer metadata (check /b1s/v1/$metadata on your server) and vary slightly by version. Port 50000 is the common default. Use a dedicated integration user and never paste real passwords into shared files.
Review of your Business One integration design
Optional: a short review of how your integration handles sessions, errors and approvals.
Optional. The tool and every export work without this. No spam.
How the session works
You call Login once with the company database, user and password. The response sets a B1SESSION cookie, which every later request must send. Sessions time out after a period of inactivity, so long-running integrations should catch a 401 and log in again. Always call Logout when a batch finishes, because each session holds a licence slot.
- Login once per batch, reuse the cookie
- Handle session timeout by re-login
- Logout frees the licence
- Use $metadata to confirm entity names
Querying with OData options
Use $select to return only the fields you need, $filter for conditions, $orderby for sorting and $top or $skip for paging. The server returns pages and a next link when the result is large, so a loop must follow that link rather than assuming one response. Filter strings use eq, ne, gt, and and or, with text values in single quotes.
Creating documents safely
A POST to Orders or ProductionOrders runs the same validations as the client, so required fields, series and approval procedures apply. Test in a copy of the database first. Expect errors for closed periods, frozen items and missing warehouses, and log the response body, since it carries the B1 error code and message.
Frequently Asked Questions
What is the default Service Layer port?
Commonly 50000 for the Service Layer on HANA and SQL Server installations, served over HTTPS. Your administrator may have changed it or placed a load balancer in front, so confirm the actual URL with the server team.
Does the Service Layer use my B1 license?
Yes. Each session logged in as a B1 user consumes a license of the type assigned to that user, so use a dedicated integration user and log out when the work is done.
How do I page through large results?
Use $top and $skip, or follow the odata.nextLink the server returns. The server applies its own maximum page size, so do not assume that all rows arrive in one response.
Can I call the Service Layer from a browser?
Technically yes, but it needs CORS configuration and exposes credentials. Calls normally go from a backend service that holds the credentials and applies its own access rules.
Building an integration between Business One and your shop floor, portal or AI agents? Netray can help design it with human approval on any write-back.
Related Tools
SAP Business One DI API Sales Order Code Generator (C#)
Fill in connection and order details to get a C# DI API skeleton that connects, adds a sales order and reports errors.
SAPSAP Business One Document Object Type Codes
Lookup of ObjType numbers used in B1 queries, UDO links and approval templates, with header and row tables.
SAPSAP Business One Database Tables Reference
Searchable lookup of the core SAP Business One tables, with the matching row table and what each one stores.
SAPSAP Business One Production Component Shortage SQL Generator
Pick a status, due date and warehouse and get a query that shows components short against on-hand stock for open production orders.
More Developer Tools tools
See all- SAP B1 Service Layer Sales Order JSON Generator
- SAP Sales Order ABAP SELECT Generator (VBAK, VBAP, VBFA)
- SAP Sales Order Create BAPI ABAP Generator (BAPI_SALESORDER_CREATEFROMDAT2)
- SAP ABAP Open Items SELECT Generator
- SAP ACDOCA SQL Query Generator
- SAP QM Inspection Lot ABAP SELECT Generator
- SAP Quality Notification Pareto SQL Query Generator
- SAP QM Usage Decision BAPI Skeleton
- ABAP Custom Exception Class Generator