Constructor
# new DatosAbiertos(apiKey)
Create an instance of the Datos Abiertos service.
Parameters:
Name | Type | Description |
---|---|---|
apiKey |
string
|
The API key for authentication. |
Methods
# async getDatasetCSVUrls(dataset) → {Promise|Object}
Retrieves and parses the dataset URLs for Datos Abiertos from the API.
Parameters:
Name | Type | Description |
---|---|---|
dataset |
string
|
The name of the dataset to retrieve URLs for. |
A promise that resolves to an array of dataset URLs.
Promise
Returns an array of dataset URLs.
Object
Example
// Example: Retrieve fuel prices for the Dominican Republic
// Full documentation: https://datos.gob.do/
async function getDatasetCSVUrls() {
try {
// const dataset = 'nomina-miembros-policiales-2019';
// const dataset = 'trafico-2020';
const dataset = 'recaudaciones-sirite-2021-2022';
const daData = await aletheiaSDK.opendata.gob('datos-abiertos').getDatasetCSVUrls(dataset);
console.log('Datos Abiertos Data:', daData);
} catch (error) {
console.error('Error retrieving Datos Abiertos data:', error);
}
}
getDatasetCSVUrls();
# async getDatasetJSON(dataset) → {Promise|Object}
Retrieves and parses the dataset Datos Abiertos from the API.
Parameters:
Name | Type | Description |
---|---|---|
dataset |
string
|
The name of the dataset to retrieve. |
A promise that resolves to the fetched Datos Abiertos data.
Promise
Returns the fetched data from Datos Abiertos.
Object
Example
// Example: Retrieve fuel prices for the Dominican Republic
// Full documentation: https://datos.gob.do/
async function getDatosAbiertosDatasets() {
try {
const dataset = 'recaudaciones-sirite-2021-2022';
const daData = await aletheiaSDK.opendata.gob('datos-abiertos').getDatasetJSON(dataset);
console.log('Datos Abiertos Data:', daData.datasetJSON);
} catch (error) {
console.error('Error retrieving Datos Abiertos data:', error);
}
}
getDatosAbiertosDatasets();