--- sidebar_position: 1 description: Put object and other functions to work with S3 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, S3] --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; # Put object Uploads the file to the bucket `Function PutObject(Val Name, Val Bucket, Val Entity, Val BasicData, Val Headers = Undefined, Val Directory = False) Export` | Parameter | CLI option | Type | Required | Description | |-|-|-|-|-| | Name | --name | String | ✔ | Name of the object in the bucket | | Bucket | --bucket | String | ✔ | Name of the bucket to put the object | | Entity | --data | String, BinaryData | ✔ | File path or binary data of the object | | BasicData | --basic | Structure Of KeyAndValue | ✔ | Basic request data. See GetBasicDataStructure | | Headers | --headers | Map Of KeyAndValue | ✖ | Additional request headers, if necessary | | Directory | --dir | Boolean | ✖ | True > Path style URL, False > Virtual hosted style URL | Returns: Structure Of KeyAndValue - serialized JSON response from storage
:::tip Method at AWS documentation (default): [PutObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html)
Method at AWS documentation (multipart): [Multipart upload](https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html) You can use the `ChunkSize` field in the basic data to specify the minimum file and chunk size for a chunked upload For example, `ChunkSize=X` means that all files larger than `X` (in bytes) will be downloaded in chunks, where one chunk will be of size `X`. Chunk upload is used for large files. Default `ChunkSize` - 20971520 bytes (20 MB) Parameters with Binary data type can also accept file paths on disk and URLs :::
```bsl title="1C:Enterprise/OneScript code example" URL = "storage-155.s3hoster.by"; AccessKey = "BRN5RKJE67..."; SecretKey = "NNhv+i9PrytpT8Tu0C1N..."; Region = "BTC"; BasicData = OPI_S3.GetBasicDataStructure(URL, AccessKey, SecretKey, Region); Directory = True; // Formation URL in path-style Bucket = "opi-dirbucket3"; Name = "picture.jpg"; Entity = "https://hut.openintegrations.dev/test_data/picture.jpg"; // URL, Path or Binary Data Result = OPI_S3.PutObject(Name, Bucket, Entity, BasicData, , Directory); Name = "fileChunked.mp3"; Entity = "https://hut.openintegrations.dev/test_data/song.mp3"; // URL, Path or Binary Data BasicData.Insert("ChunkSize", 5242880); // Size parts for upload in multiple of requests Result = OPI_S3.PutObject(Name, Bucket, Entity, BasicData, , Directory); ``` ```bash # JSON data can also be passed as a path to a .json file oint s3 PutObject \ --name "fileChunked.mp3" \ --bucket "opi-dirbucket3" \ --data "https://hut.openintegrations.dev/test_data/song.mp3" \ --basic "{'URL':'storage-155.s3hoster.by','AccessKey':'***','SecretKey':'***','Region':'BTC','Service':'s3','ChunkSize':'5242880'}" \ --dir true ``` ```batch :: JSON data can also be passed as a path to a .json file oint s3 PutObject ^ --name "fileChunked.mp3" ^ --bucket "opi-dirbucket3" ^ --data "https://hut.openintegrations.dev/test_data/song.mp3" ^ --basic "{'URL':'storage-155.s3hoster.by','AccessKey':'***','SecretKey':'***','Region':'BTC','Service':'s3','ChunkSize':'5242880'}" ^ --dir true ``` ```json title="Result" { "status": 200, "response": {}, "headers": { "Accept-Ranges": "bytes", "Date": "Wed, 15 Oct 2025 10:28:51 GMT", "ETag": "\"9e0176f87f6565a22f78e0f9b39a4d78\"", "Server": "MinIO", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Origin, Accept-Encoding", "X-Amz-Id-2": "93c576aa54c960b355da9e2934476635fe3243f5df9dbb4db8b7c0d94bec7cd1", "X-Amz-Request-Id": "186EA35B8AF5F961", "X-Content-Type-Options": "nosniff", "X-XSS-Protection": "1; mode=block", "Content-Length": "0", "Content-Type": "text/plain; charset=utf-8" } } ```