RESTp - Get Primary Key Example Rest API to get primary key of table

RESTp allows you to get primary key of the table easily by specifying the GET parameter. You need to pass GET parameter op="primarykey" to get the primary key.

  
                                //init curl
                                $ch = curl_init();
                                 //set http headers
                                curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
                                // URL to be called
                                curl_setopt($ch, CURLOPT_URL, "http://pdocrud.com/RESTP/api/orders?op=primarykey");
                               //return as output instead of printing it
                                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                                //execute curl request
                                $result = curl_exec($ch);
                                //close curl connection
                                curl_close($ch);
                                //print result
                                print_r($result);
                            
  
                                jQuery(document).ready(function () {
                                    jQuery.ajax({
                                        url: "http://pdocrud.com/RESTP/api/orders?op=primarykey",
                                        success: function (response) {
                                            console.log(response);
                                            jQuery("#js_output").text(response);
                                        }
                                    });
                                });