Skip to main content

RestJson - Send order

RestJson Connector - SendOrderToBackoffice This document describes the process of sending an order from App4Sales to a backoffice system u...

Updated over a week ago

RestJson Connector - SendOrderToBackoffice

This document describes the process of sending an order from App4Sales to a backoffice system using the RestJson connector. The process involves validating the order, mapping the App4Sales order object to a JSON payload, and sending it to the backoffice via a REST API.

Data Source Configuration

The RestJson connector sends orders to a RESTful API endpoint. The specific endpoint for sending orders is configured in the connector's settings and is typically something like /api/Orders. The connector uses a POST request to send the order data in JSON format.

Order Header Logic

The order header contains general information about the order, such as the customer, order date, and total amounts. The following table shows the mapping of App4Sales order header fields to the JSON payload.

App4Sales Field

Source Field (JSON)

Logic/Notes

Id

Id

The OrderID from the App4Sales Order object.

Number

Number

The order number from the App4Sales Order object.

Customer

Customer

The GUID of the customer.

CustomerCode

CustomerCode

The code of the customer.

Created

Created

The current date and time when the order is being processed.

Date

Date

The order date from the App4Sales Order object.

IsOpen

IsOpen

Hardcoded to true.

Notes

Notes

The notes from the App4Sales Order object.

Description1

Description1

The Description1 from the App4Sales Order object.

Description2

Description2

The Description2 from the App4Sales Order object.

Description3

Description3

The Description3 from the App4Sales Order object.

Reference

Reference

The Reference from the App4Sales Order object.

SubTotal

SubTotal

The total amount excluding VAT.

Total

Total

The total amount of the order.

VatTotal

VatTotal

The total VAT amount.

YourReference

YourReference

The YourReference from the App4Sales Order object.

Username

Username

The username of the sales representative.

Warehouse

Warehouse

The warehouse of the sales representative. This is only set if the UseWarehouseFromUser setting is enabled.

Signature

Signature

The signature from the App4Sales Order object.

DeliveryMethodCode

DeliveryMethodCode

The code of the delivery method.

OrderType

OrderType

The value of the order type that should be sent to the backoffice. This is only set if OrderType.SendToBackoffice is true.

DeliveryAddress

DeliveryAddress

The alternate delivery address. This is only set if an alternate address is provided and the DontSendAlternativeAddressOnOrder setting is false.

Line & Pricing Logic

The order lines contain information about the individual products in the order. The following table shows the mapping of App4Sales order line fields to the JSON payload.

App4Sales Field

Source Field (JSON)

Logic/Notes

Id

Id

A new GUID is generated for each order line.

Customer

Customer

The GUID of the customer.

Discount

Discount

The discount percentage for the order line.

TotalDiscount

TotalDiscount

The total discount amount for the order line.

ItemCode

ItemCode

The item code for the order line.

Quantity

Quantity

The quantity of the item.

QuantityDelivered

QuantityDelivered

The delivered quantity of the item.

VatPercentage

VatPercentage

The VAT percentage for the item.

PriceExcl

PriceExcl

The price of the item, excluding VAT.

PriceIncl

PriceIncl

The price of the item, including VAT, calculated using Calc.PriceIncl.

DefaultPrice

DefaultPrice

The default price of the item.

LineNumber

LineNumber

The line number of the order line.

Instruction

Instruction

The instruction for the order line.

ItemDescription

ItemDescription

The description of the item.

DeliveryDate

DeliveryDate

The delivery date for the order line.

Charges & Attachments

The RestJson connector does not currently support sending separate charges or attachments with an order. Any charges, such as freight or payment fees, must be added as order lines.

Responses & Error Handling

The backoffice system is expected to return a JSON response containing the order number of the newly created order. The connector will then update the order in App4Sales with this order number. In case of an error, the connector will log the error and return an error message to the user. The connector has specific handling for RestException and RequestException, and a general exception handler for other types of errors.

Related Settings & Prerequisites

  • ValidateOrderBeforeSending: If enabled, the connector will check if the order already exists in the backoffice before sending it.

  • DontSendAlternativeAddressOnOrder: If enabled, the connector will not send the alternative address on the order to the backoffice.

  • UseResultsTagForRequest: If enabled, the connector will wrap the request in a BaseResponse2 object. This is a setting that is typically hidden and used for specific implementations.

  • FilterNonIso88591Characters: If enabled, the connector will remove non-ISO-8859-1 characters from the order. This is a setting that is typically hidden and used for specific implementations.

  • UseWarehouseFromUser: If enabled, the connector will use the warehouse from the user.

Did this answer your question?