Post
Topic
Board Service Discussion
Topic OP
REST API HELP
by
BTCIndia
on 05/08/2016, 17:09:37 UTC
Dear All,
Im Trying to hit a Get Request from my https server
but it always Return NULL Please help,

https://tierion.com/docs/dataapi#api-create-datastore

Code:
$service_url 'https://api.tierion.com/v1/datastores';
   $curl curl_init($service_url);
   $curl_post_data = array(
        "X-Username" => 'EMAIL ADDRESS',
        "X-Api-Key" => 'API KEY',
        );
   curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
   curl_setopt($curlCURLOPT_POSTtrue);
   curl_setopt($curlCURLOPT_POSTFIELDS$curl_post_data);
   $curl_response curl_exec($curl);
   curl_close($curl);
   
   $decoded json_decode($curl_response);
if (isset($decoded->response->status) && $decoded->response->status == 'ERROR') {
    die('error occured: ' $decoded->response->errormessage);
}
echo 'response ok!';
var_export($decoded->response);

?>

Here is my potato in advance... Smiley