Hit Rest api with drupal
Below are the code for testing your API from devel.
LOGIN:
$url = 'http://bbgvm/user-auth/user-login/login';
$data = '{"username":"customer-1","password":"customer-1","language_id":"21"}';
$options = array(
'headers' => array(
'Content-Type' => 'application/json',
),
'method' => 'POST',
'data' => $data
);
$response = drupal_http_request($url,$options);
dsm($response,"login response");
Content-check:
$url = 'http://bghhgy/agnt/conutck/file-check';
$data = '{"product_catalog_common":"0","product_price":"0","multilingual":"0","category":"0"}';
// Cookie = session_name=session_id
$options = array(
'headers' => array(
'Content-Type' => 'application/json',
'Cookie' => 'SESSc6807f4f51f6a80e9031464f5cf7e3d6=vNPdjJIxC6LoCvTxdowmQDtX_qozYMKYFpHtMAvSuPw',
'X-CSRF-token' => '1XXF7_D4M9D1SnOK7p2SAveyOCFTls5PO6uVGzD0vp4',
),
'method' => 'POST',
'data' => $data
);
$response = drupal_http_request($url,$options);
dsm($response,"content-check");