Get Product by ID crm.product.get
Scope:
crmWho can execute the method: any user
Method development has been halted
The method crm.product.get continues to function, but there are more relevant alternatives catalog.product.*.
The method crm.product.get returns a product by its ID.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
id |
Product ID |
Code Examples
How to Use Examples in Documentation
cURL (Webhook)
cURL (OAuth)
JS
PHP
BX24.js
PHP CRest
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":"your_product_id"}' \ # Replace 'your_product_id' with the actual product ID
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.product.get
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":"your_product_id","auth":"**put_access_token_here**"}' \ # Replace 'your_product_id' with the actual product ID
https://**put_your_bitrix24_address**/rest/crm.product.get
try
{
const id = prompt("Enter ID");
const response = await $b24.callMethod(
"crm.product.get",
{ id: id }
);
const result = response.getData().result;
console.dir(result);
}
catch(error)
{
console.error(error);
}
try {
$productId = 1; // Example product ID
$productService = $serviceBuilder->getCRMScope()->product();
$productResult = $productService->get($productId);
$itemResult = $productResult->product();
print("ID: " . $itemResult->ID . "\n");
print("Catalog ID: " . $itemResult->CATALOG_ID . "\n");
print("Price: " . $itemResult->PRICE . "\n");
print("Currency ID: " . $itemResult->CURRENCY_ID . "\n");
print("Name: " . $itemResult->NAME . "\n");
print("Code: " . $itemResult->CODE . "\n");
print("Description: " . $itemResult->DESCRIPTION . "\n");
print("Description Type: " . $itemResult->DESCRIPTION_TYPE . "\n");
print("Active: " . $itemResult->ACTIVE . "\n");
print("Section ID: " . $itemResult->SECTION_ID . "\n");
print("Sort: " . $itemResult->SORT . "\n");
print("VAT ID: " . $itemResult->VAT_ID . "\n");
print("VAT Included: " . $itemResult->VAT_INCLUDED . "\n");
print("Measure: " . $itemResult->MEASURE . "\n");
print("XML ID: " . $itemResult->XML_ID . "\n");
print("Preview Picture: " . $itemResult->PREVIEW_PICTURE . "\n");
print("Detail Picture: " . $itemResult->DETAIL_PICTURE . "\n");
print("Date Create: " . $itemResult->DATE_CREATE . "\n");
print("Timestamp X: " . $itemResult->TIMESTAMP_X . "\n");
print("Modified By: " . $itemResult->MODIFIED_BY . "\n");
print("Created By: " . $itemResult->CREATED_BY . "\n");
} catch (\Throwable $e) {
print("Error: " . $e->getMessage() . "\n");
}
var id = prompt("Enter ID");
BX24.callMethod(
"crm.product.get",
{ id: id },
function(result)
{
if(result.error())
console.error(result.error());
else
console.dir(result.data());
}
);
require_once('crest.php');
$id = 'your_product_id'; // Replace 'your_product_id' with the actual product ID
$result = CRest::call(
'crm.product.get',
[
'id' => $id
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Copied
Previous