Data Sources - Setting up your external test data

Creating a data source

Data sources can be created at the organisation level, meaning that the Data sources you create can be shared among the members of your organisation.

To create a data source:

  • Navigate to the Data Sources page.

    Data source menu item

  • Click on the button, +Create new data source.

Data source menu item

  • Choose the CSV file containing your data.

Data source menu item

  • Provide a name for your data source.

    Data source menu item

  • Click save at the bottom of the page.

    Data source menu item

Editing a data source

Data sources can be updated after creation.

To edit a data source:

  • Navigate to the Data Sources page.
  • Click on the data source you wish to edit, from the list provided.
  • Update your data source.
  • Click on the blue button(save) at the bottom of the page.

Data source menu item

Once in the data source page, you will be able to:

  • Replace the csv file
  • Rename the data source
  • Change the column types

Columns

Column names

When uploading the CSV file, please ensure the following requirements for the column names:

  • Column names must be unique within the CSV file.
  • Column names must be between 1 and 128 characters in length.
  • Column names can only contain letters, digits, the underscore character and spaces.

Also notice that column names will be lowered case.

Column types

Before saving the data source(or when editing it), you are able to amend the column data types. You will find a
setting icon below the column name and, when clicking on it, you will be able to select the correct type for the column, as shown in the following figure.

Data source menu item

The default data type is String, however you can pick any of the following types:

Data source type
BOOLEAN
DECIMAL
INTEGER
STRING
DATE
TIME (time zoned)
TIME (not time zoned)
DATETIME (time zoned)
DATETIME (not time zoned)

Example

username(string)age(integer)first_name(string)height(decimal)email(string)dob(datetime)premium(boolean)
admin64Bob1.8bob@example.com1962-12-31T16:50:31+05:00true
bill27Bill1.92bill@example.com1997-05-24T19:18:12Zfalse
jill15Jill1.70jill@example.com2009-11-07T04:34:01+01:00[Europe/Paris]false
jane74Jane1.81jane@example.com1952-01-13T10:10:10-12:00true

Date type

You can specify your own format string using the elements in the following table:

LetterDate or Time ComponentPresentationExamples
GEra designatorTextAD
yYearYear1996; 96
YWeek yearYear2009; 09
MMonth in yearMonthJuly; Jul; 07
wWeek in yearNumber27
WWeek in monthNumber2
DDay in yearNumber189
dDay in monthNumber10
FDay of week in monthNumber2
EDay name in weekTextTuesday; Tue
uDay number of week (1 = Monday, ..., 7 = Sunday)Number1
aAm/pm markerTextPM
HHour in day (0-23)Number0
kHour in day (1-24)Number24
KHour in am/pm (0-11)Number0
hHour in am/pm (1-12)Number12
mMinute in hourNumber30
sSecond in minuteNumber55
SMillisecondNumber978
zTime zoneGeneral time zonePacific Standard Time; PST; GMT-08:00
ZTime zoneRFC 822 time zone-0800
XTime zoneISO 8601 time zone-08; -0800; -08:00

Deleting a Data Source

Data sources can be deleted from your organisation. To delete a data source:

  • Navigate to the Data sources page.
  • Click on the delete icon for the data source you want to remove.

Delete a data source

Clicking on the delete icon will open a confirmation dialog. Click the Confirm button to confirm the deletion or Cancel to close the dialog without deleting the data source.

Delete data source confirmation

Clicking Confirm will delete the data source, but it will not remove the data source from any stubs that are using it. These stubs will continue to reference the deleted data source, but will act as if no data was returned when the data source is queried. See below for more details on stub matching and response templating when a data source is deleted.

When a data source is deleted, any data source limits you may have reached will be re-evaluated. If you have any disabled data sources, they will be re-enabled if you now have available capacity within your data source limits. You can read more about plan limits and disabled data sources here.

Any stubs that are using the deleted data source will now have a warning message displayed on the stub informing you that The data source that this stub was referencing no longer exists. You will also see a warning icon next to the data source summary in the stub form.

Data source stub warning icon

If you have other data sources within your organisation you can attach one of these to the stub to replace the deleted data source. If you do not have another data source that you can use, you will need to update the stub to remove the reference to the deleted data source.

You can do this by clicking on the delete icon next to the data source in the stub form.

Delete data source stub warning

Stub Matching

If a stub is using a data source that has been deleted, the stub will no longer match incoming requests if the Matches stub only if data is found tick box is checked on the Stub form. If this tick box is not checked, the stub will continue to match incoming requests, but the data source will not be queried.

Data source response templating

If a data source is deleted, any response templates that are using the data source will no longer be able to access the data source data. The response template will still be rendered, but the data source data will not be available.