title: Post JSON data to RESTful datasnap server from delphi client
body: <p>I need to send a simple JSON object to a Restful datasnap server (Delphi) from a Delphi client. I am using Delphi XE. Can anybody help me out with the code? I am trying for hours but not getting it.. Please ask if details are not sufficient</p>
  
  <p>Edit:
  Here is server side method declaration:</p>
  
  <pre><code>procedure updatemethodnme(str:string):string;
  </code></pre>
  
  <p>and here is client side code:</p>
  
  <pre><code>function PostData(request: string): boolean;
  var
  param: TStringList;
  url, Text,str: string;
  code: Integer;
  http: TIDHttp;
  begin
  Result:= false;
  http:= TIDHttp.Create(nil);
  http.HandleRedirects:= true;
  http.ReadTimeout:= 50000;
  http.request.Connection:= 'keep-alive';
  str:= '{"lamp":"'+lamp+'","floor":"'+floor+'","op":"'+request+'"}';
  param:= TStringList.Create;
  param.Clear;
  param.Add(str);
  url:= 'h***p://xx2.168.xx.xx:xxxx/Datasnap/rest/TserverMethods1/methdname/';
  try
  Text:= http.Post(url, param);
  Result:= true;
  except on E: Exception do
  begin
  Result := false;
  end;
  end;
  end;
  </code></pre>