1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-04-27 12:32:33 +02:00

105 lines
3.0 KiB
Plaintext
Raw Normal View History

2024-10-15 10:50:56 +03:00
---
2024-10-15 10:16:04 +03:00
sidebar_position: 4
---
2024-10-15 10:50:56 +03:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2024-10-15 10:16:04 +03:00
# Update user
Updates user data
`Function UpdateUser(Val URL, Val UserID, Val FieldsStructure, Val Token = "") Export`
2024-10-15 15:15:47 +03:00
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| URL | --url | String | ✔ | URL of webhook or a Bitrix24 domain, when token used |
| UserID | --userid | String, Number | ✔ | User ID |
| FieldsStructure | --fields | Structure of KeyAndValue | ✔ | New user data. See. GetUserFieldsStructure |
| Token | --token | String | ✖ | Access token, when app auth method used |
2024-10-15 10:16:04 +03:00
Returns: Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
<br/>
:::tip
2024-11-21 13:27:18 +03:00
Method at API documentation: [user.update](https://dev.1c-bitrix.ru/rest_help/users/user_update.php)
2024-10-15 10:16:04 +03:00
:::
<br/>
2024-12-16 19:38:57 +03:00
2024-10-15 21:15:56 +03:00
```bsl title="1C:Enterprise/OneScript code example"
2024-12-08 12:04:47 +03:00
URL = "https://b24-ar17wx.bitrix24.by/rest/1/ps5...";
2024-12-24 20:21:21 +03:00
UserID = "1344";
2024-10-15 10:16:04 +03:00
Email = String(New UUID) + "@exepmple.org";
// The full structure can be obtained with the function GetUserFieldsStructure
UserStructure = New Structure;
UserStructure.Insert("EMAIL" , Email);
UserStructure.Insert("UF_DEPARTMENT", 1);
Result = OPI_Bitrix24.UpdateUser(URL, UserID, UserStructure);
URL = "b24-ar17wx.bitrix24.by";
2024-12-24 20:21:21 +03:00
Token = "70f46a67006e9f06006b12e400000001000...";
UserID = "1346";
2024-10-15 10:16:04 +03:00
Email = String(New UUID) + "@exepmple.org";
UserStructure = New Structure;
UserStructure.Insert("EMAIL" , Email);
UserStructure.Insert("NAME" , "Oleg");
UserStructure.Insert("LAST_NAME" , "Lama");
UserStructure.Insert("UF_DEPARTMENT" , 7);
Result = OPI_Bitrix24.UpdateUser(URL, UserID, UserStructure, Token);
```
2024-10-20 22:36:03 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
2024-10-22 08:59:24 +03:00
# JSON data can also be passed as a path to a .json file
2024-10-20 22:36:03 +03:00
oint bitrix24 UpdateUser \
2024-10-22 08:59:24 +03:00
--url "b24-ar17wx.bitrix24.by" \
2024-12-25 11:43:34 +03:00
--userid 1362 \
--fields "{'EMAIL':'1d922d14-2361-4636-9ca8-004118491f1a@exepmple.org','NAME':'Oleg','LAST_NAME':'Lama','UF_DEPARTMENT':7}" \
2024-10-22 08:59:24 +03:00
--token "***"
2024-10-20 22:36:03 +03:00
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
2024-10-22 08:59:24 +03:00
:: JSON data can also be passed as a path to a .json file
2024-10-20 22:36:03 +03:00
oint bitrix24 UpdateUser ^
2024-10-22 08:59:24 +03:00
--url "b24-ar17wx.bitrix24.by" ^
2024-12-25 11:43:34 +03:00
--userid 1362 ^
--fields "{'EMAIL':'1d922d14-2361-4636-9ca8-004118491f1a@exepmple.org','NAME':'Oleg','LAST_NAME':'Lama','UF_DEPARTMENT':7}" ^
2024-10-22 08:59:24 +03:00
--token "***"
2024-10-20 22:36:03 +03:00
```
</TabItem>
</Tabs>
2024-10-15 10:16:04 +03:00
```json title="Result"
{
"result": true,
"time": {
"start": 1728454936.24134,
"finish": 1728454936.55634,
"duration": 0.315001964569092,
"processing": 0.287670135498047,
"date_start": "2024-10-09T09:22:16+03:00",
"date_finish": "2024-10-09T09:22:16+03:00",
"operating_reset_at": 1728455536,
"operating": 0.287650108337402
}
}
```