0
我想弄清楚如何制作API以允许使用AWS API更新/删除条目。理想的情况下。我想要它,所以当你拨打'apijfkdlsfjdlaf.com.aws/delete/{idnumber}'
它会删除那个特定的条目。使用AWS API删除/更新DynamoDB条目
我的积分请求从DynamoDB调用DeleteItem,看起来像:
{
"TableName": "Blah",
"KeyConditionExpression": "blahID= :v1",
"ExpressionAttributeValues": {
":v1": {
"S": "$input.params('blahID')"
}
}
}
我能读/写条目,所以我知道我的访问控制是建立适当的,但是当我测试delete命令我收到该follwing:
{
"__type": "com.amazon.coral.validate#ValidationException",
"message": "1 validation error detected: Value null at 'key' failed to satisfy constraint: Member must not be null"
}
,并将日志:http://pastebin.com/M4sSGWUS
任何帮助表示赞赏。
编辑:我已经改变了合并请求与在其网站上的文档一致:
var AWS = require("aws-sdk");
var docClient = new AWS.DynamoDB.DocumentClient();
var table = "Blah";
var ID= "$input.params('blahID')";
var params = {
TableName:table,
Key:{
"blahID":ID,
}
};
docClient.delete(params, function(err, data) {
if (err) {
console.error("Unable to delete item. Error JSON:", JSON.stringify(err, null, 2));
} else {
console.log("DeleteItem succeeded:", JSON.stringify(data, null, 2));
}
});
现在得到一个"__type": "com.amazon.coral.service#SerializationException"
错误