PutRecord
Written by
Updated at February 10, 2023
Sends one message into a stream.
The request specifies the stream name, the shard key and an object with user data in Base64 encoding.
Returns the ID of the shard where the message was put and the message sequence number.
Messages are written to the stream shard strictly in the order they are sent.
Request
The request contains data in JSON format.
{
"Data": blob,
"ExplicitHashKey": "string",
"PartitionKey": "string",
"SequenceNumberForOrdering": "string",
"StreamName": "string"
}
Request parameters
Parameter | Description |
---|---|
Data |
User data. Type: Binary, Base64 encoding Size: 0 -1048576 bytes of Base64 encoded dataRequired: Yes |
ExplicitHashKey |
Shard key hash. When using the PartitionKey hash to specify the shard to put a message into, messages may be distributed across shards suboptimally. Use this parameter to explicitly define the shard to write messages to.Type: String Possible values: 0|([1-9]\d{0.38}) Required: No |
PartitionKey |
Shard key. Sets the stream shard to write a message to. Type: String Size: 1 -256 characters.Required: Yes |
StreamName |
The name of the stream. Type: String Size: 1 -128 characters.Possible values: [a-zA-Z][a-zA-Z0-9-]+*(?<!-)$ Required: Yes |
Response
If successful, HTTP code 200 and data in JSON format are returned.
{
"EncryptionType": "string",
"SequenceNumber": "string",
"ShardId": "string"
}
Response parameters
Parameter | Description |
---|---|
EncryptionType |
The type of encryption. Type: String Possible values: NONE Required: Yes |
SequenceNumber |
The sequence number of a message. Type: String Possible values: 0|([1-9]\d{0,128}) Required: Yes |
ShardId |
The ID of the shard that the message was written to. Type: String Size: 1 -128 characters.Possible values: [a-zA-Z0-9_.-]+ Required: Yes |
Errors
Parameter | Description | HTTP code |
---|---|---|
InvalidArgumentException |
The argument is invalid. For more information, see the error message. | 400 |
ProvisionedThroughputExceededException |
Insufficient throughput to execute the request. | 400 |
ResourceNotFoundException |
The requested resource was not found. | 400 |
Errors that are common to all methods may occur.