Version 1.0.1 is now available! Looking for a migration guide?
v1.0.1
/
  • Get Started
  • Working
  • GitHub
  • Overview
  • Introduction
  • Actions
  • Call
  • Call
  • CallList
  • CallList
  • FetchList
  • FetchList
  • Batch
  • Batch
  • BatchByChunk
  • BatchByChunk
  • Tools
  • HealthCheck
  • Ping
  • Logger
  • Logger
  • Telegram
  • Limiters
  • Limiters
  • B24Frame
  • Introduction
  • Initialization
  • Auth
  • Dialog
  • Options
  • Parent
  • Placement
  • Slider
  • b24ui
  • b24icons
v1.0.1
  • Get started
  • Working

HealthCheck.make()

Method for checking the availability of Bitrix24 REST API. Performs a simple request to the REST API to verify service health.
HealthCheck
We are still updating this page. Some data may be missing here — we will complete it shortly.

Overview

Use HealthCheck.make() to check the availability of Bitrix24 REST API. The method returns a Promise with a boolean value indicating API availability.

// Basic usage
const isHealthy = await $b24.tools.healthCheck.make()

if (isHealthy) {
  console.log('Bitrix24 API is available')
} else {
  console.error('Problems accessing Bitrix24 API')
}

Method Signature

make(
  options?: { requestId?: string }
): Promise<boolean>

Parameters

ParameterTypeRequiredDescription
requestIdstringNoUnique request identifier for tracking. Used for request deduplication and debugging.

Return Value

Promise<boolean> — a promise that resolves to a boolean value:

  • true — REST API is available and responding, webhook is configured correctly.
  • false — REST API is unavailable, an error occurred, or necessary access rights are missing.

Examples

Availability check

import { B24Hook, LoggerFactory } from '@bitrix24/b24jssdk'

const devMode = typeof import.meta !== 'undefined' && (import.meta?.dev || globalThis._importMeta_.env?.DEV)
const $logger = LoggerFactory.createForBrowser('Example:healthCheck', devMode)
const $b24 = B24Hook.fromWebhookUrl('https://your_domain.bitrix24.com/rest/1/webhook_code/')

async function checkRestApiHealth(): Promise<boolean> {
  try {
    return await $b24.tools.healthCheck.make({
      requestId: `unique-request-id`
    })
  } catch (error) {
    $logger.error('Health check failed unexpectedly', { error })
    return false
  }
}

// Usage
try {
  const apiAvailable = await checkRestApiHealth()

  if (apiAvailable) {
    $logger.info('Bitrix24 API is available and responding')
  } else {
    $logger.error('Bitrix24 API is unavailable. Check:\n1. Correctness of webhook URL\n2. Bitrix24 availability from your network')
  }
} catch (error) {
  $logger.error('Failed to perform health check', { error })
}

Alternatives and Recommendations

  • For measuring response speed: Use Ping.
  • For checking specific permissions: Perform a test request to the required API method.
  • On the client-side (browser): Use the built-in B24Frame object.

BatchByChunk

Method for executing batch requests with automatic chunking for any number of commands. Automatically splits large command sets into batches of 50 and executes them sequentially. Use only arrays of tuples or arrays of objects.

Ping

Method for measuring Bitrix24 REST API response speed. Performs a test request and returns response time in milliseconds.

On this page

  • Overview
  • Method Signature
    • Parameters
    • Return Value
  • Examples
    • Availability check
  • Alternatives and Recommendations
Releases
Published under MIT License.

Copyright © 2024-present Bitrix24