The object keyword allows the B1WebAPI web service to interface with any DI-API Business One object via XML. Objects can be loaded from SAP Business One and the XML information can be updated and sent back to Business One.

Keywords

object

The object XML modes are:

  • edit - Passing this parameter as part of the syntax informs the B1WebAPI to load the DI-API for edit purposes. Read-only DI-API properties are not included when using this flag. Note that you must specify the object key, denoted by the number 1 below.

    Syntax: [/<optional-profile>]/object/edit/<object-type>/<object-key>.aspx

    Example (default profile): /object/edit/oOrders/1.aspx

    Example (“myCompany” profile): /myCompany/object/edit/oOrders/1.aspx

  • display - Passing this parameter as part of the syntax informs the B1WebAPI to load the full DI API XML. Read Only DI API properties are included when using this flag and you will potentially get error messages if you try to update the object using this XML. Note that you must specify the object key, denoted by the number 1 below.

    Syntax: [/<optional-profile>]/object/display/<object-type>/<object-key>.aspx

    Example (default profile): /object/display/oOrders/1.aspx

    Example (“myCompany” profile): /myCompany/object/display/oOrders/1.aspx

uow

The uow URL keyword enables the B1WebAPI web service to update or create any DI-API Business One object via XML. The XML that is loaded using the object keyword above can be edited and sent back to Business One using the uow keyword. You can also use the B1WebAPI Test Transaction page to get valid XML samples that can be populated to create new DI-API objects (see How to get valid B1 XML samples using Interconnect).

The uow XML modes are:

  • update - Syntax: [/<optional-profile>]/uow/update/<object-type>/<object-key>.aspx

    Example (default profile): /uow/update/oOrders/1.aspx

    Example (“myCompany” profile): /myCompany/uow/update/oOrders/1.aspx

  • insert - Syntax: [/<optional-profile>]/uow/insert/<object-type>.aspx

    Example (default profile): /uow/insert/oOrders.aspx

    Example (“myCompany” profile): /myCompany/uow/insert/oOrders.aspx

As with the object keyword, uow provides access to supported DI-API object types listed in Supported DI-API object types.

Testing Object Transactions

Object transactions can be tested manually using the B1WebAPI web service. This can aid in troubleshooting data insert or editing errors.

  • Connect to B1WebAPI, typically installed on the SAP Business One server, usually at http://localhost:4033/index.aspx
  • Navigate to Test Transactions, typically http://localhost:4033/Transaction.aspx
  • Select the desired object settings. Make sure the Object Type is set to your desired object, such as “oOrders”.

    Select the Object Type (1).
    Select the Object Type (1).
  • Enter a key or Core Document Content. The Key can be used to load existing objects in edit or display (read-only) modes. Core Document Content can be used to insert, update, or delete Units of Work (uow).
  • Use the desired transaction button to update an object and retrieve the corresponding REST URL.

Shown below are two examples, first showing how to load a specific object for review and the second showing loading a Unit of Work for review.

Loading an object

Enter a transaction type (1) and key (2) to update/view a specific document. Press the Load Object button (3) to view the xml data for the selected key.
Enter a transaction type (1) and key (2) to update/view a specific document. Press the Load Object button (3) to view the xml data for the selected key.
After Loading Object, see the result XML (2) and that object's REST URL (1).
After Loading Object, see the result XML (2) and that object's REST URL (1).

Loading a Unit of Work

Enter Core Document Content (1) and use the desired Unit of Work (uow) transaction button (2).
Enter Core Document Content (1) and use the desired Unit of Work (uow) transaction button (2).
After performing a transaction, see the REST URL for that transaction (1).
After performing a transaction, see the REST URL for that transaction (1).