mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-04-07 07:10:01 +02:00
81 lines
2.2 KiB
Plaintext
Vendored
81 lines
2.2 KiB
Plaintext
Vendored
---
|
|
sidebar_position: 2
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
# Create calendar
|
|
Creates a new calendar
|
|
|
|
|
|
|
|
`Function CreateCalendar(Val URL, Val FieldsStructure, Val Token = "") Export`
|
|
|
|
| Parameter | CLI option | Type | Required | Description |
|
|
|-|-|-|-|-|
|
|
| URL | --url | String | ✔ | URL of webhook or a Bitrix24 domain, when token used |
|
|
| FieldsStructure | --fields | Structure Of KeyAndValue | ✔ | Calendar fields structure (see GetCalendarStructure) |
|
|
| Token | --token | String | ✖ | Access token, when app auth method used |
|
|
|
|
|
|
Returns: Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
|
|
|
|
<br/>
|
|
|
|
:::tip
|
|
Method at API documentation: [calendar.section.add](https://apidocs.bitrix24.ru/api-reference/calendar/calendar-section-add.html)
|
|
:::
|
|
<br/>
|
|
|
|
|
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
|
UserID = 1;
|
|
|
|
CalendarsStructure = New Structure;
|
|
CalendarsStructure.Insert("type" , "user");
|
|
CalendarsStructure.Insert("ownerId" , UserID);
|
|
CalendarsStructure.Insert("name" , "new calendar");
|
|
CalendarsStructure.Insert("description", "My new calendar");
|
|
CalendarsStructure.Insert("color" , "#FFFFFF");
|
|
CalendarsStructure.Insert("text_color" , "#000000");
|
|
|
|
ExportStructure = New Structure;
|
|
ExportStructure.Insert("ALLOW", "True");
|
|
ExportStructure.Insert("SET" , "all");
|
|
|
|
CalendarsStructure.Insert("export", ExportStructure);
|
|
|
|
URL = "https://b24-ar17wx.bitrix24.by/rest/1/h0m...";
|
|
|
|
Result = OPI_Bitrix24.CreateCalendar(URL, CalendarsStructure);
|
|
|
|
CalendarsStructure.Insert("name" , "Another calendar");
|
|
CalendarsStructure.Insert("description", "My other new calendar");
|
|
|
|
URL = "b24-ar17wx.bitrix24.by";
|
|
Token = "0fed8c67006e9f06006b12e400000001000...";
|
|
|
|
Result = OPI_Bitrix24.CreateCalendar(URL, CalendarsStructure, Token);
|
|
```
|
|
|
|
|
|
|
|
|
|
```json title="Result"
|
|
{
|
|
"result": 80,
|
|
"time": {
|
|
"start": 1737396240.60307,
|
|
"finish": 1737396240.65016,
|
|
"duration": 0.0470879077911377,
|
|
"processing": 0.0163719654083252,
|
|
"date_start": "2025-01-20T21:04:00+03:00",
|
|
"date_finish": "2025-01-20T21:04:00+03:00",
|
|
"operating_reset_at": 1737396840,
|
|
"operating": 0
|
|
}
|
|
}
|
|
```
|