Page updated Nov 9, 2023

Update data

Amplify iOS v1 is now in Maintenance Mode until May 31st, 2024. This means that we will continue to include updates to ensure compatibility with backend services and security. No new features will be introduced in v1.

Please use the latest version (v2) of Amplify Library for Swift to get started.

If you are currently using v1, follow these instructions to upgrade to v2.

Update data

Put data to the API endpoint:

func putTodo() { let updatedMessage = #"{"message": "my updated Todo"}"# let request = RESTRequest(path: "/todo", body: .utf8)) Amplify.API.put(request: request) { result in switch result { case .success(let data): let str = String(decoding: data, as: UTF8.self) print("Success \(str)") case .failure(let apiError): print("Failed", apiError) } } }
1func putTodo() {
2 let updatedMessage = #"{"message": "my updated Todo"}"#
3 let request = RESTRequest(path: "/todo", body: .utf8))
4 Amplify.API.put(request: request) { result in
5 switch result {
6 case .success(let data):
7 let str = String(decoding: data, as: UTF8.self)
8 print("Success \(str)")
9 case .failure(let apiError):
10 print("Failed", apiError)
11 }
12 }