title: Android - How to use Volley HTTP Post with element tags in body
body: <p>I have been trying to figure out how to use Volley with HTML element tags in the body, but could use some help.</p>
  <p>As an example, for the API that I am using, the required format to create a user with a POST is like the below:</p>
  <pre><code>{
      &quot;username&quot;:&quot;&quot;,
      &quot;password&quot;:&quot;&quot;,
      &quot;email&quot;:&quot;someone@example.invalid&quot;,
      &quot;first_name&quot;:&quot;John&quot;,
      &quot;last_name&quot;:&quot;Doe&quot;,
      &quot;phone_number&quot;:&quot;202-555-0113&quot;,
      &quot;address&quot;:&quot;123 Road Name&quot;,
      &quot;city&quot;:&quot;Jamesetown&quot;,
      &quot;state&quot;:&quot;AZ&quot;,
      &quot;postal_code&quot;:&quot;12345&quot;,
      &quot;country&quot;:&quot;United States&quot;,
  }
  </code></pre>
  <p>...which I was able to format on the Android side and successfully handle the POST like the below:</p>
  <pre><code>@Override
  public byte[] getBody() throws AuthFailureError {
  
      Map&lt;String, String&gt; bodyKeyValue = new HashMap&lt;&gt;();
  
      bodyKeyValue.put(&quot;username&quot;, accountName);               
      bodyKeyValue.put(&quot;password&quot;, accountPassword);           
      bodyKeyValue.put(&quot;email&quot;, email);                        
      bodyKeyValue.put(&quot;first_name&quot;, first);                   
      bodyKeyValue.put(&quot;last_name&quot;, last);   
      // etc.                  
  
      return new JSONObject(bodyKeyValue).toString().getBytes();
  }
  </code></pre>
  <p>However, when it comes to the POST needing to be formatted with element tags, I can't seem to figure out how that would be formatted in my Volley body. How can I fit this into a MAP object? In any response, could you please also inform me if the getBodyContentType needs to be changed as well? The header content-type should remain the same. Thank you!</p>
  <pre><code>&lt;sci_request version=&quot;1.2&quot;&gt;
    &lt;data_service&gt;
      &lt;targets&gt;
        &lt;device id=&quot;1234-5678&quot; /&gt;
      &lt;/targets&gt;
     &lt;requests&gt;
       &lt;device_request target_name=&quot;myTarget&quot;&gt; 
         some request string value
       &lt;/device_request&gt;
     &lt;/requests&gt;
    &lt;/data_service&gt;
  &lt;/sci_request&gt;
  </code></pre>