Jump to content
Sign in to follow this  
misc_bb

RESTRequest Timeout

Recommended Posts

We are currently working on migrating our project with a new authentication for the xero api. This code works find when we are using a Datasnap stand-alone application, but when we apply it in ISAPI DLL the RESTRequest.Execute line, it will just stop. I'm running out of options. I don't know if this is a bug or something but it works just find with the Stand-Alone application and localhost setup. But if we apply the DLL and using our web URL it just stop and doesn't continue at all. Any ideas would be greatly appreciated. Many thanks!


function TXero2.GetAccessToken(Authorization, sAuthCode, ReDirectURI: AnsiString): AnsiString;
begin
 TRY

  ResetRESTComponentsToDefaults;
  RESTClient.UserAgent := XeroUserAgent;
  RESTRequest.Client := RESTClient;

  RESTClient.BaseURL := XeroAPIIdentityURL;
  RESTClient.ContentType := 'application/x-www-form-urlencoded';
  RESTClient.Params.AddItem('Authorization', Authorization, TRESTRequestParameterkind.pkHTTPHEADER, [TRESTRequestParameterOption.poDoNotEncode]);
  RESTRequest.Resource := 'connect/token';

  RESTRequest.Params.AddItem('grant_type', 'authorization_code', TRESTRequestParameterKind.pkREQUESTBODY);
  RESTRequest.Params.AddItem('code', sAuthCode, TRESTRequestParameterKind.pkREQUESTBODY);
  RESTRequest.Params.AddItem('redirect_uri', ReDirectURI, TRESTRequestParameterKind.pkREQUESTBODY);

  RESTRequest.Method := TRESTRequestMethod.rmPOST;
  RESTRequest.Execute;

   result := Restresponse.Content;

 EXCEPT
      on e: Exception do
         Codesite.Send(ClassName + '.GetAccessToken: ' + e.Message);
   END;
end;

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×