Httpapi Session and Declaration

Hi,

  1. Can the server return TJSonObject/TJSONArray directly?
    As I need create each time on the TROtype in order to pass the data for the restclient , it will be convenient .

  2. How to defined the parameters of httpapi function if the parameter’ name contain the special character ? For example , the income json would be: {“context-msg-id”:”value”}.

As we need provide some call back for other platform integration and the variable name not is not allowed in delphi, any advise to achieve this?

Hi,

No, it can’t. server may return only RODL-compatible types. CodeFirst server also requires RODL-compatible types. You may launch ServiceBuilder and “design” your service.

we support dashes in header parameters.
for example, context-msg-id headers parameter can be read if method parameter has ContextMsgId name in Delphi.


in general, you can review Using OnCustomResponseEvent in a ROSDK Server snippet.
in this event you can do almost everything - change incoming request/response and their content (body, parameters, headers, etc).
for example:

  • you can receive POST request, convert it to HTTPAPI, process as HTTPAPI request, convert response back to POST.
  • receive HTTPAPI request, convert it to BIN, process it as usual request and answer with HTTPAPI response …