Delphi Web Service parameters

Asked

Viewed 776 times

3

I have a service running in Delphi with Datasnap REST, it serves to read data and returns the query to those who requested, but now the client needs to consume this data via web passing some parameters, until then beauty, I made the function it returns the data in an array of JSON, my doubt would be how to treat the parameters he passes, as for example

/?Reference=Button&type=raw_material&uid=BTN-1234

passing a Reference= parameter in the Datasnap REST would look like this

/datasnap/Rest/Tservermethods1/function/parameter

no need to specify what you are going to search, with an equal sign just pass the parameters, someone has some idea?

1 answer

2


I was able to solve the problem using the function GetInvocationMetaData, where it returns me the parameters used in the link to WebService. I’ll put an example of how to use this function:

declare in usues Data.DBXPlatform

var  
  oMetaData: TDSInvocationMetadata  
  i: Integer;  
  s: String;  
begin  
  oMetaData: GetInvocationMetadata;

  for i := 0 to oMetaData.QueryParams.Count-1 do
  begin
    s := oMetaData.QueryParams[i];
  end;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.