service with PATCH

how could the service do what crud does when using the PATCH, update only the json fields?

I guess:

  1. Load the current object state using the object ID
  2. Manualy or with RTTI update the object Fields/Properties that match the Json fields you have at hand
  3. Flush the changes

Maybe someone may came up with an RTTI code ilustrating how to 'automate' the update of the proper object Fields from JSON.


1 Like

how do i read the json that is in the body?

You can define your input parameter as TJSONObject:

procedure TMyService.DoSomething(Json: TJSONObject);
  // your implementation reading Json
1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.