n8n-nodes-arubacentral
Version:
n8n community node for Aruba Central API integration with comprehensive monitoring, configuration, and management capabilities
31 lines (26 loc) • 1.01 kB
text/typescript
import { IExecuteFunctions, INodeExecutionData, IDataObject } from 'n8n-workflow';
import { apiRequest } from '../../../../helpers/apiRequest';
import { logger } from '../../../../helpers/logger';
import { handleApiError } from '../../../../helpers/errorHandler';
/**
* Post Devices
* POST /central/v2/labels/associations
*
* @param this The n8n execution context
* @returns Formatted API response
*/
export async function postDevices(this: IExecuteFunctions): Promise<INodeExecutionData[]> {
try {
// Construct request options
const options: IDataObject = {};
// Construct API endpoint
const endpoint = '/central/v2/labels/associations';
// Make API request
const responseData = await apiRequest.call(this, 'POST', endpoint, options);
// Format and return response
return [{ json: responseData }];
} catch (error) {
logger.error('monitoring:label:postDevices:error', { message: error.message });
return handleApiError.call(this, error, 'Failed to execute post devices');
}
}