Skip to main content
Skip table of contents

Web Services

Using WarehousePro Web Service

The WarehousePro Web Services use oData protocols. Follow instructions and sample codes below.

First check the WarehousePro package settings to determine the Web Service URL. In B1ProSuite Software Platform Console check for the correct WarehousePro instance and note IP, Communication Port and SSL setting:

If the IP setting has no value, you should be able to use any address of the server. When SSL setting is 'Y' then use "https" else use "http".

The image above specifies the following base URL: http://192.168.4.51:20020

During the samples below this address will be referred to as the "Base URL".

TMS Definition

WarehousePro provides a Web Service (oData) for external applications to add or edit Route data. Per external application a definition must be made to give access to the service and to determine authorizations.

Navigate to Administration > Setup > WarehousePro Settings > Routes and open TMS Definition.

Create a Name for the account which will be visible in Route Definition as "Source".

Specify a User Name and Password for the account and select the Strategy to use when pick lists for documents linked to routes are being generated.

Determine which routes can be accessible for the user. Options are:

  • Owner Only routes added by this account are accessible

  • Owner and System Only routes added by this account and added from SAP Business One add-on are accessible. Only routes added by another TMS account are not accessible.

  • All All routes are accessible.

Specify which document types (Sales Orders, Purchase Orders and Sales Return Requests) can be attached to routes by using the Web Service account. Only documents linked to the Shipping Types listed in the table in the bottom half of the screen will be accessible for the account.

Select All to automatically accept all Shipping Types

Select Empty to accept documents without Shipping Types

Optionally it is possible to specify which Shipping Docks are used for routes from this account. Specify these per warehouse in Locations tab.

WMS Definition

WarehousePro provides a Web Service (oData) for external applications to manage picklists. Per external application a definition must be made to give access to the service and to determine authorizations.

Navigate to Administration > Setup > WarehousePro Settings > Picklists and open WMS Definition.

Create a Name for the account which will be visible in Picklists as "WMS" value.

Specify a User Name and Password for the account.

Specify whether Every Picklist should be available for processing with WMS Web Service.

Once Every Picklists is enabled, the settings in tabs Task Group and Modules are ignored.

Determine which Task Groups are groups that will be processed through the web service.

Specify the enabled Modules (select from Order Picking, Stock Transfer and Production Picking).

If the Every Picklist field is checked, all picklists for specified Modules are available for processing with the web service.

Login

To be able to use the Web Service a login is required

URL: <base url>/Login

Type: POST

Body (x-www-urlencoded):

  • grant_type password

  • username <user name as created in TMS or WMS Definition>

  • password <password as created in TMS or WMS Definition>

  • ClientType TMS or WMS (depending on the functionality to be used)

Success Response (200 OK):

JSON
{    
"access_token": "<use this token for future use during session>",    
"token_type": "bearer",
"expires_in": 345599,    
"Name": "<user name used for login>",    
"role": "TMS",    
".issued": "Wed, 09 Sep 2020 08:54:59 GMT",    
".expires": "Sun, 13 Sep 2020 08:54:59 GMT"
}

Failure responses (400 Bad Request):

Incorrect User Name of Password:

JSON
{    
"error": "System_Not_Found",    
"error_description": "The user name or password is incorrect"
}

Incorrect ClientType:

JSON
{    
"error": "User_Not_Found",    
"error_description": "The user name or password is incorrect"
}

TMS Web Service

Depeding on the logged on ClientType several functions are available when using the WarehousePro Web Service. When logged on as type "TMS", the following functions are available.

Get Documents

After successful login Open Documents can be retrieved.

URL: <base url>/OData/TMS/Function.Get_Documents()

Type: GET

Headers:

  • Authorization Bearer <Use access_token from Login command>

Success Response (200 OK):

