How to update objects in my database via put json? This is my post code as an example, but I do not know how to do the put that is to update, I need it a lot
public class onbuttonclickHttpPost extends AsyncTask<String, Void, String> {
protected void onPreExecute() {
}
public String doInBackground(String... arg0) {
try {
URL url = new URL("http://uri.com/api/v2/bookdemo/_table/cad_users");
JSONObject postDataParams = new JSONObject();
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("Content-type", "application/json");
conn.setRequestProperty("Accept", "application/json");
conn.setRequestProperty("X-DreamFactory-Api-Key", "36fda24fe5588fa4285ac6c6c2fdfbdb6b6bc9834699774c9bf777f706d05a88");
conn.setRequestProperty("X-DreamFactory-Session-Token", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.XXXXXXXXXXXX.jfGbU3yjIPPfAQWTyYVQJCfEapYFnHPCYkL4T-arD4M");
conn.setRequestProperty("Authorization", "Basic XXXXXXXXXXXXXXX");
conn.setRequestMethod("post");
conn.setReadTimeout(15000 /* milliseconds */);
conn.setConnectTimeout(15000 /* milliseconds */);
conn.setDoInput(true);
conn.setDoOutput(true);
postDataParams.put("tx_name", nome);
postDataParams.put("tx_nickname", nickname );
postDataParams.put("nu_cellphone", numcel );
postDataParams.put("password", password );
postDataParams.put("tx_email", email );
Log.e("resource", postDataParams.toString());
JSONObject resource = new JSONObject();
JSONArray array = new JSONArray();
array.put(postDataParams);
resource.put("resource", array);
System.out.println(resource.toString());
conn.connect();
OutputStream os = conn.getOutputStream();
BufferedWriter writer = new BufferedWriter(
new OutputStreamWriter(os, "UTF-8"));
// writer.write(getPostDataString(postDataParams));
writer.write(resource.toString());
writer.flush();
writer.close();
os.close();
int responseCode = conn.getResponseCode();
Making it clear that this is my post code used just for example, I'd like an example of a put code to update in my database.