my code:

var
  ht: THttpSend;
  lPostData : TStringList;
begin

  ht := THttpSend.Create;
  ht.UserAgent := 'Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101
Firefox/5.0';
  ht.Headers.Add('Accept: text/html');
  ht.Headers.Add('content-type: application/json');
  ht.MimeType := 'application/x-www-form-urlencoded';
  ht.KeepAlive := True;
  ht.Protocol := '1.1';

  lPostData :=TStringList.Create;
  lPostData.Add(EncodeURL('grant_type=client_credentials'));
  lPostData.Add(EncodeURL('scope=product:show stock:save stock:update
warehouse:list warehouse:save warehouse:show warehouse:update'));
  lPostData.Add(EncodeURL('client_id='+clientid));
  lPostData.Add(EncodeURL('client_secret='+clientsecret));
  WriteStrToStream(ht.Document, EncodeURL(lPostData.Text));

  try

    if ht.HTTPMethod('POST', 'http://ws.hml.autorei.net/oauth/token') then
    begin
      if (ht.Document.Size > 0) then
      begin
        ht.Document.Position := 0;
        memo1.Lines.LoadFromStream(ht.Document);
      end
      else
        memo1.Lines.Text := 'Error';
    end;

    memo2.Lines.Add(IntToStr(ht.ResultCode) + '  ' + ht.ResultString);

  finally
    memo3.Lines.Text := ht.Headers.Text;
    ht.Free;
  end;

end;


this returns:
500  Internal Server Error

I finally got it, using a "internet tool" (
http://wiki.lazarus.freepascal.org/Internet_Tools)

  response := process(httpRequest('http://ws.hml.autorei.net/oauth/token',
                           'grant_type=' +
urlHexEncode('client_credentials') +
                           '&scope=' + urlHexEncode('product:show
stock:save stock:update warehouse:list warehouse:save warehouse:show
warehouse:update') +
                           '&client_id=' + urlHexEncode(clientid) +
                           '&client_secret=' + urlHexEncode(clientsecret)),
'$json');

 but I wonder how to make using the synapse without using another library


how i can do that?

since now, thank you
- and sorry my bad english
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to