Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > ASPRunner.NET's REST API

REST API: delete

Scroll Prev Next More

Deletes a record via POST request.

 

Arguments
 

table

the table name.

action

delete

editid1, editid2, ...

key column values

Sample request URL

 

curl -X POST "http://localhost:8086/api/v1?table=customers&action=delete&editid1=WOLZA"  

 

 

Sample request URL with multiple key columns:

 

 

curl "http://localhost:8086/api/v1?table=order%20details&action=delete&editid1=10248&editid2=42"  

 

Sample code

Delete a record from categories table where key column value is 275.

 

<?php
 
$curl = curl_init();
 
curl_setopt_array($curl, array(
 CURLOPT_URL => "http://localhost:8086/api/v1?table=categories&action=delete&editid1=275",
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_ENCODING => "",
 CURLOPT_MAXREDIRS => 10,
 CURLOPT_TIMEOUT => 0,
 CURLOPT_FOLLOWLOCATION => true,
 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
 CURLOPT_CUSTOMREQUEST => "POST",
));
 
$response = curl_exec($curl);
 
curl_close($curl);
echo $response;
 
?>  

 

 

C# code (using RestCharp):

 

var client = new RestClient("http://localhost:8086/api/v1?table=categories&action=delete&editid1=275");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

 

Javascript (jQuery):

 

var settings = {
"url": "http://localhost:8086/api/v1?table=categories&action=delete&editid1=275",
"method": "POST",
"timeout": 0,
};
 
$.ajax(settings).done(function (response) {
 console.log(response);
});