Delphi Web Service parameters

3

I have a service running in Delphi with DataSnap REST, it serves to read data and returns the query to who requested it, but now the client needs to consume this data via web passing some parameters, until then beauty, did the function it returns the data in a JSON array, my question would be how to handle the parameters it passes, such as

  

/? reference = BUTTON & type = raw_material & uid = BTN-1234

passing a reference = parameter in the REST DataSnap would be like this

/ datasnap / rest / TServerMethods1 / function / parameter

You do not have to specify what you're going to search for, with an equal sign just passing the parameters, does anyone have any ideas?

    
asked by anonymous 04.10.2016 / 16:33

1 answer

2

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

declare non 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;
    
05.10.2016 / 03:44