Registry / productivity / bx-rest

bx-rest

JSON →
library0.9.3jsnpmunverified

A TypeScript client library for the Bitrix24 REST API, designed for use with Angular and Vue applications. Version 0.9.3 is the current stable release, offering a modular architecture with classes like BXRestNavvy, BXRestMap, and BXRestRequest for making API calls. It supports custom method extensions and provides a consistent interface for interacting with Bitrix24 entities. The library relies on an authentication token, typically stored in cookies, and requires configuration via BXRestSettings. Compared to alternatives, it provides tighter integration with Angular dependency injection and Vue plugin systems, but lacks comprehensive documentation and has limited community adoption. Release cadence is irregular; updates are infrequent.

npm install bx-rest
INSTALL
IMPORT
SIG · BX-REST
B
bx-rest
productivityjavascriptv0.9.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BXRestSettings
import { BXRestSettings } from 'bx-rest'
const { BXRestSettings } = require('bx-rest')
Named export; CommonJS require works but ESM is preferred.
BXRestNavvy
import { BXRestNavvy } from 'bx-rest'
import BXRestNavvy from 'bx-rest'
Default import is incorrect; must be a named import.
partNameMethods
import { partNameMethods as PNM } from 'bx-rest'
import { partNameMethods } from 'bx-rest'
Aliasing is common when using the namespace for URL construction.

Shows configuration via BXRestSettings, setting an auth cookie, and making a basic API call to list elements.

import { BXRestSettings, BXRest, BXRestNavvy } from 'bx-rest'; // Configure authentication and base URL BXRestSettings.update({ auth: { source: 'cookies', key: 'auth', }, urls: { source: 'string', key: 'your-bitrix24-domain.com', additional_part: 'rest', }, }); // Set an authentication token (replace with actual token) document.cookie = 'auth=YOUR_ACCESS_TOKEN; max-age=99999'; // Create an instance and make a request const bxRestNavvy = new BXRestNavvy(); bxRestNavvy.lists.element.get({ IBLOCK_TYPE_ID: 'lists', IBLOCK_ID: 150, FILTER: { '>=PROPERTY_PRICE': 100 }, }).res().then(data => { console.log('Elements:', data); }).catch(error => { console.error('Error:', error); });
Debug
Known issues
gotchaAuthentication token must be set in a cookie named 'auth' before any requests. The library does not provide a method to set token programmatically.
fix
Ensure a cookie with name 'auth' and value of the access token is set, e.g., via document.cookie or server-side cookie.
affects: >=0.0.0
gotchaThe library is designed primarily for Angular and Vue. Using it with other frameworks may require manual instantiation of classes.
fix
If not using Angular/Vue, ensure you manually create instances of BXRestNavvy, BXRestMap, etc., and manage dependency injection yourself.
affects: >=0.0.0
deprecatedThe method name 'resVanilla' in BXRestNavvy is deprecated as of version 0.9.0. Use 'resAll' or handle pagination manually.
fix
Replace .resVanilla() with .resAll() to retrieve all items across pages.
affects: >=0.9.0
breakingIn version 0.8.0, the configuration format for BXRestSettings changed. The 'urls' key now expects an object with 'source' and 'key' instead of a plain string.
fix
Update BXRestSettings to use the new object format: { urls: { source: 'string', key: 'domain', additional_part: 'rest' } }.
affects: >=0.8.0
gotchaTypeScript types are included, but some methods may return 'any'. Always validate response types against Bitrix24 API documentation.
fix
Define custom interfaces for API responses and cast results if necessary.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'get')
BXRestSettings was not configured before using a navvy method, or authentication is missing.
fix
Call BXRestSettings.update() with valid config and ensure the auth cookie is set before making requests.
Error: Invalid URL. Please check your Bitrix24 domain.
The 'urls' configuration is incorrect or the domain is unreachable.
fix
Verify the domain in BXRestSettings, e.g., BXRestSettings.update({ urls: { source: 'string', key: 'yourdomain.bitrix24.com' } }).
Module not found: Error: Can't resolve 'bx-rest'
The package is not installed or import path is incorrect.
fix
Run 'npm install bx-rest' and ensure import is 'bx-rest' (not 'bx-rest/...').
Upgrade
Version history
0.9.3latest on npm
Audit
Dependencies
@angular/commonoptionalRequired for Angular-specific providers and HTTP client usage
vueoptionalRequired for Vue plugin integration via global properties
Agent activity
26 hits · last 30 days
node
22
OpenAI (training)
1
Resources
bx-rest — npm install bx-rest · libregistry