Statistics Portugal - Web Portal
Official Portal - Statistics Portugal

API - Dissemination Database


The needs of our users are very important, so in accordance with the new technological trends, Statistics Portugal (INE) provides an API for the creation/extraction of a catalogue of indicators available in our Website Database, and for the extraction of the indicators and related metadata.
This service is characterized by:
 
  • Real Time Update;
  • Available in Portuguese and English;
  • Freely accessible; free of charge.
  

API - Catalogue of INE´s indicators in the Database

User´s Manual

In a simple and automated way, the catalogue of indicators allows users, to collect and catalogue the information related to the Indicators, published in the Database.
Description of Tags:
  • extraction_date -> Date of the catalogue extraction
  • source -> Source "INE"
  • language -> Language of the catalogue extraction “PT” or “EN”
  • theme -> Indicator theme, the same as the classification used in INE´s website
  • subtheme -> Indicator subtheme, the same as the classification used in INE´s website
  • keywords -> Keywords
  • title -> Indicator´s title
  • varcd -> Indicator´s code
  • description -> Indicator´s description
  • geo_lastlevel -> Maximum geographical breakdown of the indicator
  • last_period_available -> Last available period
  • last_update -> Last update date
  • periodicity -> Indicator´s periodicity
  • update_type -> Update type
    It also may contain:
       D = Available (indicators that are not “New” or “Updated”)
       A = Updated (the data was updated over the last 20 days concerning the catalogue extraction date)
       N = New (new indicator made available in the last 20 days concerning the catalogue extraction date)
  • bdd_url -> Link to the indicator in INE´s website
  • metainfo_url -> Link to the Metadata in INE´s website
  • json_dataset -> Link to the API that "returns" the Dataset of the Indicator "with all its dimensions", in JSON format
  • json_metainfo -> Link to the API that “returns” the Metadata of the Indicator, in JSON format
Example of a XML file - "Catalogue" type - of an indicator, for example, code: 0004167
 

 Example:
  {host_url}/ine/xml_indic.jsp?opc1&varcd={varcd_cod}&lang={lang}  
                    https://www.ine.pt/ine/xml_indic.jsp?opc=1&varcd=0004167&lang=EN

Input Arguments:
  

host_url -> Host address of INE´s website, (https://www.ine.pt)
varcd_cod -> Code of the indicator to be extracted  
lang ->  Language “PT” or “EN”

Output "XML" format

<catalog>

  <extraction_date>Tuesday, 06 November 2018, 02:47:10.350 PM</extraction_date>

  <source>INE - Instituto Nacional de Estatistica</source>

  <language>EN</language>

  <indicator id="0004167">

   <theme>Population</theme>

   <subtheme>Population estimates</subtheme>

   <keywords>INE,Resident,(No.),population,Population,Population estimates</keywords>

   <title>Resident population (N.º)</title>

   <varcd>0004167</varcd>

   <description>Resident population (N.º) by Place of residence, Sex and Age group (By life cycles); Annual - Statistics Portugal, Annual estimates of resident population</description>

   <geo_lastlevel>Distrito</geo_lastlevel>

   <dates>

     <last_period_available>S7A2017</last_period_available>

     <last_update>15-06-2018</last_update>

    </dates>

   <periodicity>Annual</periodicity>

   <update_type>D</update_type>

   <html>

    <bdd_url>https://www.ine.pt/xurl/indx/0004167/EN</bdd_url>

    <metainfo_url>https://www.ine.pt/xurl/metax/0004167/EN</metainfo_url>

   </html>

   <json>

    <json_dataset>https://www.ine.pt/ine/json_indicador/pindica.jsp?op=2&varcd=0004167&lang=EN</json_dataset>

    <json_metainfo>https://www.ine.pt/ine/json_indicador/pindicaMeta.jsp?varcd=0004167&lang=EN</json_metainfo>

   </json>

  </indicator>

</catalog>

  Automatic extraction for Catalogue generation, available options:
 
 a) One indicator (opc=1) : indicator code + language
 Example: https://www.ine.pt/ine/xml_indic.jsp?opc=1&varcd=0004167&lang=EN

 
 b) Group of “Main Indicators” (opc = 3) (+ - 260 Indicators), it may take some time to generate this file (we advise you to run this procedure during low traffic hours):
 Example: https://www.ine.pt/ine/xml_indic.jsp?opc=3&lang=EN

 



API - JSON - Indicator Data - Database

User´s Manual

The JSON API for extracting and querying indicators (REST request service type) allows the access to INE´s Database which contains all the indicators publicly accessible and free of charge.
This API allows you to extract data automatically and through the use of filters, using the indicator code and its dimensions. The dimensions change according to the indicator, so each indicator´s metadata and its dimensions must be verified beforehand.
The indicator´s metadata is available at http://smi.ine.pt/?LANG=EN
This Service generates a JSON file to be utilised by computer applications for the dissemination of statistical data, or for the production of custom datasets for mobile applications, production of graphics, etc..
 
API access and extraction
 
{host_url}/ine/json_indicador/pindica.jsp?op=2&varcd={varcd_cod}&Dim1={dim1_cod}&Dim2={dim2_cod}&Dim??={dim??_cod}&lang={lang}
  • host_url -> Host address of INE´s website, (https://www.ine.pt)
  • varcd_cod -> Code of the indicator
  • dim1_cod -> Code of the time dimension, (example: S7A2015)
  • dim2_cod -> Code of the geographic dimension, (example: 11)
  • dim??_cod -> Any other dimension. as long as it is available in the chosen indicator
  • lang -> Language intended for the extraction result (“PT” or “EN”)

How to explore the dimensions / codes of an indicator to be used in the API?
Access the indicator at INE´s website https://www.ine.pt –> Database –> in the tab “change selection conditions” - change the option from “Tree” to "Codes" in order to obtain the codes.

In order to complement the API, you may accede and extract, via API, to the metadata of each indicator in the Database of INE´s website.
For further details concerning the indicator´s metadata, please consult this page of INE´s Metadata System:  http://smi.ine.pt/Indicador.
 Video: Practical example: How to consult the dimensions / codes of an indicator - (https://www.ine.pt/scripts/bdd_indicador_.mp4)

Example:https://www.ine.pt/ine/json_indicador/pindica.jsp?op=2&varcd=0008074&Dim1=S7A2015&Dim2=200&Dim3=3&lang=EN

  • varcd: -> 0008074 (Crime rate ((‰) by Geographic localization (NUTS - 2013) and Category of crime; Annual - Directorate General for Justice Policy)
  • Dim1 -> S7A2015 (Year 2015)
  • Dim2 -> 200 (Região Autónoma dos Açores)
  • Dim3 -> 3 (Theft of and from motor vehicles)
  • lang -> EN (English)

In order to complement the API, you may accede and extract, via API, to the metadata of each indicator in the Database of INE´s website.
 
Metadata extraction:
 
{host_url}/ine/json_indicador/pindicaMeta.jsp?varcd={varcd_cod}&lang={língua}
  • host_url: -> Host address of INE´s website, https://www.ine.pt
  • varcd_cod -> Indicator´s code
  • lang: -> Language intended for the extraction result (“PT” or “EN”)
     

For further details concerning the indicator´s metadata, please consult this page of INE´s Metadata System: http://smi.ine.pt/Indicador
 
 User Manual - PDF
   
By providing this new API service to its users, Statistical Portugal complies with Measure 21 'Automatic Statistical Service' of the SIMPLEX + 2018 program