scanDocument method

Future<String> scanDocument(
  1. String host,
  2. Map<String, dynamic> parameters
)

Creates a new scan job using provided parameters.

host - The host server URL. parameters - The parameters for the scan job.

Returns a String containing the job ID.

Implementation

Future<String> scanDocument(
    String host, Map<String, dynamic> parameters) async {
  final url = '$host/DWTAPI/ScanJobs';
  try {
    final response = await http.post(
      Uri.parse(url),
      body: json.encode(parameters),
      headers: {'Content-Type': 'application/text'},
    );
    final jobId = response.body;

    if (response.statusCode == 201) {
      return jobId;
    }
  } catch (error) {}
  return '';
}