REST UD02 Patch method is not working

Hello, I’m trying to update an existing record in UD02 using PATCH. I can successfully do it in swagger, but when I attempt in VS I get the following error:

HttpStatus":400,"ReasonPhrase":"REST API Exception","ErrorMessage":"Request is not supported. Method: PATCH

Here is my code:

 JObject ud02Obj = new JObject(
                new JProperty("Company", company),
                new JProperty("Key1", key1),
                new JProperty("Key2", key2),
                new JProperty("Key3", key3),
                new JProperty("Key4", key4),
                new JProperty("Key5", key5),
                new JProperty("Character01", character01),
                new JProperty("RowMod", rowMod)
                );
var request = new RestRequest("Ice.BO.UD02Svc/UD02s",Method.PATCH);
          

request.AddObject(ud02Obj, "Company", "Key1" , "Key2", "Key3", "Key4", "Key5",  "Character01", "RowMod");

   var response = myRestClient.Execute(request);

Am I doing something wrong here? I can retrieve a record just fine.

You can do an object like this which is a little cleaner

var iJsonData = new {
                      Company = "EPIC06",
                      Key1 = Guid.NewGuid().ToString(),
                      RowMod="U"
                    };

Also the Patch call is only for the URL

v1/Ice.BO.UD02Svc/UD02s(Company,Key1,Key2,Key3,Key4,Key5)

Meaning that is the URL of the request, you are currently making the Path Request to the url/UD02Svc/UD02s instead.

1 Like

Thanks that worked :slight_smile: