How to full the data from API response
PHP – cURL
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "http://my-site.com/wp-json/wpcargo/v1/api/{my_API_key}", 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", CURLOPT_HTTPHEADER => array( ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
javascript – jQuery
var settings = { "url": "http://my-site.com/wp-json/wpcargo/v1/api/{my_API_key}", "method": "GET", "timeout": 0, "headers": { }, }; $.ajax(settings).done(function (response) { console.log(response); });