Code example for StringEntity

Methods: setContentType

0
 
		jsonArray = (JSONArray) json.get("results");
		rec = (JSONObject) jsonArray.get(0);
		String uuidLocationUnknow = (String) rec.get("uuid");
 
		StringEntity input = new StringEntity("{\"person\": \"" + personaUudi
				+ "\", \"identifiers\": [{\"identifier\":\"" + identificador
				+ "\", \"identifierType\":\"" + uuidPatientidentifiertype
				+ "\", \"location\":\"" + uuidLocationUnknow
				+ "\", \"preferred\":true}]}"); 
 
		input.setContentType("application/json");
 
		if (ApiAuthRest.getRequestPost("patient", input) == true) {
			Toast.makeText(getApplicationContext(),
					"Paciente: " + persona + " creada correctamente",
					Toast.LENGTH_LONG).show();
		} 
 
	}