Skip to content

api.aws.dynamodb.putItem@v1

tristanls edited this page Nov 25, 2012 · 2 revisions

Put item.

Since Version 1.0.0
Scope
accepts: public

Parameters

All parameters are optional, unless otherwise indicated.

awsAccessKeyId AKIAIOSFODNN7EXAMPLE required AWS Access Key Id
item {name:"my test name",attr1:"value1"} required The item to put
region us-east-1 required Region where your DynamoDB is hosted
secretAccessKey wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY required AWS Secret Access Key
tableName my-table required The DynamoDb table name to perform this operation on

Response fields

Response

consumedCapacityUnits 1 Consumed capacity units
attributes {"name":"my test value",... Attributes returned as specified by returnValues parameter

Error

message Error message Error message

Example

Request

crosstalk.emit( 
  '~crosstalk.api.aws.dynamodb.putItem@v1', 
  {
    awsAccessKeyId : "KEYNAME",
    item : {
      name : "my test value",
      version : "0.0.0",
      attr1 : "attribute value 1"
    },
    region : "us-east-1",
    returnValues : "ALL_OLD",
    secretAccessKey : "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY",
    tableName : "test-table"
  }, 
  '~crosstalk', 
  function ( error, response ) { /* ... */ } 
);

Response:

{
  "attributes":{
    "name":"my test value",
    "version":"0.0.0",
    "attr1":"attribute value 1"
  },
  "consumedCapacityUnits":1
}

Error:

{
  "message": "Error message"
}