. . .

XML Module

Using the XML module you can import or export your data using XML file(s). These file(s) may be imported directly or via an URL on another web server periodically.

images/download/attachments/17236306/db3-module-xml.PNG

Configuration

XML URL

When importing XML from an URL, the resource where the XML data can be found must be specified here.

XSLT URL

When importing XML from an URL, your can provide an URL to a XSLT stylesheet which will convert your XML to the format ApiOmat requires.

Import period

Interval in minutes to trigger the import; you have to provide a complete path to the XML file to import as callback URL.

List separator character

Character used to separate entries in lists. This is used if one of the im- or exported fields contains a collection as value. Default value is ‘|’, a typical list entry would look like [1|2|3], where the braces indicate the value as list.

Charset

Charset of your data. Hint: MS Excel in a western country will use Windows-1252

Usage

After setting the configuration parameters, you will be able to ex- or import data in the dashboard data screen. Additionally, you may use the REST interface to upload (import) or download (export) data.

Export

To support the export of very large data entries, each field value of one data entry is limited to a size of 100.000 characters. This value can be increased in the yambas properties file.

The usual limitation of a maximum result set size is not taken into account when exporting data. Therefore, an export of a large dataset could last several minutes. You can limit the result set with the limit/order query operator (see example below).

curl http://apiomat.org/yambas/rest/modules/xml/spec/YOUR_APPNAME -u YOUR_EMAIL:YOUR_PASSWORD > export.xml

You may also filter classes to export using the ‘classesToExport’ query parameter and a comma separated list of classes which you want to be exported:

curl "http://apiomat.org/yambas/rest/modules/xml/spec/YOUR_APPNAME?classesToExport=car,tire" -u YOUR_EMAIL:YOUR_PASSWORD > export.xml

If you have multiple modules with classes that have the same name, you can prepend the classnames with the module name and a dollar sign after the module name:

curl "https://apiomat.org/yambas/rest/modules/xml/spec/YOUR_APPNAME?classesToExport=MyModule$car,MyModule$tire" \
-u YOUR_EMAIL:YOUR_PASSWORD > export.xml

You can also filter exported data using a query:

curl "https://apiomat.org/yambas/rest/modules/xml/spec/YOUR_APPNAME?q=lastModifiedAt>date(1413842400000)" \
-u YOUR_EMAIL:YOUR_PASSWORD > export.xml

Or limit the resultset:

curl https://apiomat.org/yambas/rest/modules/xml/spec/YOUR_APPNAME?q=limit%20100&offset%2010 \
-u YOUR_EMAIL:YOUR_PASSWORD > export.xml

Import

Assuming import.xml containing all classes as XML data, the import command would look like:

curl -X POST http://apiomat.com/yambas/rest/modules/xml/spec/YOUR_APPNAME -u YOUR_EMAIL:YOUR_PASSWORD --data-binary @import.xml -H "Content-type:application/octet-stream"

Each exported dataset of your own classes contains an ID field, which is the ID from ApiOmat database. Do NOT change this field if you want to update the dataset. If you create new entries, leave this field empty. Self-created IDs will lead to import errors. If you want to give your new data entries an ID, you can use an arbitrary (but unique) value in the foreignId field. You can even use this foreignId if you want to set references from other classes.

Special attribute types

If you want to import images, you can specify their URL in the import XML. They will be automatically fetched.

If you want to use dates, their format must follow the Java date format LONG or SHORT.

My Modules

The XML Module comes with a tool which allows you to import or export files containing XML Data in an easy dialog.
So you don’t have to use the Rest-Interface to download/upload your data.

images/download/attachments/17236306/xml_withlimit.png