Page updated Jan 16, 2024

Update data

PUT requests

To update an item via the API endpoint:

1Future<void> updateTodo() async {
2 try {
3 final restOperation = Amplify.API.put(
4 'todo/1',
5 body: HttpPayload.json({'name': 'Mow the lawn'}),
6 );
7 final response = await restOperation.response;
8 print('PUT call succeeded');
9 print(response.decodeBody());
10 } on ApiException catch (e) {
11 print('PUT call failed: $e');
12 }
13}