Answer the question
In order to leave comments, you need to log in
Bitrix24 incoming webhooks enlighten?
Set up an incoming webhook with access to Time Tracking (timeman).
You need to get a report on the working hours of employees.
I am using code:
function writeToLog($data, $title = '') {
$log = "\n------------------------\n";
$log .= date("Y.m.d G:i:s") . "\n";
$log .= (strlen($title) > 0 ? $title : 'DEBUG') . "\n";
$log .= print_r($data, 1);
$log .= "\n------------------------\n";
file_put_contents(getcwd() . '/hook.log', $log, FILE_APPEND);
return true;
}
$queryUrl = 'https://****.bitrix24.ru/rest/10/****************/timeman.timecontrol.reports.get';
$queryData = http_build_query(
array(
'fields' =>array(
'USER_ID' => 29,
'YEAR' => 2019,
'MONTH' => 3,
),
)
);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $queryUrl,
CURLOPT_POSTFIELDS => $queryData,
)
);
$result = curl_exec($curl);
curl_close($curl);
$result = json_decode($result, 1);
writeToLog($result, 'result');
var_dump($result);
The method for obtaining a report on identified absences.
Answer the question
In order to leave comments, you need to log in
Probably already irrelevant, but - you are passing the wrong array of parameters.
$queryData = http_build_query(
array(
'fields' =>array(
'USER_ID' => 29,
'YEAR' => 2019,
'MONTH' => 3,
),
)
);
$queryData = http_build_query(
array(
'USER_ID' => 29,
'YEAR' => 2019,
'MONTH' => 3,
)
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question