mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-03-29 21:57:16 +02:00
226 lines
5.4 KiB
Plaintext
226 lines
5.4 KiB
Plaintext
---
|
|
sidebar_position: 1
|
|
---
|
|
|
|
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("Status" , "status");
|
|
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','Status':{'New':'green','InProgress':'yellow','Remote':'red'},'CreationDate':'date','Image':'files','Active':'checkbox','Website':'url','Email':'email','Phone':'phone_number','User':'people'}"
|
|
```
|
|
</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','Status':{'New':'green','InProgress':'yellow','Remote':'red'},'CreationDate':'date','Image':'files','Active':'checkbox','Website':'url','Email':'email','Phone':'phone_number','User':'people'}"
|
|
```
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
|
|
```json title="Result"
|
|
{
|
|
"object": "database",
|
|
"id": "11a82aa7-fc4e-8138-a724-ee8786147d82",
|
|
"cover": null,
|
|
"icon": null,
|
|
"created_time": "2024-10-09T06:14: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": "2024-10-09T06:14: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": {
|
|
"Description": {
|
|
"id": "%3COFd",
|
|
"name": "Description",
|
|
"type": "rich_text",
|
|
"rich_text": {}
|
|
},
|
|
"Phone": {
|
|
"id": "Ne%7DI",
|
|
"name": "Phone",
|
|
"type": "phone_number",
|
|
"phone_number": {}
|
|
},
|
|
"CreationDate": {
|
|
"id": "P%3Doo",
|
|
"name": "CreationDate",
|
|
"type": "date",
|
|
"date": {}
|
|
},
|
|
"Active": {
|
|
"id": "Ub%7C%5D",
|
|
"name": "Active",
|
|
"type": "checkbox",
|
|
"checkbox": {}
|
|
},
|
|
"Number": {
|
|
"id": "%5Dotl",
|
|
"name": "Number",
|
|
"type": "number",
|
|
"number": {
|
|
"format": "number"
|
|
}
|
|
},
|
|
"Email": {
|
|
"id": "%60%7DN%3F",
|
|
"name": "Email",
|
|
"type": "email",
|
|
"email": {}
|
|
},
|
|
"Status": {
|
|
"id": "bAZ%7D",
|
|
"name": "Status",
|
|
"type": "select",
|
|
"select": {
|
|
"options": [
|
|
{
|
|
"id": "0e626378-0386-4985-88de-b747968504e7",
|
|
"name": "New",
|
|
"color": "green",
|
|
"description": null
|
|
},
|
|
{
|
|
"id": "e9a7ad5c-196f-4b2a-b2de-e84e849f2183",
|
|
"name": "InProgress",
|
|
"color": "yellow",
|
|
"description": null
|
|
},
|
|
{
|
|
"id": "1b214a08-6768-4381-b3cb-d8dd88250f8c",
|
|
"name": "Remote",
|
|
"color": "red",
|
|
"description": null
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"Website": {
|
|
"id": "fd%3F%60",
|
|
"name": "Website",
|
|
"type": "url",
|
|
"url": {}
|
|
},
|
|
"User": {
|
|
"id": "%7B%3Bsu",
|
|
"name": "User",
|
|
"type": "people",
|
|
"people": {}
|
|
},
|
|
"Image": {
|
|
"id": "%7B%3F%5B%3F",
|
|
"name": "Image",
|
|
"type": "files",
|
|
"files": {}
|
|
},
|
|
"Name": {
|
|
"id": "title",
|
|
"name": "Name",
|
|
"type": "title",
|
|
"title": {}
|
|
}
|
|
},
|
|
"parent": {
|
|
"type": "page_id",
|
|
"page_id": "5dd94c34-fab0-4bff-986b-7511c0779f77"
|
|
},
|
|
"url": "https://www.notion.so/11a82aa7fc4e8138a724ee8786147d82",
|
|
"public_url": null,
|
|
"archived": false,
|
|
"in_trash": false,
|
|
"request_id": "6abe3614-54de-4d28-8771-1e641c3a5828"
|
|
}
|
|
```
|