You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-11-27 22:18:36 +02:00
237 lines
5.9 KiB
Plaintext
Vendored
237 lines
5.9 KiB
Plaintext
Vendored
---
|
|
sidebar_position: 1
|
|
description: Create database and other functions to work with Notion in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
|
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Notion]
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
# Create database
|
|
Creates a database
|
|
|
|
|
|
|
|
`Function CreateDatabase(Val Token, Val Parent, Val Title, Val Properties = "") Export`
|
|
|
|
| Parameter | CLI option | Type | Required | Description |
|
|
|-|-|-|-|-|
|
|
| Token | --token | String | ✔ | Token |
|
|
| Parent | --page | String | ✔ | Parent page ID |
|
|
| Title | --title | String | ✔ | Database title |
|
|
| Properties | --props | Structure Of String | ✖ | Database properties |
|
|
|
|
|
|
Returns: Map Of KeyAndValue - serialized JSON response from Notion
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
|
Token = "secret_9RsfMrRMqZwqp0Zl0B...";
|
|
Parent = "5dd94c34fab04bff986b7511c0779f77";
|
|
Title = "TestTitle";
|
|
|
|
Properties = New Map;
|
|
Properties.Insert("Name" , "title");
|
|
Properties.Insert("Description" , "rich_text");
|
|
Properties.Insert("Number" , "number");
|
|
Properties.Insert("CreationDate", "date");
|
|
Properties.Insert("Image" , "files");
|
|
Properties.Insert("Active" , "checkbox");
|
|
Properties.Insert("Website" , "url");
|
|
Properties.Insert("Email" , "email");
|
|
Properties.Insert("Phone" , "phone_number");
|
|
Properties.Insert("User" , "people");
|
|
|
|
ValueSelection = New Map;
|
|
ValueSelection.Insert("New" , "green");
|
|
ValueSelection.Insert("InProgress" , "yellow");
|
|
ValueSelection.Insert("Remote" , "red");
|
|
|
|
Properties.Insert("Status", ValueSelection);
|
|
|
|
Result = OPI_Notion.CreateDatabase(Token, Parent, Title, Properties);
|
|
```
|
|
|
|
|
|
<Tabs>
|
|
|
|
<TabItem value="bash" label="Bash" default>
|
|
```bash
|
|
# JSON data can also be passed as a path to a .json file
|
|
|
|
oint notion CreateDatabase \
|
|
--token "***" \
|
|
--page "5dd94c34fab04bff986b7511c0779f77" \
|
|
--title "TestTitle" \
|
|
--props "{'Name':'title','Description':'rich_text','Number':'number','CreationDate':'date','Image':'files','Active':'checkbox','Website':'url','Email':'email','Phone':'phone_number','User':'people','Status':{'New':'green','InProgress':'yellow','Remote':'red'}}"
|
|
```
|
|
</TabItem>
|
|
|
|
<TabItem value="bat" label="CMD/Bat" default>
|
|
```batch
|
|
:: JSON data can also be passed as a path to a .json file
|
|
|
|
oint notion CreateDatabase ^
|
|
--token "***" ^
|
|
--page "5dd94c34fab04bff986b7511c0779f77" ^
|
|
--title "TestTitle" ^
|
|
--props "{'Name':'title','Description':'rich_text','Number':'number','CreationDate':'date','Image':'files','Active':'checkbox','Website':'url','Email':'email','Phone':'phone_number','User':'people','Status':{'New':'green','InProgress':'yellow','Remote':'red'}}"
|
|
```
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
|
|
```json title="Result"
|
|
{
|
|
"object": "database",
|
|
"id": "28d82aa7-fc4e-813c-9f5e-ecbe6ad80be3",
|
|
"cover": null,
|
|
"icon": null,
|
|
"created_time": "2025-10-15T09:39:00Z",
|
|
"created_by": {
|
|
"object": "user",
|
|
"id": "8b07422e-eeea-40d1-8d5e-c784211825b0"
|
|
},
|
|
"last_edited_by": {
|
|
"object": "user",
|
|
"id": "8b07422e-eeea-40d1-8d5e-c784211825b0"
|
|
},
|
|
"last_edited_time": "2025-10-15T09:39:00Z",
|
|
"title": [
|
|
{
|
|
"type": "text",
|
|
"text": {
|
|
"content": "TestTitle",
|
|
"link": null
|
|
},
|
|
"annotations": {
|
|
"bold": false,
|
|
"italic": false,
|
|
"strikethrough": false,
|
|
"underline": false,
|
|
"code": false,
|
|
"color": "default"
|
|
},
|
|
"plain_text": "TestTitle",
|
|
"href": null
|
|
}
|
|
],
|
|
"description": [],
|
|
"is_inline": false,
|
|
"properties": {
|
|
"Active": {
|
|
"id": "%3A%40sm",
|
|
"name": "Active",
|
|
"description": null,
|
|
"type": "checkbox",
|
|
"checkbox": {}
|
|
},
|
|
"Phone": {
|
|
"id": "DKWY",
|
|
"name": "Phone",
|
|
"description": null,
|
|
"type": "phone_number",
|
|
"phone_number": {}
|
|
},
|
|
"Description": {
|
|
"id": "EdER",
|
|
"name": "Description",
|
|
"description": null,
|
|
"type": "rich_text",
|
|
"rich_text": {}
|
|
},
|
|
"Number": {
|
|
"id": "GBhx",
|
|
"name": "Number",
|
|
"description": null,
|
|
"type": "number",
|
|
"number": {
|
|
"format": "number"
|
|
}
|
|
},
|
|
"CreationDate": {
|
|
"id": "JEML",
|
|
"name": "CreationDate",
|
|
"description": null,
|
|
"type": "date",
|
|
"date": {}
|
|
},
|
|
"Email": {
|
|
"id": "K%3Cjm",
|
|
"name": "Email",
|
|
"description": null,
|
|
"type": "email",
|
|
"email": {}
|
|
},
|
|
"User": {
|
|
"id": "%5Dopv",
|
|
"name": "User",
|
|
"description": null,
|
|
"type": "people",
|
|
"people": {}
|
|
},
|
|
"Website": {
|
|
"id": "dyW%3B",
|
|
"name": "Website",
|
|
"description": null,
|
|
"type": "url",
|
|
"url": {}
|
|
},
|
|
"Image": {
|
|
"id": "iBvB",
|
|
"name": "Image",
|
|
"description": null,
|
|
"type": "files",
|
|
"files": {}
|
|
},
|
|
"Status": {
|
|
"id": "qljD",
|
|
"name": "Status",
|
|
"description": null,
|
|
"type": "select",
|
|
"select": {
|
|
"options": [
|
|
{
|
|
"id": "0b75fd86-bd5d-4b3f-bf57-1090103376d1",
|
|
"name": "New",
|
|
"color": "green",
|
|
"description": null
|
|
},
|
|
{
|
|
"id": "a3cc9086-34c4-4b73-8eab-ddae9498b164",
|
|
"name": "InProgress",
|
|
"color": "yellow",
|
|
"description": null
|
|
},
|
|
{
|
|
"id": "dc85b516-6ea8-4435-8c48-e623fc013da8",
|
|
"name": "Remote",
|
|
"color": "red",
|
|
"description": null
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"Name": {
|
|
"id": "title",
|
|
"name": "Name",
|
|
"description": null,
|
|
"type": "title",
|
|
"title": {}
|
|
}
|
|
},
|
|
"parent": {
|
|
"type": "page_id",
|
|
"page_id": "5dd94c34-fab0-4bff-986b-7511c0779f77"
|
|
},
|
|
"url": "https://www.notion.so/28d82aa7fc4e813c9f5eecbe6ad80be3",
|
|
"public_url": null,
|
|
"archived": false,
|
|
"in_trash": false,
|
|
"request_id": "ce1d0213-d452-4fd6-98ea-efa8437fdcd3"
|
|
}
|
|
```
|