Lazarus

Programming => General => Topic started by: alaa123456789 on July 02, 2022, 06:04:17 pm

Title: Rapidapi (https://rapidapi.com/)
Post by: alaa123456789 on July 02, 2022, 06:04:17 pm
Hi ,
i was searching all the day to find a way how to use https://rapidapi.com/ (https://rapidapi.com/) in lazarus
this website has many useful free API's , for example https://rapidapi.com/dmisdm/api/youtube-dl4 (https://rapidapi.com/dmisdm/api/youtube-dl4)
it has implantation in many different programming languages but not in pascal , anyone could help with this?

thanks
Title: Re: Rapidapi (https://rapidapi.com/)
Post by: MarkMLl on July 02, 2022, 07:32:02 pm
What does it do? I think an introduction is in order rather than expecting people to invest time in looking at an unknown website.

What language is the standard API in? If it's C (as distinct from C++ with object oriented stuff) FPC has a conversion tool which gets .h files mostly right.

MarkMLl
Title: Re: Rapidapi (https://rapidapi.com/)
Post by: paweld on July 02, 2022, 08:01:31 pm
Code: Pascal  [Select][+][-]
  1. uses
  2.   fphttpclient, fpopenssl, opensslsockets, httpprotocol;
  3.  
  4. procedure TForm1.Button1Click(Sender: TObject);
  5. var
  6.   hc: TFPHttpClient;
  7.   api: String = 'https://youtube-dl4.p.rapidapi.com/';     //rapidapi youtube-dl
  8.   key: String = '***********************';                 //your rapidapi key
  9.   host: String = 'youtube-dl4.p.rapidapi.com';             //rapidapi youtube host
  10.   outjson: String = '';
  11. begin
  12.   hc := TFPHttpClient.Create(nil);
  13.   hc.AllowRedirect := True;
  14.   hc.AddHeader('X-RapidAPI-Key', key);
  15.   hc.AddHeader('X-RapidAPI-Host', host);
  16.   try
  17.     outjson := hc.Get(api + '?url=' + HTTPEncode('https://www.youtube.com/watch?v=lNK8EIoNJS8'));
  18.   finally
  19.     hc.Free;
  20.   end;
  21. end;
Title: Re: Rapidapi (https://rapidapi.com/)
Post by: marcov on July 02, 2022, 09:00:27 pm
Seems that RapidAPI is simply a rental marketplace for web apis. The marketplace aspect seems to be way larger than the coding side of things.

But they have a simple generator for the simplest of APIs in multiple languages, so the simplest would be to ask them to add Delphi and/or lazarus to the languages.
Title: Re: Rapidapi (https://rapidapi.com/)
Post by: alaa123456789 on July 04, 2022, 07:26:55 pm
What does it do? I think an introduction is in order rather than expecting people to invest time in looking at an unknown website.

What language is the standard API in? If it's C (as distinct from C++ with object oriented stuff) FPC has a conversion tool which gets .h files mostly right.

MarkMLl

it is providing useful api's you could use it in the applications for example covid19 api
anyway thanks for the guys who has replied already with example so everybody in this forum could get benefit from it

regards
Title: Re: Rapidapi (https://rapidapi.com/)
Post by: alaa123456789 on July 04, 2022, 07:27:31 pm
Code: Pascal  [Select][+][-]
  1. uses
  2.   fphttpclient, fpopenssl, opensslsockets, httpprotocol;
  3.  
  4. procedure TForm1.Button1Click(Sender: TObject);
  5. var
  6.   hc: TFPHttpClient;
  7.   api: String = 'https://youtube-dl4.p.rapidapi.com/';     //rapidapi youtube-dl
  8.   key: String = '***********************';                 //your rapidapi key
  9.   host: String = 'youtube-dl4.p.rapidapi.com';             //rapidapi youtube host
  10.   outjson: String = '';
  11. begin
  12.   hc := TFPHttpClient.Create(nil);
  13.   hc.AllowRedirect := True;
  14.   hc.AddHeader('X-RapidAPI-Key', key);
  15.   hc.AddHeader('X-RapidAPI-Host', host);
  16.   try
  17.     outjson := hc.Get(api + '?url=' + HTTPEncode('https://www.youtube.com/watch?v=lNK8EIoNJS8'));
  18.   finally
  19.     hc.Free;
  20.   end;
  21. end;

thanks paweld , will give it  a try
TinyPortal © 2005-2018