HTTPApi: How to return PDF file

Hi

Using Delphi (Alexandria) and RemObjects latest version.

I am converting some old datasnap with RemObjects and are following the article:

[HttpAPI in details]

But it didn’t specify (and I tried to search your documentation with no avail) where TROHttpApiResult
is defined.

An other question: is there an example of how to serve a PDF from a TRoIndyHttpServer code-first server?

Hi,

it works with GET and POST methods.
check this code.

    [ROServiceMethod]
    [ROCustom('HttpApiPath', 'test_get')]
    [ROCustom('HttpApiMethod','GET')]
    function TestMethod(): Binary;
    [ROServiceMethod]
    [ROCustom('HttpApiPath', 'test_post')]
    [ROCustom('HttpApiMethod','POST')]
    function TestMethod2(): Binary;
function TNewProjectService.TestMethod: Binary;
begin
  Result := TROHttpApiResult.Create(HTTP_200_code,id_ContentType_application_json_charset_utf8,'a.json',true);
  Result.LoadFromString('{"swagger":"GET"}');
end;
function TNewProjectService.TestMethod2: Binary;
begin
  Result := TROHttpApiResult.Create(HTTP_200_code,id_ContentType_application_json_charset_utf8,'a.json',true);
  Result.LoadFromString('{"swagger":"POST"}');
end;

for passing .pdf you should specify correct content type instead of id_ContentType_application_json_charset_utf8 at least.