PutItem¶
- POST v1/{project_id}/data/tables/{table_name}/put_item¶
Request Syntax
{
"expected": {
"string": {
"exists": "boolean",
"value": {
"B": "blob",
"BS": [
"blob"
],
"N": "string",
"NS": [
"string"
],
"S": "string",
"SS": [
"string"
]
}
}
},
"item": {
"string": {
"B": "blob",
"BS": [
"blob"
],
"N": "string",
"NS": [
"string"
],
"S": "string",
"SS": [
"string"
]
}
},
"time_to_live": "number",
"return_values": "string"
}
Request Parameters:
- item
A map of attribute name/value pairs, one for each attribute. Only the primary key attributes are required.Type: String to Attributevalue object mapRequired: Yes- expected
The conditional block for the PutItem operation.Type: String to expectedAttributevalue object mapRequired: No- time_to_live
Defines time to live for itemType: numberValid values: 0 - MAX_NUMBERRequired: No- return_values
Use return_values if you want to get the item attributes as they appeared before they were updated.Type: StringValid values: NONE | ALL_OLDRequired: No
Response Syntax
{
"attributes": {
"string": {
"B": "blob",
"BS": [
"blob"
],
"N": "string",
"NS": [
"string"
],
"S": "string",
"SS": [
"string"
]
}
}
}
Response Elements
- attributes
The attribute values as they appeared before the PutiItem operation.Type: String to attribute struct
- Errors
- TBW
Sample Request
{
"item": {
"LastPostDateTime": {
"S": "201303190422"
},
"Tags": {
"SS": ["Update", "Multiple items", "HelpMe"]
},
"ForumName": {
"S": "MagnetoDB"
},
"Message": {
"S": "I want to update multiple items."
},
"Subject": {
"S": "How do I update multiple items?"
},
"LastPostedBy": {
"S": "fred@example.com"
}
},
"expected": {
"ForumName": {
"exists": false
},
"Subject": {
"exists": false
}
},
"return_values": "ALL_OLD"
}
Sample Response
{
"attributes": {
"ForumName": {
"S": "MagnetoDB"
},
"LastPostDateTime": {
"S": "201303190422"
},
"LastPostedBy": {
"S": "fred@example.com"
},
"Message": {
"S": "I want to update multiple items."
},
"Subject": {
"S": "How do I update multiple items?"
},
"Tags": {
"SS": ["HelpMe", "Multiple items", "Update"]
}
}
}