from services.advoware import AdvowareAPI config = { 'type': 'api', 'name': 'Advoware Proxy DELETE', 'description': 'Universal proxy for Advoware API (DELETE)', 'path': '/advoware/proxy', 'method': 'DELETE', 'emits': [], 'flows': ['advoware'] } async def handler(req, context): try: # Endpoint aus Query-Parametern endpoint = req.get('queryParams', {}).get('endpoint', '') if not endpoint: return {'status': 400, 'body': {'error': 'Endpoint required as query param'}} advoware = AdvowareAPI(context) method = 'DELETE' # Feste Methode für diesen Step params = {k: v for k, v in req.get('queryParams', {}).items() if k != 'endpoint'} json_data = None context.logger.info(f"Proxying request to Advoware: {method} {endpoint}") result = await advoware.api_call(endpoint, method=method, params=params, json_data=json_data) return {'status': 200, 'body': {'result': result}} except Exception as e: context.logger.error(f"Proxy error: {e}") return {'status': 500, 'body': {'error': 'Internal server error', 'details': str(e)}}