

# PutRows

The `PutRows` operation writes rows to a channel of a table in Amazon S3 Tables, so that you can stream data into the table.

The following limits apply to each request:
+ The maximum payload size is 50 MiB (52,428,800 bytes). If the payload is larger, the request fails with a `BadRequestException` error.
+ The maximum number of rows in a payload is 500,000. If the payload contains more rows, the request fails with a `BadRequestException` error.
+ Only the `default` channel is supported. If you specify any other `channelId`, the request fails with a `BadRequestException` error.

You can gzip-compress the request body and set `Content-Encoding: gzip`. The 50 MiB limit applies to the request body and, if the body is compressed, also to the decompressed body. The data decoded from the payload is also limited to 50 MiB.

To send Avro, set `payloadFormat` to `AVRO`. The payload of each request must be a single Apache Avro Object Container File (OCF) with at least one row. To write more files, send a separate request for each one. Each field of the writer schema must match a column of the table. The row limit counts the rows in the file.

Permissions  
To use this operation, you must have all of the following permissions on the table. Amazon S3 Tables doesn't have a separate `s3tables:PutRows` permission.  
+  `s3tables:GetTableData` 
+  `s3tables:PutTableData` 
+  `s3tables:GetTableMetadataLocation` 
+  `s3tables:UpdateTableMetadataLocation` 

## Request Syntax
<a name="API_s3Buckets_PutRows_RequestSyntax"></a>

```
POST /tables/rows?channelId={{channelId}}&tableArn={{tableARN}} HTTP/1.1
x-amz-payload-format: {{payloadFormat}}
x-amz-sdk-checksum-algorithm: {{checksumAlgorithm}}

{{payload}}
```

## URI Request Parameters
<a name="API_s3Buckets_PutRows_RequestParameters"></a>

The request uses the following URI parameters.

 ** [channelId](#API_s3Buckets_PutRows_RequestSyntax) **   <a name="AmazonS3-s3Buckets_PutRows-request-uri-channelId"></a>
The identifier of the channel to write rows to. If you don't specify a channel, the operation uses `default`. Only `default` is supported.  
Length Constraints: Minimum length of 1. Maximum length of 64.  
Pattern: `[a-z0-9-]+` 

 ** [checksumAlgorithm](#API_s3Buckets_PutRows_RequestSyntax) **   <a name="AmazonS3-s3Buckets_PutRows-request-checksumAlgorithm"></a>
(Optional) The algorithm to use to calculate the checksum of the payload. Each `PutRows` request must include a payload checksum. If you use an AWS SDK, the SDK calculates the checksum for you. If the checksum doesn't match the payload, the request fails with a `BadRequestException` error.  
Valid Values: `CRC32 | CRC32C | CRC64NVME | SHA1 | SHA256` 

 ** [payloadFormat](#API_s3Buckets_PutRows_RequestSyntax) **   <a name="AmazonS3-s3Buckets_PutRows-request-payloadFormat"></a>
Specifies the format of the rows in `payload`. The following values are valid:  
+  `JSON` – Newline-delimited JSON: each row is one JSON object on its own line.
+  `AVRO` – Apache Avro data in the Object Container File (OCF) format. Other Avro encodings, such as single-object encoding or Avro data without the container, aren't accepted. Each field of the writer schema must match a column of the table.
Valid Values: `JSON | AVRO`   
Required: Yes

 ** [tableARN](#API_s3Buckets_PutRows_RequestSyntax) **   <a name="AmazonS3-s3Buckets_PutRows-request-uri-tableARN"></a>
The Amazon Resource Name (ARN) of the table to write rows to.  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `(arn:aws[-a-z0-9]*:[a-z0-9]+:[-a-z0-9]*:[0-9]{12}:bucket/[a-z0-9_-]{3,63}/table/[a-zA-Z0-9-_]{1,255})`   
Required: Yes

## Request Body
<a name="API_s3Buckets_PutRows_RequestBody"></a>

The request accepts the following binary data.

 ** [payload](#API_s3Buckets_PutRows_RequestSyntax) **   <a name="AmazonS3-s3Buckets_PutRows-request-payload"></a>
The rows to write, encoded in the format that you specify in `payloadFormat`. The maximum payload size is 50 MiB (52,428,800 bytes), and the maximum number of rows is 500,000.  
Required: Yes

## Response Syntax
<a name="API_s3Buckets_PutRows_ResponseSyntax"></a>

```
HTTP/1.1 200
Content-type: application/json

{
   "acceptedRows": number
}
```

## Response Elements
<a name="API_s3Buckets_PutRows_ResponseElements"></a>

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [acceptedRows](#API_s3Buckets_PutRows_ResponseSyntax) **   <a name="AmazonS3-s3Buckets_PutRows-response-acceptedRows"></a>
The number of rows that the channel accepted.  
Type: Long  
Valid Range: Minimum value of 0.

## Errors
<a name="API_s3Buckets_PutRows_Errors"></a>

 ** AccessDeniedException **   
The action cannot be performed because you do not have the required permission.  
HTTP Status Code: 403

 ** BadRequestException **   
The request is invalid or malformed.  
HTTP Status Code: 400

 ** InternalServerErrorException **   
The request failed due to an internal server error.  
HTTP Status Code: 500

 ** NotFoundException **   
The request was rejected because the specified resource could not be found.  
HTTP Status Code: 404

 ** ServiceUnavailableException **   
The request failed because the service is temporarily unavailable. Retry your request.  
HTTP Status Code: 503

 ** TooManyRequestsException **   
The limit on the number of requests per second was exceeded.  
HTTP Status Code: 429

## See Also
<a name="API_s3Buckets_PutRows_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/s3tables-2018-05-10/PutRows) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/s3tables-2018-05-10/PutRows) 
+  [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/s3tables-2018-05-10/PutRows) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/s3tables-2018-05-10/PutRows) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/s3tables-2018-05-10/PutRows) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/s3tables-2018-05-10/PutRows) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/s3tables-2018-05-10/PutRows) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/s3tables-2018-05-10/PutRows) 
+  [AWS SDK for Python (Boto3)](https://docs.aws.amazon.com/goto/boto3/s3tables-2018-05-10/PutRows) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/s3tables-2018-05-10/PutRows) 