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-05-01 12:55:47 +03:00
|
|
|
Token = "ya29.a0AZYkNZiCaf3vW8I05cl_i6pLKCRWSjff1YhC7Yi0SgLO50zysjwrX_9QPi1WejmqgGdFjcbaOJKsPO3tvT7gB712mg1gxgxiL1pCUVthx...";
|
2024-10-15 10:16:04 +03:00
|
|
|
NewName = "UpdatedFile.jpg";
|
2025-05-01 12:55:47 +03:00
|
|
|
Identifier = "1CK_FNwlq0eNfmse2YyeXaNStG80Lu2wI";
|
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-05-01 20:09:27 +03:00
|
|
|
--object "17mRmuTKqO23zMKyw483Awr4zhFrcGBXR" \
|
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-05-01 20:09:27 +03:00
|
|
|
--object "17mRmuTKqO23zMKyw483Awr4zhFrcGBXR" ^
|
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"
|
|
|
|
|
}
|
|
|
|
|
```
|