Export configuration

This topic describes how to configure data exports using the Rebilly API.

Date ranges

Use date ranges to limit the export data to a specific time frame. To ensure that the data is current and processed quickly, always set date ranges for data exports.

Relative date range examples

Export data from yesterday:

'dateRange': { 'start': 'yesterday', 'end': 'today' }

Export data from the previous month:

'dateRange': { 'start': 'first day of last month midnight', 'end': 'first day of this month midnight' }

Export data from the last three days, starting at midnight:

'dateRange': { 'start': '3 days ago midnight', 'end': 'now' }

Additional valid date inputs:

  • yesterday
  • midnight
  • today
  • now
  • noon
  • tomorrow
  • back of
  • front of
  • first day of
  • last day of
  • ago
  • dayname

Absolute date range examples

Do not use absolute date ranges to create a recurring schedule for a data export. If an absolute range is used, it will result in the same exact data exporting each period.

When supplying a start or end date in absolute format, use the ISO 8601 format.

From 2018-01-21 at 15:15:15 until now:

This example combines absolute and relative dates.

'dateRange': { 'start': '2018-01-21T15:15:15Z', 'end': 'now' }

From 2018-01-21 at 15:15:15 until 2018-02-21 at 15:15:15:

This example uses two absolute dates.

'dateRange': { 'start': '2018-01-21T15:15:15Z', 'end': '2018-02-21T15:15:15Z' }

Date range field example

By default, the date range applies to the time at which a transaction is processed. To select another field, use the field attribute. This example describes how to apply a date range filter to the time at which a transaction is created.

For more information, see Fields.

'dateRange': { 'start': 'yesterday', 'end': 'today', 'field': 'createdTime' }

Fields

Use fields to specify the data to export in your request.

'fields': ['id', 'email', 'firstName', 'lastName', 'createdTime', 'averageValue/amount']

Export embedded fields

To export fields from embedded resources in the detailed-csv format, use the _embedded prefix followed by the resource name and the field name. Separate the prefix, resource name, and field name with a forward slash (/).

'fields': ['id', '_embedded/customer/firstName', '_embedded/customer/email']

Use wildcards in detailed-csv exports

When you export data in the detailed-csv format, use the asterisk wildcard (*) to extract data from fields that contain an array of objects (lists).

  • Export items as JSON: To export each item in an array as a JSON object within a single cell, append /* to the field path. If the array contains multiple items, they are separated by commas.

    'fields': ['billingAddress/phoneNumbers/*']

    Example output: {"label":"work","primary":true,"value":"+123456789"}

  • Export specific values from an array: To extract a specific property from each item in an array, append /*/<propertyName> to the field path. The extracted values are joined by commas in a single cell.

    'fields': ['billingAddress/phoneNumbers/*/value']

    Example output: +123456789

If you need a field that is not available in Rebilly, create your own Custom fields.

Arguments

Use arguments to filter, search, and sort the data in your export request.

For more detailed information on how to use filters, see Search filters.

'arguments': { 'filter': 'string', 'sort': 'string', 'q': 'string' }

Filter by approved:

'arguments': { 'filter': 'result:approved' }

Filter voids and refunds:

To filter by multiple values for the same field, separate filter names using a comma.

'arguments': { 'filter': 'type:void,refund' }

Filter approved voids and refunds:

To filter by multiple values on more than one field, separate filter names using a semicolon. For more information, see Compound filters.

'arguments': { 'filter': 'result:approved;type:void,refund' }