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.

Regards,

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);
begin
  // your implementation reading Json
end;
1 Like

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