function postRequest($debug, $api, $token, $postdata)
$base_url=$GLOBALS['base_url'];
curl_setopt($ch, CURLOPT_URL, $base_url.$api);
//[message] => application/x-www-form-urlencoded;charset=UTF-8 media type is not supported. Supported media types are application/hal+json, application/octet-stream, text/plain, application/xml, text/xml, application/x-www-form-urlencoded, application/*+xml, multipart/form-data, application/json, application/*+json, */*
//debugMessage] => Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Authorization: Bearer ".$token, "Content-Type: application/json",));
error_log("Post json data = ".json_encode($postdata));
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_POST, true);
//curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postdata));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postdata));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = json_decode($res, false);
error_log("Response String".$res);
error_log("Response Array".print_r($response, true));