REST API: list
12.11.2022
365

Returns a list of records via GET request

Returns a list of records via GET request.

 

Arguments

table

the table name.

action

list

records

how many records to return

Example: show me first 3 employees.

https://sureqrapp.nizamer.com/api/v1.php?table=employees&action=list&records=3

 

skip

how many records to skip (pagination)

Example: show me all employees starting with number 3.

https://sureqrapp.nizamer.com/api/v1.php?table=employees&action=list&skip=2

 

q

search

Example: show me all employees from Pakistan.

https://sureqrapp.nizamer.com/api/v1.php?table=employees&action=list&q=(country~equals~Pakistan)

 

qs

all fields search

Example: show me all employees where any field contains Shakeel.

https://sureqrapp.nizamer.com/api/v1.php?table=employees&action=list&qs=shakeel

 

Sample request URL

curl "https://sureqrapp.nizamer.com/api/v1.php?table=organization&action=list"  

 

Sample response

 {  
"data": [  
   {  
    "business""Ascent Accounts",  
    "address""Office # 31, Commercial Street 3",  
    "person""David Copper",  
    "position""SEO Specialist",  
    "contactno""92459456137",  
    "realqrcode""David Copper\rSEO Specialist\rAscent Accounts\rOffice # 31, Commercial Street 3\r92459456137",  
    "userid""45",  
    "org_no""5004" 
   },  

   {  
    "business""SureQR",  
    "address""Office # 32, Commercial Street",  
    "person""Andrew Jhon",  
    "position""Manager Finance",  
    "contactno""92333456789",  
    "realqrcode""Andrew Jhon\rManager Finance\rSureQR\rOffice # 32, Commercial Street\r92333456789",  
    "userid""45",  
    "org_no""5004"
      }  
],  
"success"true  
}

 

Sample code

This code connects to the REST API, retrieves all records from the organization table and displays results.

PHP:
 

<?php
$headers = [
 'X-Auth-Token: f75sk32s29f5ag4j4s6z',
];

$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sureqrapp.nizamer.com/api/v1.php?table=organization&action=list",
CURLOPT_HTTPHEADER => $headers,
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("https://sureqrapp.nizamer.com/api/v1.php?table=organization&action=list");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);


JavaScript (jQuery):

var settings = {
"url""https://sureqrapp.nizamer.com/api/v1.php?table=organization&action=list",
"method""GET",
"timeout": 0,
};
 
$.ajax(settings).done(function (response) {
 console.log(response);
});

 

Was this article helpful?Yes (0)No (0)Thank you for your feedback!