n8n-nodes-arubacentral
Version:
n8n community node for Aruba Central API integration with comprehensive monitoring, configuration, and management capabilities
33 lines (32 loc) • 1.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLabel = getLabel;
const apiRequest_1 = require("../../../../helpers/apiRequest");
const logger_1 = require("../../../../helpers/logger");
const errorHandler_1 = require("../../../../helpers/errorHandler");
/**
* Get Label
* GET /central/v1/labels/{label_id}
*
* @param this The n8n execution context
* @returns Formatted API response
*/
async function getLabel() {
try {
// Get parameters
const label_id = this.getNodeParameter('label_id', 0);
// Construct request options
const options = {};
// Construct API endpoint manually to avoid template literal issues
const endpoint = '/central/v1/labels/' + encodeURIComponent(label_id);
console.log('Constructed endpoint:', endpoint);
// Make API request
const responseData = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, options);
// Format and return response
return [{ json: responseData }];
}
catch (error) {
logger_1.logger.error('monitoring:label:getLabel:error', { message: error.message });
return errorHandler_1.handleApiError.call(this, error, 'Failed to execute get label');
}
}