I have a Django endpoint:
urlpatterns = [
    path('store', views.store, name='store'),
]
And this view:
def store(request):
    x = request.POST['x']
    y = request.POST['y']
    z = request.POST['z']
    timestamp = request.POST['timestamp']
    Data(x=x, y=y, z=z, timestamp=timestamp).store()
    return HttpResponse(status=200)
I need to make an http request to that endpoint from an android phone.
I have this code right now, how I can add POST parameters?
String endpoint = "http://192.168.1.33:8000/rest/store";
try { new uploadData().execute(new URL(endpoint)); }
catch (MalformedURLException e) { e.printStackTrace(); }
private class uploadData extends AsyncTask<URL, Integer, String> {
        String result;
        protected String doInBackground(URL... urls) {
            try {
                HttpURLConnection urlConnection = (HttpURLConnection) urls[0].openConnection();
                result = urlConnection.getResponseMessage();
                urlConnection.disconnect();
            }
            catch (IOException e) { result = "404"; }
            return result;
        }
        protected void onPostExecute(String result) {
            if (result.equalsIgnoreCase("OK")) {
                ((TextView) findViewById(R.id.http)).setText("Database Online");
                ((TextView) findViewById(R.id.http)).setTextColor(Color.GREEN);
            }
            else if (result.equalsIgnoreCase("FORBIDDEN")) {
                ((TextView) findViewById(R.id.http)).setText("No user for device");
                ((TextView) findViewById(R.id.http)).setTextColor(Color.RED);
            }
            else{
                ((TextView) findViewById(R.id.http)).setText("Can't reach server");
                ((TextView) findViewById(R.id.http)).setTextColor(Color.RED);
            }
        }
    }
How I can add x,y,z and timestamp as a POST parameters?
 
     
     
    