using System;
using System.Net;
public class WebRequestExample {
public static void Main() {
// Initialize the WebRequest.
WebRequest myRequest =
WebRequest.Create("http://example.com");
myRequest.Method = "DELETE";
WebResponse myResponse = myRequest.GetResponse();
}
}
I know this is an old thread, but I searched elsewhere and did not see many good answers. My answer may not be great, but it is easy and it works. UnityWebRequest have a default PATCH method but it does have one for PUT, which is a similar request. You can simply initiate a UnityWebRequest.Put and then change the method to PATCH, like so:
byte[] formData;
/*
build form data here and then encode as byte[]
formData = System.Text.Encoding.UTF8.GetBytes(someStringHere);
*/
UnityWebRequest request = UnityWebRequest.Put(URL, formData);
request.method = "PATCH";
/* You may need to add header(s) */
request.SetRequestHeader("Content-Type","application/json");