Skip to main content

Who Needs JSON Or XML, We've Got PML

In keeping with the original plan for this site, here’s another API I’ve had the pleasure of working with. This was required to send the 3rd party larger quantities of data on an almost daily basis. But instead of using a common format such as CSV, JSON, or XML, they chose to create their own structured data format using pipes, or as I liked to call it PML.

An example file looked like this.

H|Weekly Sales Totals|IMPORT
D|Contains|An|Address|On|A|Single|Row
SA|Sales Date|TEXT|26-05-2013
SA|Store Manager|TEXT|Mr. Manager
SA|Employee Count|NUMBER|1
SA|Daily Totals|CURRENCY|12.34
D|Contains|An|Address|On|A|Single|Row
SA|Sales Date|TEXT|27-05-2013
SA|Store Manager|TEXT|Mr. Manager
SA|Employee Count|NUMBER|2
SA|Daily Totals|CURRENCY|13.56
F|2

The first column of each row identified the type of line it was. There was H – header, D – data, SA – unsure what this stood for, and F – footer.

The header line contained the title/type of export. The actual data started with a data row containing an address all on one line followed by one line per each extra piece of data for that data row. Then the footer contained the total number of data rows like a checksum.