deleteFile method
Delete file
Deletes one file attachment version. Meta-data about files can be retrieved from the /records and /reports endpoints, where applicable. Use those endpoints to get the necessary information to delete file versions.
Implementation
Future<String> deleteFile({
required String tableId,
required int recordId,
required int fieldId,
required int versionNumber,
String? authorization, String? userAgent }) async {
Map<String, String> headers = {
"Authorization": authorization ?? appAuthorization,
'Content-Type': 'application/json; charset=UTF-8',
'Accept': 'application/json',
"QB-Realm-Hostname": qBRealmHostname,
"User-Agent": userAgent?? ""
};
Uri endpoint = Uri.https(
baseUrl, "v1/files/$tableId/$recordId/$fieldId/$versionNumber");
//print (endpoint.toString());
var response = await
http.get(endpoint, headers: headers);
if (response.statusCode >= 400) {
throw ApiException(response.statusCode, response.body);
}
else if (response.statusCode == 200) {
return response.body;
}
else {
throw ApiException(response.statusCode, response.body);
}
}