1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-11-27 22:18:36 +02:00
Files
OpenIntegrations/docs/en/md/Google_Drive/File-and-directory-management/Update-file.mdx

76 lines
2.1 KiB
Plaintext
Raw Normal View History

2024-10-15 10:50:56 +03:00
---
2024-10-15 10:16:04 +03:00
sidebar_position: 8
---
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 file
Updates file binary data
`Function UpdateFile(Val Token, Val Identifier, Val File, Val NewName = "") Export`
2024-10-15 15:15:47 +03:00
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Token | --token | String | ✔ | Token |
| Identifier | --object | String | ✔ | Identifier of the object to update |
| File | --file | BinaryData,String | ✔ | File source for update |
| NewName | --title | String | ✖ | New file name (if necessary) |
2024-10-15 10:16:04 +03:00
Returns: Map Of KeyAndValue - serialized JSON response from Google
<br/>
2024-10-15 13:51:58 +03:00
:::tip
Parameters with Binary data type can also accept file paths on disk and URLs
:::
<br/>
2024-10-15 10:16:04 +03:00
2024-12-16 19:38:57 +03:00
2024-10-15 21:15:56 +03:00
```bsl title="1C:Enterprise/OneScript code example"
2025-04-30 21:14:58 +03:00
Token = "ya29.a0AZYkNZjIV5CkSd4sG47GQZDD-dFWBLC9lYHit70VQoD1wHLXasvRgFEiis7NvRJmYFxPlQAZq3Jr5IbR8xb2VlpMtT6cSTKYo2UHXdMyx...";
2024-10-15 10:16:04 +03:00
NewName = "UpdatedFile.jpg";
2025-04-30 21:14:58 +03:00
Identifier = "10d3Rn4IZPtS20TENvuRdf8vNozgBpg_q";
2025-04-16 22:15:09 +03:00
File = "https://api.athenaeum.digital/test_data/picture2.jpg"; // URL, Binary Data or File path
2024-10-15 10:16:04 +03:00
Result = OPI_GoogleDrive.UpdateFile(Token, Identifier, File, NewName);
```
2024-10-20 22:36:03 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
oint gdrive UpdateFile \
2024-10-22 08:59:24 +03:00
--token "***" \
2025-04-06 17:14:16 +03:00
--object "1jzV6Bm86Q6kmJhHY20uo7M-l76kYLx-c" \
2024-10-22 08:59:24 +03:00
--file "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture2.jpg" \
--title "UpdatedFile.jpg"
2024-10-20 22:36:03 +03:00
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint gdrive UpdateFile ^
2024-10-22 08:59:24 +03:00
--token "***" ^
2025-04-06 17:14:16 +03:00
--object "1jzV6Bm86Q6kmJhHY20uo7M-l76kYLx-c" ^
2024-10-22 08:59:24 +03:00
--file "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture2.jpg" ^
--title "UpdatedFile.jpg"
2024-10-20 22:36:03 +03:00
```
</TabItem>
</Tabs>
2024-10-15 10:16:04 +03:00
```json title="Result"
{
"kind": "drive#file",
"id": "1slRtvK9Yap08a-wh_iE5go6dkCMwZrYH",
"name": "UpdatedFile.jpg",
"mimeType": "image/jpeg"
}
```