Constructor
# new DigitalGob(apiKey)
Create an instance of DGCPApi service.
Parameters:
Name | Type | Description |
---|---|---|
apiKey |
string
|
The API key for authentication. |
Extends
- FetchService
Methods
# getApiById(id) → {Promise}
Get API by ID.
Parameters:
Name | Type | Description |
---|---|---|
id |
string
|
The ID of the API. |
A promise that resolves to the API data.
Promise
Example
// Example: Retrieve API by ID from https://developer.digital.gob.do
async function getAPI() {
try {
const id = "ff9ce928-e16e-4ea9-9ce9-28e16e1ea96e";
const apiInfo = await aletheiaSDK.opendata.gob('digital').getApisById(id);
console.log('Develper API:', apiInfo);
} catch (error) {
console.error('Error retrieving developer api:', error);
}
}
# getApis() → {Promise}
Get API list.
A promise that resolves to the total of API on the platform.
Promise
Example
// Example: Retrieve APIs info from https://developer.digital.gob.do
async function getAPIs() {
try {
const apisList = await aletheiaSDK.opendata.gob('digital').getApis();
console.log('Develper APIs:', apisList);
} catch (error) {
console.error('Error retrieving developer apis:', error);
}
}