About

XML2CSV is a web service for converting a valid EPCIS XML document to CSV, via file upload or TIX query.

/

The top level converts an uploaded EPCIS XML document to CSV.


Valid methods

POST


POST

Form fields

Key

Value

Required

Format

Description

file

binary data

X


The file containing EPCIS XML

exclude

string


tagName~RegExp

Exclude the whole event if tag text content matches RegExp.

Repeat exclude in form data for multiple excluded tag/value pairs.

filter

string


tagName!RegExp>>otherTagName
tagName!RegExp>>otherTag1,otherTag2,...,otherTagN

Apply RegExp to value of tagName and only include otherTagName (or otherTag1 through N if given a list) in output CSV if RegExp matches.

include

string


tagName1,tagName2,...,tagNameN

Only include tagName1 through N.

regex

string


tagName!RegExp>>newFieldName

Apply RegExp to value of tagName and insert content of first capture group into newFieldName in CSV.

There must be a capture group present for this feature to work. E.g. recordTime!^(2016)>>rec_year to put 2016 into rec_year if recordTime starts with 2016.

slice

string


tagName.$start.$end>>newFieldName
tagName.$start.$end>>newFieldName,otherTag.$start.$end>>otherNewFieldName 

Slice value of tagName from $start to $end and insert result into newFieldName. Both $start and $end are optional. Omit $start to slice from beginning of string. Omit $end to slice until end of string.

split_epcs

string



Any value for this key enables splitting EPC's. What it does is for fields like inputEPCList where there might be many EPC's, it will output the CSV with one EPC per row and all other columns will be duplicated in each row.


Example request and response

Request
filter: readPoint!.*\.NO0418\.2>>carcassId
exclude: eventTime~^2014
exclude: eventTime~^2015
include:
regex: recordTime!^(2016)>>rec_year
slice: recordTime..10>>rec_date,recordTime.11.>>rec_time
Response
rec_year,rec_date,rec_time,carcassId
2016,2016-11-24,12:15:31.685+01:00,
2016,2016-11-24,12:00:12.973+01:00,NO0418X0025750

/query/<url>/<node>

This level allows you to supply a TIX query string instead of uploading an XML document.

Valid methods

POST

POST

URL parts

Key

Value

Description

<url>

string

The host to query.

<node>

string

The nodeId to query.

Omitting <url> and/or <node> will yield a 404 response.

Form fields

Same as for / without file. Additional fields:

Key

Value

Required

Description

query

string

X

See Event Queries. This is the string representation as you would supply to your web browser, including the & between parameters.

days

integer


Days to query in the past. Sets GE_eventTime for you in the TIX query.

auth

base64 string

X*

If basic auth is not supplied or not supported by the client, you can supply the base64 part of the Authorization header in this field.

* Basic authorization is required to do a TIX query, so if it's not supplied as a header the auth field must be set in the form data.

Example request and response

Request: URL=/query/tix.tracetracker.com/1000002098000013
query: MATCH_anyEPC=urn:epc:id:sgtin:702199.20101.647411510819
days: 30
filter: readPoint!urn:epc:id:sgln:702199.NO0418.2>>eventType,carcassId
Response
eventType,eventTime,recordTime,eventTimeZoneOffset,epcList,epc,action,bizStep,disposition,readPoint,id,bizLocation,weight,deviationCode,deviationLabel,deviationComment,carcassId
ObjectEvent,2016-11-24T12:03:24.032+01:00,2016-11-24T12:15:31.685+01:00,+01:00,urn:epc:id:sgtin:702199.20101.647411510819,urn:epc:id:sgtin:702199.20101.647411510819,OBSERVE,urn:epcglobal:cbv:bizstep:observation,urn:epcglobal:cbv:disp:in_progress,urn:epc:id:sgln:702199.NO0418.3,urn:epc:id:sgln:702199.NO0418.0,urn:epc:id:sgln:702199.NO0418.0,20000,,,,
TransformationEvent,,,,,,,,,,,,,,,,NO0418X0025750