updateJob method
Updates an existing scan job (e.g., to cancel it).
host
- The host server URL.
jobId
- The ID of the job to update.
Returns a Map<String, dynamic>
containing the updated job information.
Implementation
Future<Map<String, dynamic>> updateJob(
String host, String jobId, Map<String, dynamic> parameters) async {
final url = '$host/api/device/scanners/jobs/$jobId';
try {
final response = await http.patch(
Uri.parse(url),
headers: {
'Content-Type': 'application/json',
'Content-Length': json.encode(parameters).length.toString()
},
body: json.encode(parameters),
);
return json.decode(response.body);
} catch (error) {
return {};
}
}