Jump to content

B4Him

Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. B4Him

    TNetHttpClient

    Accessing APIs is new territory for me. I am trying to access an API using TNetHttpClient component. The curl example provided is: curl --request GET 'https://api.samsara.com/fleet/vehicles/stats' \ -d types='engineStates' \ -d decorations='gps' \ --header 'Authorization: Bearer TOKEN' \ -G I have been unsuccessful at using various settings of TNetHttpClient to get the authorization. I have the proper token but everything I try, I get the results "message":"invalid token" followed by the request id. My latest attempt is below but same results. Can anyone advice and perhaps provide sample code of how to accomplish this? Thank you in advance. var Params: TStringList; begin Params :=TStringList.Create; Params.Add('types = engineStates'); Params.Add('decorations=gps'); http1.CustHeaders.Add('Authorization', '<My Token>'); //<My Token replaced with actual token memo2.Lines.Text :=http1.Post('https://api.samsara.com/fleet/vehicles/stats', Params).ContentAsString; end;
  2. B4Him

    Could this be an Indy Error?

    I am having the exact error trying to use Here API in Delphi 12. In Delphi 11 the http get url works fine. When I use the exact same url with coordinates and code in Delph 12 I get the exact error you describe. It happens with indy http and TNetHttpClient components. Just as you describe, the url works from Chrome and Edge but returns the error from the Delphi 12 app. I have been fighting with this for days. Have you found a solution?
×