v1.2.0

Ping.make()

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

Overview

Use Ping.make() to measure the response time of Bitrix24 REST API. The method returns a Promise with a numeric value of the response time in milliseconds.

// Basic usage
const responseTime = await $b24.tools.ping.make()

if (responseTime >= 0) {
  console.log(`API response time: ${responseTime}ms`)
} else {
  console.error('Failed to measure API response time')
}

Method Signature

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

Parameters

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

Return Value

Promise<number> — a promise that resolves to a numeric value:

  • Positive number — response time in milliseconds from sending the request to receiving the response.
  • -1 — in case of error or timeout.

Error Handling

Ping.make() never throws. Network failures, HTTP errors, invalid credentials, and timeouts are all swallowed internally and surfaced as a return value of -1. There is no way to distinguish between failure modes from the call site — for that, use HealthCheck.make() or call the underlying method directly with CallV2.make() and inspect AjaxResult.

Examples

Measuring response time

Alternatives and Recommendations

  • For availability check: Use HealthCheck.
  • For measuring operation performance: Perform time measurements for specific API methods.
  • On the client-side (browser): Use the built-in B24Frame object.