XEDI API Documentation

Access your orders and post invoices to your XEDI account


Introduction

We want to make it as easy as possible to make your software 'Web EDI Ready'.

Connect to any EDI system, any message standard, any mapping, any connection type using one standard format via the Web EDI API. Connecting your users to multiple trading partners has never been so easy.

Introducting the Web EDI API

The Web EDI API currently supports the following documents:

      - Orders
      - ASNs (Advanced Shipping Notes)
      - Invoices

We trust you'll find using the Web EDI API really quick and simple, maybe even fun.

If you have any suggestions, queries or unique requirements, then please get in touch.

In the meantime, happy coding!

Getting Started

Getting Started

When calling the Web EDI API, it is always necessary to pass a 'Magic Key'.
The Magic Key is a security key that grants access to a user account and allows you to send/recieve data.

General

You are free to use HTTP GET requests to pass variables to the web service.
It is preferrable to call the web service over HTTPS, however this is not mandatory as your request will be automatically forwarded over an SSL/TLS connection.

Authentication

When a Web EDI user has indicated they would like your software to integrate with their Web EDI account, you will be issued with their 'user id' and accociated 'magic key'. To check your magic key is correct, use the following syntax:

https://api.webedi.co.uk/auth.php?user_id=2321&magic_key=0f9c264

The system will return either True or False.

You won't need to use auth.php as part of your normal hourly run, as the user_id & magic_key must be passed for every function (such as listing new orders and retrieving each order). We've just made it available to assist you during your inital setup.

Orders

Web EDI checks for new orders every hour, and when found, imports them into the system and sends a notification email to the related user. In order for your system to check if a Web EDI user has recieved any new orders, you can use the following command (which you may wish to run as an hourly cron job):

List Orders

https://api.webedi.co.uk/list_orders.php?user_id=2321&magic_key=0f9c264&mode=all

user_id=1234: specifies the user id for a particular Web EDI user
magic_key: each user has their own magic key for API authentication
mode=all: returns the order_id for all orders for this user
mode=new: returns the order_id for each order not flagged as 'Exported'

This will return a list of order_id's, seperataed by commas.

You can 'explode' this result into an array and cycle through each value to return each order in xml format.

Get Order

https://api.webedi.co.uk/get_order.php?user_id=2321&magic_key=0f9c264&order_id=36780

This will return the order as an xml document.

This function can also be used to return orders if they are not new (flagged as 'Exported').

Mark As Exported

Once you have sucessfully got recieved your order using the function above, you will want to flag on the system that this order has now been exported, and thus will remove it from list_orders.php&mode=new.

https://api.webedi.co.uk/mark_as_exported.php?user_id=2321&magic_key=0f9c264&order_id=36780&exported=true

During development, you may wish to make the order appear back on the list again for testing. You can do this by setting the exported flag to false

https://api.webedi.co.uk/mark_as_exported.php?user_id=2321&magic_key=0f9c264&order_id=36780&exported=false

Invoices

There are two simple functions available to submit invoices to Web EDI.

Header

https://api.webedi.co.uk/submit_invoice_header.php

usage: submit_invoice_header.php and pass the following mandatory values
  user_id=2321: specifies the Web EDI userid (source: fixed)
  magic_key=0f9c264: specifies the security key accociated with the user_id (source: fixed)
  invoice_no: Specifies the Invoice Number to be sumitted (source: your system)
  invoice_date: Specifies the Invoice Date in format dd-mm-yy (source: your system)
  delivery_note_no: Specifies the Delivery Note No (source: your system)
  delivery_date: Specifies the Delivery Date in format dd-mm-yy (source: your system)
  order_no: Specifies the Order No (source: get_order.php <OrderNumber>)
  order_date: Specifies the Order Date in format dd-mm-yy (source: get_order.php <OrderDate>)
  grn_no: Specifies the Goods Recieved Note Number (if not used, then use 'x') (source: your system)
  settlement_discount: Specifies the Settlement Discount amount (if not used, then please use 0) (source: your system)

You must also provide either (or both)
  branch_code: Specifies the Branch Code (source: get_order.php <BranchCode>)
-or-
  delivery_location_ana: Specifies the Delivery Location ANA Code (source: get_order.php <ANACode>)
  delivery_location_code: Specifies the Delivery Location Code (source: get_order.php <LocationCode>)
  delivery_location_name: Specifies the Delivery Location Name (source: get_order.php <LocationName>)
  delivery_customers_name: Specifies the Delivery Customers Name (source: get_order.php <CustomersName>)
  delivery_address1: Specifies the Delivery Address1 (source: get_order.php get_order.php <Address1>)
  delivery_address2: Specifies the Delivery Address2 (source: get_order.php <Address2>)
  delivery_address3: Specifies the Delivery Address3 (source: get_order.php <Address3>)
  delivery_address4: Specifies the Delivery Address4 (source: get_order.php <Address4>)
  delivery_address5: Specifies the Delivery Address5 (source: get_order.php <Address5>)

This function will add an invoice to the system and return the Invoice ID
The Invoice ID can then be specified in submit_invoice_lines.php to add line items to this invoice.

Lines

https://api.webedi.co.uk/submit_invoice_line.php

usage: submit_invoice_line.php and pass the following mandatory values
  user_id=2321: specifies the Web EDI userid (source: fixed)
  magic_key=0f9c264: specifies the security key accociated with the user_id (source: fixed)
  invoice_no: Specifies the Invoice Number to be sumitted (source: returned by submit_invoice_header.php)
  item_no: Specifies the item position, a sequential number for each line item starting with 1 (source: get_order.php <Position>)
  item_description: Specifies the Item Descrioption - maximum size is 50 chars (source: get_order.php <Description>)
  product_code: Specifies a Generic Product Code which is visible on the view_invoice screen (source: get_order.php <Product_Code>)
  supplier_code1: Specifies the EAN Code for Traded Unit (numeric up to 13 digits) (source: get_order.php <SupplierCode1>)
  supplier_code2: Specifies the Suppliers Code for the Traded Unit (alphanumeric up to 30 chars) (source: get_order.php <SupplierCode2>)
  supplier_code3: Specifies the DUN-14 Code for the Traded Unit (numeric product code up to 14 digits) (source: get_order.php <SupplierCode3>)
  suppliers_ean: Specifies the Suppliers EAN Code for Designated Consumer Unit (up to 13 digit product code) (source: get_order.php <SuppliersEAN>)
  customer_code1: Specifies the Customers Own Brand EAN Number (numeric up to 15 digit barcode) (source: get_order.php <CustomerCode1>)
  customer_code2: Specifies the Customers Item Code (up to 30 chars alphanumberic product code) (source: get_order.php <CustomerCode2>)
  pack_size: Specifies the number of units in a pack (i.e 24 tins of beans in a pack) also known as Consumer Units (source: get_order.php <PackSize>)
  quantity: Specifies the number of packs (source: get_order.php Quantity)
  price: Specifies the Price per pack to 4 decimal places (source: your system)
  vat_rate_code: Specifies the VAT Rate Code (ie. S=Standard, Z=Zero Rated, etc) (source: your system)
  vat_rate_percent: Specifies the VAT Rate Percent (ie. 17.5) (source: your system)
  settlement_discount_percent: Specifies the Settlement Discount percent up to 2 decimal places (ie. 2.5=2.5%) (source: your system)

This function will append an invoice line to an existing invoice on the system.
Returns True to confirm it has been added sucessfully.