Fieldpine Logo Documentation Home  
Library
» Overview
» eLink API
» Wget & eLink

Using Wget and eLink

Wget is an open source utility provided by the GNU foundation. You can download copies from their website. This program allows simple command line fetching and writing of HTTP requests, which enables scripted batch jobs to read and write files to and from your retail system

This page is designed to show some common examples of how Wget may be used. Wget includes full documentation on how it works, and it is widely used over the internet.

Caution, some Wget parameter names are case sensitive

Wget cannot be used against Fieldpine Online as this requires an extra level of authentication. The instructions below are for directly communicating to your Store Servers and Head Office Servers

Extracting Products and Other Data

Data is eLink is extracted by requesting the end point (bucket) relating to the data desired. Our examples are mostly showing products, however you can extract customers, accounts, prepay, barcodes etc by changing filenames and parameters

Extracting all products as XML into file called Products.xml

WGET -O Products.xml http://server/GNAP/BUCK?3=retailmax.elink.products

Extracting all products as JSON into file called Products.json

WGET -O Products.json http://server/GNAP/j/BUCK?3=retailmax.elink.products

Extracting all products into an Microsoft Excel spreadsheet called Products.xlxs

WGET -O Products.xlsx http://server/GNAP/o/[xl,100,Products.xlsx]/BUCK?3=retailmax.elink.products

Extracting all products into a CSV file called Products.csv

WGET -O Products.csv http://server/GNAP/o/[csv,102,Products.csv]/BUCK?3=retailmax.elink.products

The above examples are extracting all products. You can include bucket specific selection filters by appending these to the end of the wget command line. Example, extracting only product #345

WGET -O Products.xml http://server/GNAP/BUCK?3=retailmax.elink.products&9=f100,0,345

Extracting a maximum of 4000 sales (header details only) made to customer #123 as XML into a file called BobSales.xml

WGET -O BobSales.xml "http://server/GNAP/BUCK?3=retailmax.elink.sale.list&9=f117,0,123&8=4000"

Extracting a maximum of 4000 sales (header details only) made to customer #123 in the last 7 days, as XML into a file called BobSales.xml

WGET -O BobSales.xml "http://server/GNAP/BUCK?3=retailmax.elink.sale.list&9=f117,0,123&8=4000&9=f101,4,today-7"

Uploading data into the Retaill System

XML documents containing native eLink Transactions

If your input is a file containing raw eLink transactions in XML form, use the following style of commands

WGET -O response.txt --post-file "File.xml" "http://server/GNAP/DATI?xml="

The above command can load files that contain single transactions

<DATI>
	<f8>retailmax.elink.sale.create</f8>
	<f11>I</f11>
	<f125>10</f125>
	...
</DATI>

The above command can also load files that contain multiple transactions, of mixed type, if the overall XML is wrapped in an ARAY. Each element in the array must be standalone and capable of being loaded in isolation

<ARAY>
	<DATI>
		<f8>retailmax.elink.sale.create</f8>
		<f11>I</f11>
		<f125>10</f125>
		...
	</DATI>
	<DATI>
		<f8>retailmax.elink.product.edit</f8>
		<f11>E</f11>
		...
	</DATI>
</ARAY>

Technical note. Wget --post-file uses content-type:application/xxx-form-url-encoded and not multipart-form-data. We prefer multipart-form-data if at all possible and you are writing directly to sockets. The structure of multipart form data requests is different to as shown above.