modifyZohoAgent method

Future<void> modifyZohoAgent(
  1. String agentId,
  2. String connectorName
)

Implementation

Future<void> modifyZohoAgent(String agentId, String connectorName) async {
  try {
    final url = '$baseUrl/modifyZohoAgent?agentId=$agentId&connectorName=$connectorName';
    print("Calling URL: $url");
    print("AgentId: $agentId");
    print("ConnectorName: $connectorName");
    print("token : $token");
    final response = await http.patch(
        Uri.parse(url),
        headers: {
          'Authorization': '$token',
          'Content-Type': 'application/json',
        },
        body: json.encode({})
    );

    print("Response status code: ${response.statusCode}");
    print("Response body: ${response.body}");

    if (response.statusCode == 200 || response.statusCode == 201) {
      print("Agent modified successfully");
    } else {
      throw HttpException('Failed to modify agent: ${response.statusCode}');
    }
  } catch (e) {
    print('Error in modifyZohoAgent: $e');
    throw Exception('Failed to modify agent: $e');
  }
}