title: Using HTTP Put json in Unity
body: <p>I am using <code>UnityWebRequest</code> to update (PUT) Raw JSON on the server. Unfortunately I get the error <code>HTTP/1.1 405 Method Not Allowed</code>. I am assuming that I am not Encoding it correctly. What could be the issue here?
  This is a follow up question asked by my colleague: <a href="https://stackoverflow.com/questions/64101302/http-method-not-allowed-in-rest-api-post">HTTP Method Not Allowed in REST API Post</a></p>
  <p>We have tried to encode it in different ways as given below in the script. Unfortunately it does not work.
  We have this JSON online and to enter data (PUT), it is a must to have the name and address fields as non-empty.</p>
  <pre><code>IEnumerator Post()
      {
          byte[] myData = System.Text.Encoding.UTF8.GetBytes(&quot;{'name': 'User01', 'address':{'raw':'MountFiji'}}&quot;);
          UnityWebRequest www = UnityWebRequest.Put(&quot;website_of_the_user&quot;, myData);
          www.SetRequestHeader(&quot;Content-Type&quot;, &quot;application/json&quot;);
          yield return www.SendWebRequest();
   
          if(www.isNetworkError || www.isHttpError) {
              Debug.Log(www.error);
          }
          else {
              Debug.Log(&quot;Upload complete!&quot;);
          }
      }
  </code></pre>
  <pre><code>{
      &quot;name&quot;: &quot;&quot;,
      &quot;address&quot;: {
          &quot;raw&quot;: &quot;&quot;
      }
  }
  </code></pre>
  <p>The webpage where we have our API has following properties:</p>
  <pre><code>HTTP 200 OK
  Allow: GET, HEAD, PUT, OPTIONS, DELETE
  Content-Type: application/json
  </code></pre>