Hi, I need to make a bulk delete in one of my tables called TuckShop through my Android Application. I am sure I am just overlooking something. This is my AsyncTask class that runs in the background and tries to execute the REST Delete request:
private class DeleteEverythingFromTuckShop extends AsyncTask<Void,Void,Exception>{
String API_URL = "https://api.backendless.com/CAD07C2B-DB80-7F6D-FFA6-48DEE0A95600/6C5DFBA6-502F-B26F-FA31-BC0AD90B0801/data/bulk/TuckShop?where=learnerBalanceAfter<1000";
@Override
protected void onPreExecute() {
super.onPreExecute();
//start showing progress dialog
}
@Override
protected void onPostExecute(Exception e) {
super.onPostExecute(e);
//dismiss progress dialog
if (e != null)
{
//show toast with exception message
}
}
@Override
protected Exception doInBackground(Void... params) {
HttpURLConnection urlConnection = null;
Exception exception = null;
try {
URL url = new URL(API_URL);
urlConnection = (HttpURLConnection)url.openConnection();
urlConnection.setRequestProperty( "application-id","CFD05C1B-AB80-7F6D-FFF6-49BEE0A96400" );
urlConnection.setRequestProperty( "secret-key","6B9AFBA6-503F-B34F-FF21-BB0AD91B0910" );
urlConnection.setRequestProperty( "application-type", "REST" );
urlConnection.setRequestMethod("DELETE");
urlConnection.connect();
} catch (MalformedURLException e) {
exception = e;
} catch (IOException e) {
exception = e;
}finally {
urlConnection.disconnect();
}
return exception;
}
}
I hope you can help me sort this out. Using Backendless 4. Api keys in above example code is not the real application api keys.
Thanks
Johan