Answer the question
In order to leave comments, you need to log in
Why are the values of the list in Bitrix not updated via the REST API?
Good afternoon.
I'm trying to update the UF value of a list. You must first remove all existing values, and then add new ones.
Python code. The fastbitrix library is used. The code is executed without errors. But the values of the lists in the interface do not change.
res = bx24.call('crm.deal.userfield.get', {'id': '223'})
elems = []
for elem in res['LIST']:
elems.append({'ID': elem['ID'], 'DEL': 'Y'})
res = bx24.call('crm.deal.userfield.get', {'id': '223', 'LIST': elems})
cur.execute("""SELECT * from docs""")
rows = cur.fetchall()
elems = []
for r in rows:
doc = r[0]
elems.append({'VALUE': r[0]})
print(elems)
res = bx24.call('crm.deal.userfield.update', {'id': '223', 'LIST': elems})
res = bx24.call('crm.deal.userfield.get', {'id': '225'})
elems = []
for elem in res['LIST']:
elems.append({'ID': elem['ID'], 'DEL': 'Y'})
res = bx24.call('crm.deal.userfield.get', {'id': '225', 'LIST': elems})
cur.execute("""SELECT * from docs""")
rows = cur.fetchall()
elems = []
for r in rows:
doc = r[0]
elems.append({'VALUE': r[0]})
res = bx24.call('crm.deal.userfield.update', {'id': '225', 'LIST': elems})
Answer the question
In order to leave comments, you need to log in
Here is the error.
In the `LIST` field, the author tries to send a json structure, while Bitrix is waiting for HTTP parameters.
Thus his original query is:
https://domain.bitrix24.ua/rest/321/apicode/crm.deal.userfield.update.json?ID=223&LIST=[{"id": "49", "DEL": "Y"}]
https://domain.bitrix24.ua/rest/321/apicode/crm.deal.userfield.update.json?id=223&LIST[0][ID]=49&LIST[0][DEL]=Y
{
"id": 223,
"LIST": [{"id": "49", "DEL": "Y"}]
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question