2bad / bitrix Goto Github PK
View Code? Open in Web Editor NEWBitrix24 REST API client that doesn't suck. Suffer no more.
License: MIT License
Bitrix24 REST API client that doesn't suck. Suffer no more.
License: MIT License
Hello,
I think I'm experiencing an issues with the old version of got in this library:
TypeError: URL is not a constructor
at normalize (normalize-arguments.js?9801:124)
at got (create.js?4b17:32)
at Function.got. [as get] (create.js?4b17:64)
at eval (index.js?5442:26)
at run (index.js?6520:249)
at PQueue._tryToStartAnother (index.js?6520:197)
at eval (index.js?6520:263)
at new Promise ()
at PQueue.add (index.js?6520:244)
at queuedGet (index.js?5442:26)
Can you please advise a path to work around this? Thank you.
Hi, I using this in vue.js app
import Bitrix from '@2bad/bitrix'
const bitrix = Bitrix('https://portal.bitrix24.ru/rest/7/token/')
bitrix.deals.list({ select: ['*', 'UF_*'] })
.then(({ result }) => {
const titles = result.map((e) => e.TITLE)
console.log(titles)
})
.catch(console.error)
and I get output in console:
TypeError: URL is not a constructor
at normalize (normalize-arguments.js?c218:124)
at got (create.js?71a9:32)
at Function.got.<computed> [as get] (create.js?71a9:64)
at eval (index.js?d476:26)
at run (index.js?987e:249)
at PQueue._tryToStartAnother (index.js?987e:197)
at eval (index.js?987e:263)
at new Promise (<anonymous>)
at PQueue.add (index.js?987e:244)
at queuedGet (index.js?d476:26)
What is fuck?
I've already tested in other versions and it works fine.
Those have relation to the client, though, in future might be implemented as standalone solutions.
This issue is for keeping information about possible solutions since there is no other place to keep it.
Some useful findings:
Bitrix API fields https://bxapi.ru/src/?module_id=crm&name=CCrmLead::GetFieldsInfo
They do contain information about data types and entities relations. They can be used to marshall and aggregate entities.
Good day!
I'm trying to call the list method for deals using select, including about a dozen field names, including custom ones. However, I am encountering the following error.
Using select: ['*', 'UF_'] leads to an undesired inflation of the response to the query, which is highly undesirable.
Any possible solutions?
When attempting to call the Bitrix constructor in my code, I consistently encounter the following error message:
TypeError: Bitrix is not a function
at Object.<anonymous> (/Users/work/workspace/get_leads.js:2:16)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:82:12)
at node:internal/main/run_main_module:23:47
The relevant code snippet is as follows (I have also attempted using import, but encountered the same error):
get_leads.js
const Bitrix = require('@2bad/bitrix');
const bitrix = Bitrix('https://PORTAL_NAME.bitrix24.ru/rest', 'ACCESS_TOKEN');
I appreciate any assistance in resolving this issue.
Node.js version: v19.0.1
Sending request to host that has self-signed cert raises an error
GotError [RequestError]: self signed certificate
any options to avoid this?
got
v11call<Leads>(params)
In the batch response, why not return the full object? with erros and result?.
by doind bitrix.batch, if there is an error in the array, it will throw error and the error is just a string "Error: [batch] failed to process. Received errors in 1 commands:
[object Object]"
this is a big problem, cause, after the batch, how can i know which commans have worked and which didnt?
I would like to, after the batch, know the commands that worked and those that didnt
Hi,
i needed to create a company and set data for a userfield. This is possible for deals, but not for companies.
I fixed this issue locally by adding the following line to the Company interface in entities.d.ts.
readonly [key: string]: string | ReadonlyArray<MultiField> | null;
I have to tell you, i am really than thankfull that you created this project. This is definitly the easiest way to work with the bitrix "REST" API. (I think no one of the developers of bitrix ever heared what REST really is, when i look at their crappy API)
it seems bitrix.list() does not work correctly with SPA
To make my code work:
bitrix.list('crm.item.list', { entityTypeId: '138', select: ['ufCrm4_1654801473656', 'ID'] })
I had to change one line in the source code:
node_modules/@2bad/bitrix/build/main/client/methods/list.js:39
I changed it and it works:
...r
-> ...r.items
I'm trying to add an image to a custom field when I create a deal, but I've been receiving the same HTTPError.
I'm trying to execute the code below:
const imgData = [{
fileData: [ "test-st.png", "iVBORw0KGgoAAAANSUh..." ] // fileData[1] is a base64 str
}]
let data = await bitrix.deals.create({
fields: {
TITLE: "ST-TEST",
CATEGORY_ID: 18,
UF_CRM_1659988440473: 4759,
UF_CRM_1678981077892: imgData,
},
}, {
REGISTER_SONET_EVENT: 'Y'
})
The full error is:
{
"name": "HTTPError",
"timings": {
"start": 1684867744230,
"socket": 1684867744231,
"lookup": 1684867744255,
"connect": 1684867744410,
"secureConnect": 1684867744568,
"upload": 1684867744568,
"response": 1684867744880,
"end": 1684867744881,
"phases": {
"wait": 1,
"dns": 24,
"tcp": 155,
"tls": 158,
"request": 0,
"firstByte": 312,
"download": 1,
"total": 651
}
}
}
What can I do to solve this?
So, i'm doing bitrix.call('crm.product.property.add', query)
with a list property which has really large amount of options, and i'm getting 414 error. Is there any way to fix that? Aren't queries supposed to be POST requests?
Hello,
I'm trying to use the crm.stagehistory.list method the following way:
bitrix.list('crm.stagehistory.list' as any, { entityTypeId: 2 } as any)
.then((payload) =>
{
console.log(payload);
});
However, if you try that you will see that it fails on batchToListPayload because it assumes result is iterable, however, result in this call is an object and items inside that is an array.
Maybe there could be a way to specify how to batch, or at least a way to pass a different batchToListPayload?
Kind regards,
Good day!
Since I couldn't find methods for work with Invoice object, I tried to use call with argument 'crm.invoice.list'. And got only 50 objects.
Is there nice solution to get all Invoices at once?
We should start with https://www.npmjs.com/package/eslint-plugin-jest
I get an error when using this library in a browser. Is it possible to use this library in a browser?
https://codesandbox.io/s/jolly-murdock-w22qpg?file=/src/main.js:99-178
Good morning, I'm having trouble using and configuring oauth authentication and from what I realized it is no longer possible to use via webhook, I would like to put a tutorial on how to use oauth from bitrix24 or release via webhook. thanks. Obs. Was translated in google translator in case of spelling errors
I am receiving this when i try to add 50 contacts using batch
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.