2024-06-05 10:19:46 +00:00
|
|
|
---
|
|
|
|
sidebar_position: 4
|
|
|
|
---
|
|
|
|
|
|
|
|
# Upload file
|
|
|
|
Uploads a file to the drive
|
|
|
|
|
|
|
|
|
2024-07-10 11:59:55 +03:00
|
|
|
|
2024-07-10 13:58:29 +03:00
|
|
|
`Function UploadFile(Val Token, Val File, Val Description) Export`
|
2024-06-05 10:19:46 +00:00
|
|
|
|
2024-08-13 15:52:26 +03:00
|
|
|
| Parameter | CLI option | Type | Description |
|
|
|
|
|-|-|-|-|
|
|
|
|
| Token | --token | String | Token |
|
|
|
|
| File | --file | BinaryData,String | File to be uploaded |
|
|
|
|
| Description | --props | Map Of KeyAndValue | JSON description or path to .json |
|
2024-06-05 10:19:46 +00:00
|
|
|
|
2024-08-13 15:52:26 +03:00
|
|
|
|
|
|
|
Returns: Map Of KeyAndValue - serialized JSON response from Google
|
2024-06-05 10:19:46 +00:00
|
|
|
|
2024-07-10 14:05:58 +03:00
|
|
|
<br/>
|
2024-07-10 11:59:55 +03:00
|
|
|
|
2024-07-10 13:58:29 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-05 10:19:46 +00:00
|
|
|
```bsl title="Code example"
|
2024-09-29 00:25:48 +03:00
|
|
|
Token = "ya29.a0AcM612wLdbBK14FR2SE0d3WHabYb8Xtppm0oKCcbVrecgsA-a5DfsgZ29stOw4hu84F_IpHbKTJocsm1WpjLQPBT5MJ6p8D7H1PKa_iT0...";
|
2024-09-29 12:34:39 +03:00
|
|
|
Image = "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg";
|
2024-09-28 19:38:00 +03:00
|
|
|
Directory = "191iyaa6-2BCNRPOF0F8mQ0TuNWPNesdM";
|
|
|
|
|
|
|
|
Description = OPI_GoogleDrive.GetFileDescription();
|
|
|
|
Description.Insert("Parent", Directory);
|
|
|
|
|
|
|
|
Result = OPI_GoogleDrive.UploadFile(Token, Image, Description);
|
2024-06-05 10:19:46 +00:00
|
|
|
```
|
2024-08-13 15:52:26 +03:00
|
|
|
|
2024-07-10 11:59:55 +03:00
|
|
|
|
2024-06-05 10:19:46 +00:00
|
|
|
|
|
|
|
```sh title="CLI command example"
|
2024-08-13 15:52:26 +03:00
|
|
|
|
|
|
|
oint gdrive UploadFile --token %token% --file %file% --props %props%
|
2024-06-05 10:19:46 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```json title="Result"
|
2024-08-14 09:06:31 +03:00
|
|
|
{
|
2024-08-13 15:52:26 +03:00
|
|
|
"mimeType": "image/jpeg",
|
|
|
|
"name": "New file.jpg",
|
|
|
|
"id": "16hPGNTMmbnXhz_g0vjGbrLP19h56RwIg",
|
|
|
|
"kind": "drive#file"
|
|
|
|
}
|
2024-06-05 10:19:46 +00:00
|
|
|
```
|