Create, update, and delete application data
Now that the client is set up, you can run a GraphQL mutation with
Amplify.API.mutate to create, update, and delete your data.
1Todo todo = Todo.builder()2 .name("My todo")3 .build();45Amplify.API.mutate(ModelMutation.create(todo),6 response -> Log.i("MyAmplifyApp", "Todo with id: " + response.getData().getId()),7 error -> Log.e("MyAmplifyApp", "Create failed", error)8);
To update data, use
ModelMutation.update(todo) instead. To delete data, use