#1 mORMot 1 » I need to use the type of HTTP method POST in method of REST service » 2013-09-12 16:54:16

johni
Replies: 1

Hi,

I'm studying mORMot to use REST in a project that will be consumed by an application APS NET.

Well, I have the method FindProduto and want to spend as a JSON POST parameter eg http://localhost:777/Produtos/FindProduto/{"codigo": 123456}

Is possible capture the JSON in method FindProduto with parameter aParam?

My code

function TServiceProdutos.FindProduto(
  var aParams: TSQLRestServerCallBackParams): Integer;
begin
  // I need cature JSON informed in parameter URI

  Result:= HTML_SUCCESS;
end;

Inicialization of my service

constructor TJSONServer.Create;
begin
  ModelProdutos:= TSQLModel.Create([], 'Produtos');
  ServiceProdutos:= TServiceProdutos.Create(ModelProdutos);
  ServiceProdutos.ServicesRouting:= rmJSON_RPC;

  Server := TSQLite3HttpServer.Create('9000', [ ServiceProdutos ] );
end;

How is it possible to define the type of mORMot the HTTP method (POST, GET, DELETE, PUT) that will run on a service method?

I need to use POST in the function FindProduto but I works only with GET (http://localhost:777/Produtos/FindProduto?codigo=123456)

Thanks

Board footer

Powered by FluxBB