Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Choose your framework/language

Page updated May 3, 2024

Update data

PUT requests

To create or update a item via the API endpoint:

import { put } from 'aws-amplify/api';
async function updateItems() {
try {
const Item = { name: 'My first Item', message: 'Hello world!' };
const restOperation = put({
apiName: 'myRestApi',
path: 'items/1',
options: {
body: Item
}
});
const response = await restOperation.response;
console.log('PUT call succeeded: ', response);
} catch (error) {
console.log('PUT call failed: ', JSON.parse(error.response.body));
}
}