How to use the Dataestur API to track tourism data

Discover how to use the API to download files and connect to the API to perform automatic updates
Dataestur's API service offers three free access solutions for monitoring tourism data:
- Downloading the data that make up the analytical dashboards. These are xlsx files for enhanced and easier processing with any basic office automation tool. You will have access to the historical data that is part of Dataestur.
- Connection via the URL to automatically download and update any data of interest from, for example, an office automation program, such as Excel.
- Connection through command line tools with URL clients (cURL) that facilitate data transfer requests from a server and their integration into other websites. This option may require more advanced technical knowledge to configure.
Below is a step-by-step guide for the first two options, with which any user can easily download the data.
Downloading queries from the Dataestur databases
Access to the Dataestur API service is available in the upper right corner of the website throughout navigation. Once inside, you will find all the queries published for the sources hosted on Dataestur. You can consult the details of the sources and data available in the site map .
STEP 1: Select the data source to download. For example, the Hotel Occupancy Survey, which you will find in the "Accommodation" thematic section, under the name "EOH". This source is available for has five different queries that allow users to download or automate the updating of data according to the country of origin of the tourists, to their destination (whether at the autonomous region, province, area or tourist spot level) or to the accommodation category.
STEP 2: Select the details to download from the query. To do this, first click on the "Try it" button and this will enable the various options below. In general, you must enter the period of time for the query (note that each piece of data, such as start or end year or month, is added in a separate box) and the data filter (for example, if you are configuring the EOH data to download by accommodation category, you would need to select the category of interest). In many cases, a second filter appears. In the example of the EOH, you can select information by place of residence of the tourist (any, national or international).
STEP 3: Generate the query by pressing the "Execute" button. The action will return three results. To download the xlsx file, select the third option, which you can identify on a grey background. Click on the "Download file" button. This will start downloading the document and will make it available on your computer in a few seconds (by default it is stored in the "Downloads" folder of your browser).
STEP 4: Open the document with any data processing software, such as Excel or other spreadsheet software, such as LibreOffice or Google Sheets.
From there, you can process the data according to your needs and interests. Please note that this is a downloaded file. Therefore, it will not be updated as Dataestur is updated. If you are interested in keeping your information updated automatically, follow the instructions in the next section.
Steps to automatically update data from a spreadsheet
Again, the starting point is the Dataestur API service, which is always available in the upper right corner of the website.
STEP 1: The first steps are the same as for downloading a query from the database. Remember: select the data, choose the desired details from the search and generate the data document by clicking on the "Execute" button.
STEP 2: copy the address that appears in the second result and which is identified with the heading "Request URL"
STEP 3: Connect the API to an office tool such as Excel. The connection is made from the Data menu, through the "Get data" option and by selecting a website as the source. This option is usually found in the "Other sources" group. Simply add the URL copied in the previous step and click on "Continue" to connect.
STEP 4: load or transform the data to configure the appearance with each update.
Excel offers the option to load information directly or to transform the table so that the data is displayed according to the preferences saved. Some simple changes are renaming a variable, selecting the columns to display or splitting or grouping data sets.
After making the necessary changes, select "Load" to load the data.
STEP 5: configure the data update option. Automatic refresh can be scheduled from the Excel Data menu. Click on the query properties (usually under "Update all" or "Queries and connections"). From there, you can configure data to be updated at a certain interval, every time the document is opened or at your discretion.
From now on, every time the connection is updated, the latest data available in Datatestur will be incorporated into the Excel document.
Options to use the API service with spreadsheets
This API connection to tourism data allows for easy monitoring and the creation of indicators or automated reports with data of interest. This process can be carried out with any source available in Dataestur and can be configured for general data, such as, for example, the arrival of international and resident tourists, commercial air passenger figures or tourist expenditure. From Excel you can configure it to obtain indicators such as year-on-year variation, evolution graphs or comparisons between different destinations and origins.
An interesting option for small municipalities is to monitor the available tourist statistics, such as the experimental statistics of the INE on tourism based on mobile telephony use, which identifies international tourists and residents according to their origin or the data related to tourist housing. The data can be monitored, regardless of whether the municipality is a tourist destination classified as such by the INE or is part of one of the INE's tourist areas, with surveys on occupancy in tourist accommodation.
Having this updated data also allows comparisons to be made between destinations or the creation of indicators or dashboards with aggregated data based on interests. An example could be the creation of a monitoring report for a tourist area such as Costa Cálida. The data regarding tourists visiting municipalities could be updated with automated systems and trend indicators, comparing data and analysing variations in such data.
Similarly, updates and indicators could be customised for each of the municipalities. In this case, for example, monitoring Los Alcázares as a destination.
Connections via http requests
This type of connection allows the data available in Dataestur to be integrated into other systems or websites. In other words, it facilitates the direct consultation of information and its visualisation in data analysis tools. These connections work through web requests and are typically used programmatically or with specialised software. Its use requires more advanced technical knowledge than the previous examples.
The results of the "Request url" can be used with the Dataestur API service through programs, for example, in Python. Also, the first available result of any API query (identified with the "Curl" heading) provides the code to obtain the data from a terminal.