Answer the question
In order to leave comments, you need to log in
How to set parameters correctly in Bitrix24 REST API?
Good day, colleagues!
There is a small question about using the Bitrix24 REST API through webhooks.
Here is a piece of code:
$queryUrl = 'https://***.bitrix24.ru/rest/161/***/crm.duplicate.findbycomm.json';
$queryData = http_build_query(array(
'type' => 'PHONE',
'values' => array($order_shipping_phone),
'entity_type' => 'CONTACT',
));
$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);
echo '<BR/>$queryData = ';
var_dump($queryData);
echo '<BR/>phone $result = ';
var_dump($result);
$queryData = string(57) "type=PHONE&values%5B0%5D=8963&entity_type=CONTACT"
phone $result = array(2) { ["error"]=> string(0) "" ["error_description"]=> string(36) "Communication values is not defined." }
Answer the question
In order to leave comments, you need to log in
For example like this:
$queryUrl = 'https://***.bitrix24.ru/rest/161/***/crm.duplicate.findbycomm/';
$order_shipping_phone = [
'89032365544'
];
$queryData = [
'type' => 'PHONE',
'values' => $order_shipping_phone,
'entity_type' => 'CONTACT'
];
$curl = curl_init();
\curl_setopt_array(
$curl,
[
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_POST => true,
CURLOPT_HEADER => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL => $queryUrl,
CURLOPT_POSTFIELDS => http_build_query($queryData)
]
);
$result = curl_exec($curl);
curl_close($curl);
var_dump($result);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question