Please enable JavaScript to view this site.

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

REST API: view

Scroll Prev Next More

 

Returns a single record via GET request.

 

Arguments
 

table

the table name.

action

view

editid1, editid2, ...

key column values

Sample request URL

 

curl "http://localhost:8086/api/v1?table=customers&action=view&editid1=WOLZA"  

 

Sample request URL with multiple key columns:

 

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

 

Sample response

 

{  
data: {  
CustomerID: "WOLZA",  
CompanyName: "Wolski Zajazd",  
ContactName: "Zbyszek Piestrzeniewicz",  
ContactTitle: "Owner",  
Address: "ul. Filtrowa 68",  
City: "Warszawa",  
Region: "",  
PostalCode: "1",  
Country: "Poland",  
Phone: "(26) 642-7012",  
Fax: "(26) 642-7012",  
Lat: "52.2195630000",  
Lng: "20.9858780000"  
},  
success: true  
}  

 

Sample code

This code retrieves the record with ID WOLZA from customers table.

 

PHP:

 

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

 

 

C# (RestSharp):

 

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

 

Javascript (jQuery):

 

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