Skip to content

Setting Up B2Brouter JSON Schema

The JSON request defines which data is transmitted to B2Brouter. For this purpose, an eDocuments schema in JSON format is used. The schema contains all the necessary JSON nodes and specifies which values are to be determined and transmitted for the individual fields.

Document Dispatch provides a preconfigured standard structure for the B2Brouter JSON request. This structure can be used as a starting point and adjusted to individual requirements as needed. After creating the schema, you should review the included nodes and ensure that all fields required for your use case are present.

Create a New JSON Schema

Create a new JSON schema to define the data structure for the B2Brouter JSON request. After creation, you can generate the predefined B2Brouter structure and then adjust it to your individual requirements.

Follow these steps to create a new JSON schema:

  1. Start the role center Document Dispatch - Administrator.
  2. Open the XSD Schemas page via the global search.
  3. Select New to create a new schema.
  4. Enter any unique Code for the JSON schema. The code serves to identify the schema and distinguish it from other schemas.
  5. Optionally provide a Description. This will be displayed in the schema overview and can be used to describe the purpose or content of the schema in more detail.
  6. Select the value JSON in the Schema Type field.
  7. Perform the action Create Schema Rows to generate the predefined B2Brouter JSON structure.
  8. Adjust the generated nodes and values according to your requirements.

Info

The structure provided by B2Brouter may change over time. New nodes or fields may be added. Therefore, regularly check whether your JSON schema still meets current requirements and add any missing nodes as needed.

Create Schema Rows

After the initial creation of a JSON schema, no nodes are displayed yet. Before the schema can be used or edited, the required schema rows must first be created. These define the structure of the schema and specify which nodes will be available later.

Only after creating the schema rows will the corresponding nodes be displayed in the schema overview and can be further configured.

Follow these steps to create JSON schema rows:

  1. Start the role center Document Dispatch - Administrator.
  2. Open the XSD Schemas page via the global search.
  3. Open the desired JSON schema or create a new schema using the description Create a New JSON Schema.
  4. In the Data menu, select the action Create Schema Rows.
  5. Confirm the displayed dialog boxes.
  6. The schema rows will be created, and the available nodes will then be displayed in the schema overview.

Set JSON Value Type

For each node, you can set the JSON Value Type. The value type determines the format in which the data is output in the generated JSON. Make sure to select the appropriate type for each field.

  • String for text values
  • Number for numeric values
  • Boolean for true/false values, such as true/false, Yes/No, or 1/0

Display JSON Field Information

Select a row in the JSON schema and perform the action Information. The detailed information about the selected JSON field will be displayed in a separate window and will help you better understand the meaning and use of the field.

Add Value to a Node

A value can be assigned to each node. The filling is done via an XSD Data Value, which at runtime takes the corresponding data from Business Central into the JSON file.

Numerous predefined data values are already available in the standard scope of eDocuments, which can be selected and used directly. This allows many fields to be filled without additional configuration effort.

Info

eDocuments already provides a variety of standard data values. If a required value is not available, it can be supplemented by a custom extension or configuration.

Follow these steps to assign a value to a node:

  1. Start the role center Document Dispatch - Administrator.
  2. Open the XSD Schemas page via the global search.
  3. Open the desired JSON schema.
  4. Select the node to which you want to assign a value.
  5. Click the ... button in the Value field to display the available XSD data values.
  6. Select the desired data value.

Info

The contact fields transport_type_code and document_type_code are not maintained directly in the individual schema rows. The values are automatically taken from the settings of the associated shipping profile.

Therefore, changes to these fields must be made in the shipping profile and not in the JSON schema.

Test B2Brouter JSON

With the action Test B2Brouter JSON, you can check whether the current JSON schema generates valid data for B2Brouter. For this purpose, a JSON document is created from a selected document and validated directly via the B2Brouter API. This allows you to identify configuration or mapping errors during setup before documents are sent productively.

  1. Start the role center Document Dispatch - Administrator.
  2. Open the XSD Schemas page via the global search.
  3. Open the desired JSON schema.
  4. In the Data menu, select the action Test B2Brouter JSON.
  5. Select any invoice and confirm the selection.

The system creates the JSON data based on the selected document and transmits it for validation to B2Brouter. The test transmission is then removed, and the validation result is displayed. This provides you with immediate feedback on whether the JSON schema meets the requirements of B2Brouter.

Export JSON

With the action Export JSON, you can generate a JSON file directly from a JSON schema. The nodes, structures, and values defined in the schema are automatically taken into account. This allows for easy verification of the schema as well as the creation of example or test files for further validations and integrations.

Follow these steps to export a JSON:

  1. Start the role center Document Dispatch - Administrator.
  2. Open the XSD Schemas page via the global search.
  3. Open the desired JSON schema.
  4. In the Data menu, select the action Export JSON.
  5. Select any invoice and confirm the selection.
  6. The generated JSON file will be saved in your download folder.

With the Schema Data Search, you can specifically search for nodes within a JSON schema and quickly find them in the schema structure.

Follow these steps to use the Schema Data Search:

  1. Start the role center Document Dispatch - Administrator.
  2. Open the XSD Schemas page via the global search.
  3. Open the desired JSON schema.
  4. Navigate to the Schema Data Search field.
  5. Enter the name of the desired node or a part of the node name in the search field.
  6. The search is executed with Enter or by leaving the field. If a matching node is found in the schema, it will be automatically displayed in the schema structure.

Note

You can also use the Schema Data Search to specifically search for Business Transaction fields (BT fields). This allows you to quickly find the corresponding nodes within the JSON schema.

Linked Data

With the linked data, values for schema processing can be stored and managed. These values can be used to provide information, supplement missing details, or replace existing values during the creation of the XML or JSON file with other values.

This allows schemas to be flexibly adapted to individual requirements and ensures consistent output of the data. Linked data is particularly used for schema nodes that require specific values or whose content should be adjusted based on defined rules.

Follow these steps to adjust data:

  1. Start the role center Document Dispatch - Administrator.
  2. Open the XSD Schemas page via the global search.
  3. Open the desired JSON schema.
  4. In the Data menu, select the action Linked Data.

Here you can edit existing entries or create new mappings. The defined values will be automatically taken into account when creating the XML or JSON file and applied according to the stored rules.

See also