JSON
{
    "@odata.context": "http://192.168.4.51:20020/OData/$metadata#Collection(Function.B1TmsDocuments)",
    "value": [
        {
            "BaseType": "SalesOrder",
            "DocEntry": 760,
            "DocNum": 760,
            "CardCode": "C42000",
            "CardName": "De Hardware Winkel",
            "ShipToCode": "Afleveradres",
            "Address": "Prins Hendrikkade 91\r1011 AG  AMSTERDAM\rNETHERLANDS",
            "Street": "Prins Hendrikkade 91",
            "StreetNo": null,
            "Block": null,
            "Building": "",
            "City": "Amsterdam",
            "ZipCode": "1011 AG",
            "County": null,
            "State": null,
            "Country": "NL",
            "DeliveryDate": "2018-08-07T00:00:00+02:00",
            "DeliveryDay": null,
            "Route_ID": null,
            "RoutePos": null,
            "Description": null,
            "ClosingDay": null,
            "ClosingTime": null
        }    
    ]
}

Failure response (401 Unauthorized):

JSON
{    
    "error": {        
        "code": "",        
        "message": "Authorization has been denied for this request."    
    }
}

Get Routes

After succesful login Existing Routes can be retrieved.

URL: <base url>/OData/TMS

Type: GET

Headers:

  • Authorization Bearer <Use access_token from Login command>

Success Response (200 OK):

JSON
{
    "@odata.context": "<base url>/OData/$metadata#TMS",
    "value": [
        {
            "Route_ID": "DHL-000001",
            "Description": "DHL - Thursday, February 20, 2020 Route 1",
            "DeliveryDay": "Thursday",
            "PickingDay": "Thursday",
            "ClosingDay": "Sunday",
            "ClosingTime": null,
            "Active": "Y",
            "ActiveFrom": null,
            "ActiveTo": null,
            "External_Key": ""
        }
    ]
}

Failure response (401 Unauthorized):

JSON
{
     "error": {
         "code": "",
         "message": "Authorization has been denied for this request."
     }
}

Get Planning

After succesful login Existing Routes can be retrieved.

URL: <base url>/OData/TMS/Function.Get_Planning()

Type: GET

Headers:

  • Authorization Bearer <Use access_token from Login command>

Success Response (200 OK):

JSON
{
    "@odata.context": "http://192.168.4.51:20020/OData/$metadata#Collection(Function.B1TmsPlanning)",
    "value": [
        {
            "Route_ID": "DHL-000003",
            "External_Key": "",
            "DeliveryDay": "Thursday",
            "ClosingDay": "Saturday",
            "ClosingTime": -1,
            "Documents": [
                {
                    "BaseType": "ReturnRequest",
                    "DocEntry": 30,
                    "DeliveryDate": "2020-02-27T00:00:00+01:00",
                    "RoutePos": -1
                }
            ]
        },
        {
            "Route_ID": "DHL-000004",
            "External_Key": "",
            "DeliveryDay": "Friday",
            "ClosingDay": "Thursday",
            "ClosingTime": 2359,
            "Documents": [
                {
                    "BaseType": "SalesOrder",
                    "DocEntry": 980,
                    "DeliveryDate": "2020-02-21T00:00:00+01:00",
                    "RoutePos": 20
                }
            ]
        }
    ]
}

Failure response (401 Unauthorized):

JSON
{
     "error": {
         "code": "",
         "message": "Authorization has been denied for this request."
     }
}

Save Route

After succesful login new Routes can be added or existing Routes can be updated.

URL: <base url>/OData/TMS

Type: POST

Headers:

  • Authorization Bearer <Use access_token from Login command>

  • Content-Type application/json

Body (json):

CODE
{
    "Route_ID": "TMS-20200909-001",
    "External_Key": "TMSEXT20200909001",
    "Description": "TMS - Wednesday, September 9, 2020 - Route 1",
    "DeliveryDay": "4",
    "ActiveFrom": "2020-09-08",
    "ActiveTo": "2020-09-10"
}

All fields retrieved from Get Routes or in Success Response can be added to the body for update.

Also note that dates must be entered without additonal time extension. Since it will only be compared to delivery date of the document, this could cause issues when saving Route Planning. Use elements "ClosingDay" (numeric 1-7) "ClosingTime" (integer) if you wish to have a limit for Route Planning.

