updateAgentDataConfig method

Future<void> updateAgentDataConfig(
  1. String agent_id,
  2. dynamic data_configs
)

Implementation

Future<void> updateAgentDataConfig(String agent_id, dynamic data_configs) async {
  final url = Uri.parse('$baseUrl/saveHaivaAgentConfig?agent-id=${agent_id}');

  final response = await http.post(
    url,
    headers: {
      'Authorization': 'Bearer $token',
      'Content-Type': 'application/json',
    },
    body: json.encode({
      'data_configs': data_configs
    }),
  );
  print("response update agent body = ${response.body}");
  print("response update agent = ${response.statusCode}");
  if (response.statusCode == 200  || response.statusCode == 201) {
    print('Agent updated successfully');
  } else {
    // Handle error
    throw Exception('Failed to update agent${response.body}');
  }
}