Log in to SAP B1 Service Layer Using Postman – Step-by-Step

 

How to Log in to SAP B1 Service Layer Using Postman – Step-by-Step Guide

If you're working with SAP Business One (SAP B1) and need to access the Service Layer via Postman, this guide walks you through the entire process. Whether you're testing integrations or automating workflows, getting authenticated with a valid session is the first essential step.

 Prerequisites

  • SAP B1 Service Layer is installed and running.

  • You have valid login credentials: Company DB, UserName, and Password.

  • Your PC can access the Service Layer server (e.g., https://192.168.1.100:50000).

  • Use https only if your server supports SSL; otherwise, use http.

 Step-by-Step in Postman

Step 1: Open Postman
Launch Postman on your system.

Step 2: Create a New Request

Step 3: Set Headers
In the Headers tab, add:

Key Value Content-Type application/json Accept application/json

Step 4: Set Body
In the Body tab:

  • Select raw and choose JSON.

  • Enter the following (adjust values to your setup):


{ "CompanyDB": "SBODEMOUS", "UserName": "manager", "Password": "manager" }

🔐 Replace SBODEMOUS with your actual database name.
🔐 Replace manager with your SAP B1 user credentials.

Step 5: Disable SSL Verification (Optional for Localhost)
If using a self-signed certificate or internal IP like 192.168.x.x:

Step 6: Click Send
You’ll receive a response similar to: if service layer login succeed in postman showing this response

{
    "odata.metadata": "https://192.168.1.100:50000/b1s/v1/$metadata#B1Sessions/@Element",
    "SessionId": "19dc50ac-5746-11f0-c000-00155d022c16-19720-12736",
    "Version": "1000270",
    "SessionTimeout": 30
}

Save Session ID for Future Requests

Copy the SessionId. For authenticated API requests (e.g., getting sales orders), include this header:

Cookie: B1SESSION=abcdef123456...

Troubleshooting Common Errors

Error Message Meaning & Fix Could not resolve host Check IP and port; ensure the Service Layer is up Fail to get the bound database from SLD Check if SLD is correctly configured Authorization header not found Missing or incorrect headers -304 Fail to NONE-SSO login from SLD SLD Agent may not be installed or configured

 More Postman Errors & Solutions

 Error: connect ECONNREFUSED 192.168.1.100:50000
Cause: Can't connect to Service Layer server.
Solution: Check that the server is up, IP/port is correct, and no firewall blocks the request.

 Error: self signed certificate
Cause: SSL certificate not trusted.
Solution: Disable SSL verification in Postman or switch to HTTP.

Error: Unsupported Media Type
Cause: Missing Content-Type header.
Solution: Add Content-Type: application/json and ensure body is in raw JSON format.


Error : 
{ "error":
       { "code": -311, 
            "message":
               { "lang": "en-us",
               "value": "Fail to get the bound database instance from SLD."
             }
           }
       }

Solution - need to check Service layer Properly is not installed.


Error : 

{

  "error": {

    "code": "-2028",

    "message": "Customer record not found"

  }

}


Solution: This Card Code Record is not found in sap database
 Postman queryhttps://fp2502.uneecopscloud.com:50000/b1s/v2/Orders?$filter=CardCode eq 'C23900'

SQL query for sql and hana - Find card record

Query :1

SELECT 

    "DocEntry", 

    "DocNum", 

    "CardCode", 

    "CardName", 

    "DocDate", 

    "DocTotal"

FROM 

    "YourDatabaseName"."ORDR"

Query :2

SELECT 
    "DocNum" 
FROM 
    "YourDatabaseName"."ORDR"
ORDER BY "DocNum" DESC;


Other Error : 1

{

  "error": {

    "code": "-2028",

    "details": [

      {

        "code": "",

        "message": ""

      }

    ],

    "message": "No matching records found (ODBC -2028)"

  }

}


Other Error : 2

<head> <title>502 Bad Gateway</title> </head> <body> <h1>Bad Gateway</h1> <p>The proxy server received an invalid response from an upstream server.<br /> </p> <p>Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.</p> </body> </html>



Other Qurey : 

https://192.168.1.100:50000/rs/v1/LoadAuthorizedCRList
https://sap1009.uneecopscloud.com:60020/login


For hana in postman:
{
"CompanyDB": "database  name",
"Password": "domain\\doamin user name",
"DBInstance": "domain\\SQL201910PL19",
"UserName": "password"
}






💡 Pro Tip

Save your request in Postman as a collection to reuse the login process in future API tests.

if you have any query please follow and contact us.


                                                 Thankyou for Visit.............................



Share on Google Plus

About Pawar Live Study

Search Your Query in Search Box.

0 Comments:

Post a Comment

pawarsolution