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)); }}