User Tools

Site Tools


importing

Importing XML

Importing the XML from our servers to yours can be as simple or as complex as you need. Cruise Factory currently offers two types of data download services.

Types of data services

/services/

This is a simple data service that provides the full table of data all of the time. Accessing the regular full data service by using the /services/ URL. For example:

http://feeds.cruisefactory.net/services/YOUR_KEY/get/TABLE_NAME

The full service download is best used for tables that are not updated regularly, although it can be used for any and all tables at your discretion.

/increment/

This is an incremental data service that sends only updated data. Accessing the incremental data service by using the /increment/ URL. For example:

http://feeds.cruisefactory.net/increment/YOUR_KEY/get/TABLE_NAME

Incremental service differences

The increment data service is different from the regular full services due to a number of reasons.

  1. The first being the fact it is incremental as the name implies.
  2. By default it will only return rows of data that have been added or updated within the last 24 hours. This default value can be changed by adding the “days” parameter to the end of your URL which is explained below.
  3. Because of its incremental nature, it includes a new element named “delete” (which contains a sub-element named “ids”). More details on the delete element below.

Incremental services days parameter

The days parameter gives you the ability to re-download older data or have old delete ids appear in your feed to make sure your database is always up-to-date and accurate. To use the days parameter you must add the number of days to go back to the end of your URL, the number of days is up to you and has no limits. For example to go back 7 days to retrieve the last week of updates/additions and deletions you would use this URL:

http://feeds.cruisefactory.net/increment/a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5/get/specials/days/7

The days parameter defaults to 1 day if none is given.

Incremental services delete element

This new element will include (if any) a comma separated listing of all IDs which you must delete from your specified table. For example; if you download the dining table and have 3,5,7 in your delete element:

<delete>
	<ids>3,5,7</ids>
</delete>

Then you must delete IDs 3, 5 and 7 from your dining table that is located in your local database.

Retrieval methods

Downloading the XML is done via URLs. If you've read the types of data services section above, then you've already seen how the URLs are created. To further explain; apart from using either the /services/ or /increment/ retrieval type, you will need your secure key and the name of the table you'll be downloading. You then put them together to build the download URL, for example:

http://feeds.cruisefactory.net/increment/a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5/get/specials

The above URL will download the specials table from the incremental data service with only the last 24 hours of updates/additions.

Automated XML data download

Having the XML data downloaded automatically via a cron job or other equivilant is recommended as having the database updated during less busy times and regularly is best practice. Without automating this process, you can have the possibility of out of date data in your local system.

Importing into your database

To make importing easier we have provided an example schema that matches the table/column structure of the XML data service. You should be able to download and import the XML directly into this example database.

importing.txt · Last modified: 2012/12/31 15:12 by cruisefactory