#1 2014-10-29 06:26:51

AOG
Member
Registered: 2014-02-24
Posts: 490

Rest client callback

Looking at sample 26 Restful-ORM.

The ORM server has a public method called Blob. With GET, POST, PUT and DELETE parts.

GET can be accessed by CallBackGetResult.

function TSQLNoteFile.GetBlob(aClient: TSQLRestClientURI): RawUTF8;
begin
  Result := aClient.CallBackGetResult('Blob',[],RecordClass,fID);
end;

PUT can be accessed in the same way with CallBackPut.

But how can DELETE (and POST) be accessed by the REST-client (by callback) ?

I am now accessing the DELETE part by using:

aClient.URI(aClient.Model.URI[RecordClass]+'/'+{$ifndef ENHANCEDRTL}Int32ToUtf8{$else}IntToStr{$endif}(fID)+'/Blob','DELETE');

This works, but it is not in line with the other callbacks.

Offline

#2 2014-10-29 08:07:57

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Rest client callback

Good idea.

We have added TSQLRestClientURI.CallBack() method allowing any HTTP verb for method-based services.
See http://synopse.info/fossil/info/cf04a509f6

Offline

Board footer

Powered by FluxBB