Create
curl --request POST \
--url https://vdrdfvu2b3.execute-api.us-east-2.amazonaws.com/v3/dynamodb/{YOUR_DB_NAME}/create \
--header 'Content-Type: application/json' \
--data '
{
"id": "<string>",
"name": "<string>"
}
'import requests
url = "https://vdrdfvu2b3.execute-api.us-east-2.amazonaws.com/v3/dynamodb/{YOUR_DB_NAME}/create"
payload = {
"id": "<string>",
"name": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({id: '<string>', name: '<string>'})
};
fetch('https://vdrdfvu2b3.execute-api.us-east-2.amazonaws.com/v3/dynamodb/{YOUR_DB_NAME}/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://vdrdfvu2b3.execute-api.us-east-2.amazonaws.com/v3/dynamodb/{YOUR_DB_NAME}/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => '<string>',
'name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://vdrdfvu2b3.execute-api.us-east-2.amazonaws.com/v3/dynamodb/{YOUR_DB_NAME}/create"
payload := strings.NewReader("{\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://vdrdfvu2b3.execute-api.us-east-2.amazonaws.com/v3/dynamodb/{YOUR_DB_NAME}/create")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://vdrdfvu2b3.execute-api.us-east-2.amazonaws.com/v3/dynamodb/{YOUR_DB_NAME}/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 200,
"body" {
"msg": "Item added to table",
"complete": true
}
}
{
"statusCode": 400,
"body" {
err: "error": {
"message": "One or more parameter values were invalid: Missing the key id in the item",
"code": "ValidationException",
"time": "2023-08-18T19:37:15.678Z",
"requestId": "PM8CAFJ8DP3C27ROARPRBCUPEJVV4KQNSO5AEMVJF66Q9ASUAAJG",
"statusCode": 400,
"retryable": false,
"retryDelay": 45.853296901029964
},,
compelete: false
}
}
DynamoDB API
Create
Add data to your DynamoDB
POST
/
dynamodb
/
{YOUR_DB_NAME}
/
create
Create
curl --request POST \
--url https://vdrdfvu2b3.execute-api.us-east-2.amazonaws.com/v3/dynamodb/{YOUR_DB_NAME}/create \
--header 'Content-Type: application/json' \
--data '
{
"id": "<string>",
"name": "<string>"
}
'import requests
url = "https://vdrdfvu2b3.execute-api.us-east-2.amazonaws.com/v3/dynamodb/{YOUR_DB_NAME}/create"
payload = {
"id": "<string>",
"name": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({id: '<string>', name: '<string>'})
};
fetch('https://vdrdfvu2b3.execute-api.us-east-2.amazonaws.com/v3/dynamodb/{YOUR_DB_NAME}/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://vdrdfvu2b3.execute-api.us-east-2.amazonaws.com/v3/dynamodb/{YOUR_DB_NAME}/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => '<string>',
'name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://vdrdfvu2b3.execute-api.us-east-2.amazonaws.com/v3/dynamodb/{YOUR_DB_NAME}/create"
payload := strings.NewReader("{\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://vdrdfvu2b3.execute-api.us-east-2.amazonaws.com/v3/dynamodb/{YOUR_DB_NAME}/create")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://vdrdfvu2b3.execute-api.us-east-2.amazonaws.com/v3/dynamodb/{YOUR_DB_NAME}/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 200,
"body" {
"msg": "Item added to table",
"complete": true
}
}
{
"statusCode": 400,
"body" {
err: "error": {
"message": "One or more parameter values were invalid: Missing the key id in the item",
"code": "ValidationException",
"time": "2023-08-18T19:37:15.678Z",
"requestId": "PM8CAFJ8DP3C27ROARPRBCUPEJVV4KQNSO5AEMVJF66Q9ASUAAJG",
"statusCode": 400,
"retryable": false,
"retryDelay": 45.853296901029964
},,
compelete: false
}
}
Path
string
required
The name of the DynamoDB you want to interact with.
Body
string
required
The partition key for this element
string
required
What the id will map to
Response
number
Based off of standard HTTP request guidelines
object
Information regarding your create request
{
"statusCode": 200,
"body" {
"msg": "Item added to table",
"complete": true
}
}
{
"statusCode": 400,
"body" {
err: "error": {
"message": "One or more parameter values were invalid: Missing the key id in the item",
"code": "ValidationException",
"time": "2023-08-18T19:37:15.678Z",
"requestId": "PM8CAFJ8DP3C27ROARPRBCUPEJVV4KQNSO5AEMVJF66Q9ASUAAJG",
"statusCode": 400,
"retryable": false,
"retryDelay": 45.853296901029964
},,
compelete: false
}
}
⌘I

