Pass JSON as parameter - httpAPI

Hi,

Using Delphi 10.3.3 - RODA 10.0.0.1559

  [ROService('ContactService', '{2C856295-CCC2-4351-92A6-E18EC0E829A9}')]
  TContactService = class(TRORemoteDataModule)
  public
    [ROServiceMethod]
    [ROServiceMethodResultName('Result')]
    [ROStreamAs(emUTF8)]
    [ROCustom('HttpApiPath','hello')]
    [ROCustom('HttpApiMethod','POST')]
    function Hello(const JSON: TROJSONObject): ROUTF8String;
  end;
function TContactService.Hello(const JSON: TROJSONObject): ROUTF8String;
begin
  Result := JSON.AsJSON;
end;

When passing a TROJSONObject as parameter, an exception is thrown “Type tkClass not supported” when serializing.

Is there a way to pass JSON as parameter?

(screenshot of Postman)

Grtz,

Filip Lagrou

Hi,

You can pass only known Data Types.
TROJSONObject is a just Delphi object so RO SDK doesn’t know how to deserialize it.

try to pass your JSON as UTF8String or as a binary with base64 encoding.