1. Home
  2. ERPAG
  3. API Script
  4. Add Sales Order

Add Sales Order

By calling the URL endpoint with the POST method, this endpoint returns a JSON object with new created Sales Order ID and Sales Order Number.

Example:

Post the JSON object in body request for the sales order whose JSON looks like sample below (call URL https://api.erpag.com/salesorder/add?addcustomer=true&additem=true with POST method and JSON body).

When sending a request, it is possible to send the addcustomer and additem parameters through the request URL. The parameter addcustomer=true enables the automatic creation of a Customer if it does not exist. The parameter additem=true enables the automatic creation of an Item if it does not exist. If the parameters are not defined, the API will check their existence and return an error with the message that the Customer or Item was not found.

Body JSON sample:

Explanation:

  • key – The Customer Key (optional)
  • tag – Sales Order Tag (optional)
  • name – Customer Name (mandatory). If Customer does not exist, ERPAG will generate a new Customer.
  • tin – Customer Tax Identification Number (optional)
  • email – Customer email (optional)
  • address1 – Customer address (optional)
  • address2 – Customer address (optional)
  • city – Customer city (optional)
  • zipcode – Customer ZIP Code (optional)
  • items – array of sales order line items
  • Item:
  • id – The Item ID (optional)
  • sku – The Item SKU number (optional)
  • description – Item Description/Name (mandatory)
  • uom – Unit of measure (optional)
  • qty – line item quantity (mandatory)
  • price – line item tax included price (mandatory)

Result:

Explanation:

id – ID of created Sales Order

number – Sales Order Number

Note: Access to this API endpoint is allowed only for selected API User account using the API key and API password in the request header with the key name “Authorization” and key value “Basic base64encoded(api_key:api_password)“, or URL parameters ApiKey and ApiSecret for example https://api.erpag.com/item/add?ApiKey=key_056a9spfg1qubg34e409ee233d&ApiSecret=sec_IKJ4Sc2G8jHfr3sHbxQwEfev-Az-1YaF

How can we help?