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

Page updated Apr 29, 2024

Update data

Amplify Android v1 is deprecated as of June 1st, 2024. No new features or bug fixes will be added. Dependencies may become outdated and potentially introduce compatibility issues.

Please use the latest version (v2) of Amplify Library for Android to get started. Refer to the upgrade guide for instructions on upgrading your application to the latest version.

Amplify libraries should be used for all new cloud connected applications. If you are currently using the AWS Mobile SDK for Android, you can access the documentation here.

PUT requests

To update an item via the API endpoint:

RestOptions options = RestOptions.builder()
.addPath("/todo/1")
.addBody("{\"name\":\"Mow the lawn\"}".getBytes())
.build();
Amplify.API.put(options,
response -> Log.i("MyAmplifyApp", "PUT succeeded: " + response),
error -> Log.e("MyAmplifyApp", "PUT failed.", error)
);
val request = RestOptions.builder()
.addPath("/todo/1")
.addBody("{\"name\":\"Mow the lawn\"}".toByteArray())
.build()
Amplify.API.put(request,
{ Log.i("MyAmplifyApp", "PUT succeeded: $it") },
{ Log.e("MyAmplifyApp", "PUT failed", it) }
)
val request = RestOptions.builder()
.addPath("/todo/1")
.addBody(JSONObject()
.put("name", "Mow the lawn")
.toString()
.toByteArray())
.build()
try {
val response = Amplify.API.put(request)
Log.i("MyAmplifyApp", "PUT succeeded: $response")
} catch (error: ApiException) {
Log.e("MyAmplifyApp", "PUT failed", it)
}
RestOptions options = RestOptions.builder()
.addPath("/todo/1")
.addBody("{\"name\":\"Mow the lawn\"}".getBytes())
.build();
RxAmplify.API.put(options)
.subscribe(
response -> Log.i("MyAmplifyApp", "PUT succeeded: " + response),
error -> Log.e("MyAmplifyApp", "PUT failed.", error)
);