====== 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. - The first being the fact it is incremental as the name implies. - 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 [[importing#incremental_services_days_parameter|which is explained below]]. - 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 [[importing#incremental_services_delete_element|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: 3,5,7 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 [[importing#types_of_data_services|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 [[setup#secure_key_updating_recipient_ip_address|secure key]] and the name of the [[structure#table_layouts|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 [[download_example_schema|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.