Success Response (200 OK):

JSON
{
    "@odata.context": "http://192.168.4.51:20020/OData/$metadata#TMS/$entity",
    "Route_ID": "TMS-20200909-001",
    "Description": "TMS - Wednesday, September 9, 2020 - Route 1",
    "DeliveryDay": "Wednesday",
    "PickingDay": "Wednesday",
    "ClosingDay": "Wednesday",
    "ClosingTime": null,
    "Active": "Y",
    "ActiveFrom": "2020-09-08T00:00:00+02:00",
    "ActiveTo": "2020-09-10T00:00:00+02:00",
    "External_Key": "TMSEXT20200909001"
}

Failure response:

Incorrect access_token (401 Unauthorized):

JSON
{
     "error": {
         "code": "",
         "message": "Authorization has been denied for this request."
     }
}

Incorrect body (500 Internal Server Error):

JSON
{
    "error": {
        "code": "-1",
        "message": "Invalid Data Model",
        "innererror": {
            "message": "Invalid Data Model",
            "type": "System.Exception",
            "stacktrace": "   at WarehousePro_EndPoint.Controllers.TMSController.<Post>d__3.MoveNext()"
        }
    }
}

Save Planning

After successful login the Planning of a Route can be added or existing Planning can be updated.

Each planning update will replace the previous planning. Make sure to add all planned documents when sending an update.

URL: <base url>/OData/TMS/Function.Save_Planning()

Type: POST

Headers:

  • Authorization Bearer <Use access_token from Login command>

  • Content-Type application/json

Body (JSON):

JSON
{
    "Route": {
        "Route_ID": "TMS-20200909-001",
        "External_Key": "",
        "Documents": [
            {
                "BaseType": "SalesOrder",
                "DocEntry": 1034,
                "RoutePos": 11
            },
            {
                "BaseType": "ReturnRequest",
                "DocEntry": 453,
                "RoutePos": 11
            }
        ]
    }
}

Success Response (200 OK):

JSON
{
    "@odata.context": "http://192.168.4.51:20020/OData/$metadata#Function.B1TmsPlanning",
    "Route_ID": "TMS-20200910-001",
    "External_Key": "",
    "DeliveryDay": "Thursday",
    "ClosingDay": "Thursday",
    "ClosingTime": -1,
    "Documents": [
        {
            "BaseType": "SalesOrder",
            "DocEntry": 1034,
            "DeliveryDate": "2020-09-10T00:00:00+02:00",
            "RoutePos": 11
        },
        {
            "BaseType": "ReturnRequest",
            "DocEntry": 453,
            "DeliveryDate": "2020-09-10T00:00:00+02:00",
            "RoutePos": 11
        }
    ]
}

Failure response:

Incorrect access_token (401 Unauthorized):

JSON
{
     "error": {
         "code": "",
         "message": "Authorization has been denied for this request."
     }
}

WMS Web Service

Depeding on the logged on ClientType several functions are available when using the WarehousePro Web Service. When logged on as type "WMS", the following functions are available.

Get Picklists

After succesful login Open Picklists can be retrieved.

URL: <base url>/OData/WMS(<picklist number>)

use <base url>/OData/WMS (so without the picklist specification) to retrieve all available picklists.

Type: GET

Headers:

  • Authorization Bearer <Use access_token from Login command>

Success Response (200 OK):

