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

Add Purchase Order

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

Example:

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

When sending a request, it is possible to send the addsupplier and additem parameters through the request URL. The parameter addsupplier=true enables the automatic creation of a Supplier 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 Supplier or Item was not found.

Body JSON sample:

Explanation:

  • key – The Supplier Key (optional)
  • tag – Purchase Order Tag (optional)
  • name – Supplier Name (mandatory). If Supplier does not exist, ERPAG will generate a new Supplier.
  • tin – Supplier Tax Identification Number (optional)
  • email – Supplier email (optional)
  • address1 – Supplier address (optional)
  • address2 – Supplier address (optional)
  • city – Supplier city (optional)
  • zipcode – Supplier ZIP Code (optional)
  • items – array of purchase 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 purchase price (mandatory)

Result:

Explanation:

id – ID of created Purchase Order

number – Purchase 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?