Database Reference
In-Depth Information
PutItem
In the previous request, we have issued a REST API command to create the table. We will
now see how to insert an item into the table created by the previous request. Have a look at
the following code:
{
"TableName": "Tbl_Book",
"Item": {
"BookTitle": {"S": "SCJP" },
"Author": {"S": "Kathy" },
"Publisher": {"S": "TMH"},
"PubDate": { "S": "28-Dec-09" },
"Language": {"SS": ["English","German"] },
"Edition" : { "N": "1"} },
"Expected": {
"BookTitle": {"ComparisonOperator": "NULL", },
"Author": {"ComparisonOperator": "NULL", } }
}
The preceding code will put an item into the Tbl_Book table. We might question the use
of a new field in the JSON called Expected . By default, if SCJP ( BookTitle ) and
Kathy ( Author ) are already available in the table, then the older items will be replaced
with the newer ones. To prevent the newer item from overwriting the older one, Compar-
isonOperator must be set to NULL .
Search WWH ::




Custom Search