title: Android send POST parameters
body: <p>I have a Django endpoint:</p>
  
  <pre><code>urlpatterns = [
      path('store', views.store, name='store'),
  ]
  </code></pre>
  
  <p>And this view:</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>I need to make an http request to that endpoint from an android phone.</p>
  
  <p>I have this code right now, how I can add POST parameters?</p>
  
  <pre><code>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&lt;URL, Integer, String&gt; {
  
          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);
              }
          }
      }
  </code></pre>
  
  <p>How I can add x,y,z and timestamp as a POST parameters?</p>