- Модуль: rest
- Путь к файлу: ~/bitrix/modules/rest/classes/general/restentity.php
- Класс: CBitrixRestEntity
- Вызов: CBitrixRestEntity::entitySectionAdd
static function entitySectionAdd($params, $n, $server)
{
if(self::checkSectionParams($params))
{
$arIBlock = self::getIBlock(self::getEntityIBlockCode($params['ENTITY'], $server));
if($arIBlock)
{
if(CIBlockRights::UserHasRightTo($arIBlock['ID'], $arIBlock['ID'], 'section_edit'))
{
$arSectionFields = self::prepareSection($params, $arIBlock, $server);
$ib = new CIBlockSection();
$ID = $ib->Add($arSectionFields);
if($ID > 0)
{
//$server->setStatus(CRestServer::STATUS_CREATED);
return $ID;
}
else
{
throw new RestException($ib->LAST_ERROR, RestException::ERROR_CORE);
}
}
else
{
throw new AccessException();
}
}
else
{
throw new RestException('Entity not found', self::ERROR_ENTITY_NOT_FOUND);
}
}
}