JSON
{
    "@odata.context": "http://192.168.4.52:20010/OData/$metadata#WMS/$entity",
    "AbsEntry": 4,
    "DocumentType": "17",
    "PickDate": "2021-03-03",
    "Remarks": "",
    "Priority": 5,
    "Route": "",
    "RouteDescription": "",
    "Lines": [
        {
            "AbsEntry": 4,
            "PickLine": 0,
            "AllocationLine": 0,
            "Status": "O",
            "WhsCode": "01",
            "BinAbs": 0,
            "BinCode": "",
            "ItemCode": "A00002",
            "ItemName": "J.B. Officeprint 1111",
            "ManagedBy": "",
            "SysNumber": 0,
            "Charge": "",
            "IntSerial": "",
            "SupSerial": "",
            "PickedQuantity": 0.000000,
            "OpenQuantity": 1.000000,
            "Remarks": "",
            "DocEntry": 694,
            "BaseType": 17,
            "DocLine": 0,
            "DocNum": 682,
            "RoutePos": 10,
            "CardCode": "C40000",
            "CardName": "Aerts Computers",
            "TrnspName": "DHL 12:00",
            "ShipToCode": "Afleveradres",
            "ShipToDesc": "Achilles Musschestraat 31\r\r9000 GENT\rBELGIUM"
        }
    ]
}

Failure response (401 Unauthorized):

JSON
{    
    "error": {        
        "code": "",        
        "message": "Authorization has been denied for this request."    
    }
}

Update Pickline

After successful login new Picklists can be updated by specifying the total picked quantity per line.

URL: <base url>/OData/WMS/Function.Update_Pickline()

Type: POST

Headers:

  • Authorization Bearer <Use access_token from Login command>

  • Content-Type application/json

Body (json):

JSON
{
    "Lines":[
        {
            "AbsEntry": 1254,
            "PickLine": 0,
            "AllocationLine": 0,
            "Quantity": 3
        },
        {
            "AbsEntry": 1254,
            "PickLine": 1,
            "AllocationLine": 0,
            "Quantity": 2,
            "Serials":[
                {
                    "DistNumber": "000046",
                    "Quantity": 1
                },
                {
                    "DistNumber": "A6-000315",
                    "Quantity": 1
                }
            ]
        },
        {
            "AbsEntry": 1254,
            "PickLine": 2,
            "AllocationLine": 0,
            "Quantity": 48,
            "Batches":[
                {
                    "DistNumber": "20200221-0008",
                    "Quantity": 24
                },
                {
                    "DistNumber": "20200316-0003",
                    "Quantity": 24
                }
            ]
        }

    ]
}

The sample body above displays examples for use with serial numbers, batch numbers and items without batch or serial numbers.

Success Response (200 OK):

JSON
{
    "@odata.context": "http://192.168.4.52:20010/OData/$metadata#Function.B1WmsPicklist_CallBack_Result",
    "Succes": "Y",
    "Reason": ""
}

Failure response:

Incorrect access_token (401 Unauthorized):

JSON
{
     "error": {
         "code": "",
         "message": "Authorization has been denied for this request."
     }
}

Incorrect data (200 OK):

JSON
{
    "@odata.context": "http://192.168.4.52:20010/OData/$metadata#Function.B1WmsPicklist_CallBack_Result",
    "Succes": "N",
    "Reason": "Line not found picklist 4, pickLine 1"
}

Finish Picklist

After successful login new Picklists can be updated by specifying the total picked quantity per line.

URL: <base url>/OData/WMS/Function.Finish_Picklist()

Type: POST

Headers:

  • Authorization Bearer <Use access_token from Login command>

  • Content-Type application/json

Body (json):

JSON
{
    "AbsEntry": 1294,
    "DoneBy": "External Pickers name"
}

The sample body above displays examples for use with serial numbers, batch numbers and items without batch or serial numbers.

Success Response (200 OK):

JSON
{
    "@odata.context": "http://192.168.4.52:20010/OData/$metadata#Function.B1WmsPicklist_CallBack_Result",
    "Succes": "Y",
    "Reason": ""
}

Failure response:

Incorrect access_token (401 Unauthorized):

JSON
{
     "error": {
         "code": "",
         "message": "Authorization has been denied for this request."
     }
}

Incorrect data (invalid picklist number) (200 OK):

JSON
{
    "@odata.context": "http://192.168.4.52:20010/OData/$metadata#Function.B1WmsPicklist_CallBack_Result",
    "Succes": "N",
    "Reason": "Picklist not found 12333"
}

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.