Support and Docs

3 Topics
Last post 11 November 2014 By Nadja Kristiansen
1 Topics
Last post 20 March 2014 By Carsten E. Madsen
0 Topics
Last post N/A By N/A
0 Topics
Last post N/A By N/A
1 Topics
Last post 02 April 2014 By Carsten E. Madsen

Data space

  • 06/09/2016

The Data space feature makes it possible to import any kind of data to an account, that can be used in the shop front-end using script. Data space is an account-specific no-SQL elasticsearch database, that can hold a huge amount of data and offers amazing performance for retrieving data using the Data space API or runtime values.

Each account has one data space, which in turn may contain several different tables. Accounts will be billed according to disc space consumption and usage (e.g. number of requests/traffic).

Importing and maintaining data space tables

Data is currently imported to a data space via FTP XML integration, hence the data may come from the ERP system or any other system capable of delivering data in the required format.

It is possible to create complex objects with nested objects and arrays. It is even possible to import data already formatted as JSON using the XML import. See the XML schema documentation for more information about importing data space tables.

Have a look at this example import file containing a data space table named “ShopLocations”, which contains information about three different physical (imaginary) shops.

Each of the entries in the file will upon import be transformed and stored as JSON in the data space table, and each entry will look somewhat like this:

Accessing data from a data space table

Information from a data space table may be accessed via the Data space API using script or by using runtime values (e.g. in a content design).

Getting data from a Data space using the API

The Data space API has the service URL:
/services/v1/dss/

It accepts the following URI parameters, which map directly to elasticsearch URI search.

  • q: optional
    The query string – is passed to elasticsearch as-is. Defaults to "*".
  • _source: optional
    Allows you to specify fields to return in the response. It often makes sense to limit the result fields to what is actually needed, in order to improve performance, reduce the data amount and minimize bandwidth consumption.
    Example:
    /services/v1/dss/shoplocations?_source=Shop.Name,Shop.GeoLocation.Latitude,Shop.GeoLocation.Longitude
    - Returns only the fields Name, Latitude and Longitude.
  • sort: optional
    Allows you to sort the result by one or more fields - fieldName:asc/fieldname:desc.
    There can be several sort parameters (order is important).
    Example: /services/v1/dss/menulevelspecification?sort=Shop.Name:asc
    - Sorts the results by Name ascending.
  • from: optional
    Defines the offset from the first result you want to fetch.
    Example: /services/v1/dss/menulevelspecification?from=5
    - Gets results starting from the 5th result
  • size: optional
    Allows you to configure the maximum amount of hits to be returned (defaults to 10.000).
    Example:/services/v1/dss/shoplocations?size=10
    - Gets the first 10 results
    /services/v1/dss/shoplocations?from=5&size=10
    - Gets the next 10 results from the 5th result
  • source: optional
    Supports searching by defining the request body as JSON. Makes it possible to perform JSON aggregation and use other advanced elasticsearch features. Read more about elasticsearch search requests here.

The Data space API returns results formatted as JSON. If no “size” parameter is set in the request, it returns up to 10.000 results.

Getting data from a Data space table using runtime values

You can query a data space table directly from a content design using runtime values.

The syntax for querying a data space table using runtime values is:
DataSpace:<tablename>[index].<field>.<field>...<field>?<elasticsearch options>

where:

  • <tablename> is the data space table name - case insensitive.
  • [index] is a required indexer (resulting table is treated as an array with zero or more entries).
  • <field> is fields as seen in the JSON result - as with other runtime values, you may dive into the object hierarchy - case sensitive.
  • <elasticsearch options> are the same options as supported by the data space API - here you write your query - are inherently case sensitive.
  • Examples:
    <eSeller:Select Value-Of="DataSpace:shoplocations[0].Shop.Name?q=Shop.Address.ZipCode:"5000"" />
    - Returns the “Name” value for the first shop with zip code “5000” from the data space table “shoplocations”.

    <eSeller:Select Value-Of="DataSpace:shoplocations[0]?q=Shop.Address.ZipCode:"6000"" />
    - Returns the first “Shop” object (as JSON) that has zip code “6000” from the data space table “shoplocations”.

    <eSeller:Select Value-Of="DataSpace:ShopLocations[0]?q=(Shop.Address.ZipCode:"6000")AND(Shop.Employees:"April")" />
    - Returns the first “Shop” object (as JSON) for the shop with zip code “6000” and that has the employee “April”.

Viewing data space tables in the shop administration

In the shop administration you can see a list of all data space tables for an account. The data space overview is located at Integration > Import/Export > Data space.

The overview displays the table name and cache control information about all data space tables in the account.

By clicking “View sample” you can see what kind of information the data space table holds (displays the first 5 entries), and from there you can also click a link to see the response directly in the browser (thus revealing the URL of the data space table).