Inserts a record into the database table via POST request Data is passed as key-value pairs in the body of the request. Fields to be inserted are sent as fieldname=value&fieldname1=value1 list. Arguments table the table name. action insert
keyfieldname1, keyfieldname2, ... key column values field1, field2, ... field values to insert the record Example Add an employee named Zubair Shaikh with emp_no 115. curl -X POST "https://sureqrapp.nizamer.com/api/v1.php?table=employees&action=update" -d "emp_no=115&userid=45&name=Zubair Shaikh&title=Sales Manager" -H "Content-Type: application/x-www-form-urlencoded"
| And response will contain the whole new record including the key columns: { "success":true, "data":{ "userid":"45", "emp_no":"115", "name":"Zubair Shaikh", "title":"Sales Manager", "qrcode":"sureqrapp.nizamer.com", "uid":"6c9a4aeeb99475aa880043ab46cdcb640531ca336f9c34", } } | Sample code Inserts a record into employees table. 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=employees&action=insert", 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 => "POST", CURLOPT_POSTFIELDS => array('emp_no' => '115','userid' => '45','name' => 'Zubair Shaikh','title' => 'Sales Manager'), )); $response = curl_exec($curl); curl_close($curl); echo $response; ?> | C# (RestSharp):
var client = new RestClient("https://sureqrapp.nizamer.com/api/v1.php?table=employees&action=insert"); client.Timeout = -1; var request = new RestRequest(Method.POST); request.AlwaysMultipartFormData = true; request.AddParameter("emp_no", "115"); request.AddParameter("userid", "45"); request.AddParameter("name", "Zubair Shaikh"); request.AddParameter("title", "Sales Manager"); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content); | JavaScript (jQuery):
var form = new FormData(); form.append("emp_no", "115"); form.append("userid", "45"); form.append("name", "Zubair Shaikh"); form.append("title", "Sales Manager"); var settings = { "url": "https://sureqrapp.nizamer.com/api/v1.php?table=employees&action=insert", "method": "POST", "timeout": 0, "processData": false, "mimeType": "multipart/form-data", "contentType": false, "data": form }; $.ajax(settings).done(function (response) { console.log(response); }); | |