
If you are building a search engine data analyzer service, SerpStack API can be handy to integrate full search engine coverage functionalities.
SerpStack API – Lighting-fast JSON REST API for fetching search engine results quickly. With SerpStack API you can target web, image, video, shopping, and news results.
Moreover, SerpStack API provides a powerful proxy network for worry-free searching. You can configure location, language, and more. Another great API to pair with SerpStack is an ip by location API.
In this demonstration, I am going to show you how to create a low-code native and cross-platform application with Delphi FireMonkey, and also it integrates SerpStack API.

This is what we create in this demonstration. As you can see you can specify a search query and it fetches data from RESTful web service (SerpStack API) and shows all the data summary in specific cards.
If you would like to learn more about SerpStack API features and why you need to choose SerpStack API for your business – check out the informative article here.
Table of Contents
How to use SerpStack API?
To get started right away, you just need to get your API access key and start using the HTTP GET endpoint with different parameters. Head over and sign up with a free subscription plan on SerpStack API.
Here is a sample API request:

And its response:

How to build a cross-platform application with Delphi FireMonkey?
With RAD Studio, you can build high-performance cross-platform applications several times faster for Windows, iOS, Android, macOS, and Linux with the same codebase.
Furthermore, the FireMonkey App Low Code Wizard provides effortless low code development options to kick start your new native and cross-platform application.
FireMonkey App Low Code Wizard – is a low code development wizard that can create a highly functional Delphi FireMonkey cross-platform application with multiple screens and data layer options in seconds.
Head over to the Embarcadero website and download the latest community edition of Delphi and download the FireMonkey App Low Code Wizard from the GetIt portal using GetIt Package Manager.

How to connect to RESTful web service in Delphi?
RAD Studio comes with a set of independent tools, one of them is REST Debugger.
REST Debugger is a helpful tool to test out different API endpoints. You can configure different parameters, requests, authentication, and connection options.
Well, the best part is after connecting to any RESTful web service you can click the Copy Components button on the REST Debugger which populates needed REST client components for your Delphi FireMonkey project. Then you can place the REST client components to your project and just bind it with grid or listview to represent fetched data.

But, in our demonstration, I will show you how to do customization to our Delphi FMX application. So there will be some coding involvement.
How to start low-code cross-platform development?
Open your RAD Studio and install the FireMonkey Low Code Wizard tool from GetIt Package Manager

Then create a new project here.
In our demonstration, we do not require a database layer so we can leave it unchecked and you are good to go.

Now you can paste those REST client components that you copied from REST Debugger.
Here is our project structure. The window is already configured for us and the grid panel makes the UI consistent and responsive to different sizes.

When there is a click on the button, it starts a synchronized thread which fetches data from google.com and shows all results in the cards.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
procedure TNewFormFrame.BtnSendRequestClick(Sender: TObject); begin inherited; var aTask: ITask; RESTClient1.ResetToDefaults; RESTClient1.Accept := 'application/json'; RESTClient1.AcceptCharset := 'UTF-8, *;q=0.8'; RESTClient1.BaseURL := 'http://api.serpstack.com/search'; // pass given parameters for the URL RESTRequest1.Resource := Format('?access_key=%s&query=%s&num=5', [AccKey, Edit1.text]); RESTResponse1.ContentType := 'application/json'; aTask := TTask.Create( procedure begin Sleep(3000); TThread.Synchronize(TThread.Current, procedure begin RESTRequest1.Execute; var JSONValue: TJSONValue; var JSONArray: TJSONArray; var ArrayElement: TJSONValue; // after using object we just free them within the list RctList := TList<TRectangle>.Create; LblTitleList := TList<TLabel>.Create; LblURLList := TList<TLabel>.Create; LblDomainList := TList<TLabel>.Create; LblDisplayedURLList := TList<TLabel>.Create; try JSONValue := TJSONObject.ParseJSONValue(RESTResponse1.Content); JSONArray := JSONValue.GetValue<TJSONArray>('organic_results'); for ArrayElement in JSONArray do begin {$region 'Create news card' } RctResultsCard := TRectangle.Create(VertScrollBox1); RctResultsCard.Parent := VertScrollBox1; RctResultsCard.HitTest := False; RctResultsCard.Fill.Color := TAlphaColorRec.Azure; RctResultsCard.Fill.Kind := TBrushKind.Solid; RctResultsCard.Stroke.Thickness := 0; RctResultsCard.Align := TAlignLayout.Top; RctResultsCard.Height := 220; RctResultsCard.Width := 314; RctResultsCard.XRadius := 15; RctResultsCard.YRadius := 15; RctResultsCard.Margins.Top := 5; RctResultsCard.Margins.Bottom := 5; RctResultsCard.Margins.Left := 7; RctResultsCard.Margins.Right := 7; RctList.Add(RctResultsCard); // add to the TList instance {$endregion} {$region 'create title url ... labels in the search result card' } LblDisplayedURL := TLabel.Create(RctResultsCard); LblDisplayedURL.Parent := RctResultsCard; LblDisplayedURL.Align := TAlignLayout.Top; LblDisplayedURL.AutoSize := True; LblDisplayedURL.Height := 33; LblDisplayedURL.Width := 308; LblDisplayedURL.HitTest := False; LblDisplayedURL.AutoSize := True; LblDisplayedURL.Font.Size := 14; LblDisplayedURL.Margins.Left := 3; LblDisplayedURL.Margins.Right := 3; LblDisplayedURL.Margins.Top := 3; LblDisplayedURL.Margins.Bottom := 3; LblDisplayedURL.Text := 'Displayed URL: ' + ArrayElement.GetValue<String>('displayed_url'); LblDisplayedURL.StyledSettings := LblDisplayedURL.StyledSettings - [TStyledSetting.FontColor, TStyledSetting.Size]; LblDisplayedURLList.Add(LblDisplayedURL); LblDomain := TLabel.Create(RctResultsCard); LblDomain.Parent := RctResultsCard; LblDomain.Align := TAlignLayout.Top; LblDomain.Height := 33; LblDomain.Width := 308; LblDomain.HitTest := False; LblDomain.AutoSize := True; LblDomain.Font.Size := 14; LblDomain.Margins.Left := 3; LblDomain.Margins.Right := 3; LblDomain.Margins.Top := 3; LblDomain.Margins.Bottom := 3; LblDomain.Text := 'Domain: ' + ArrayElement.GetValue<String>('domain'); LblDomain.StyledSettings := LblDomain.StyledSettings - [TStyledSetting.FontColor, TStyledSetting.Size]; LblDomainList.Add(LblDomain); LblURL := TLabel.Create(RctResultsCard); LblURL.Parent := RctResultsCard; LblURL.Align := TAlignLayout.Top; LblURL.Height := 33; LblURL.Width := 308; LblURL.HitTest := False; LblURL.AutoSize := True; LblURL.Font.Size := 14; LblURL.Margins.Left := 3; LblURL.Margins.Right := 3; LblURL.Margins.Top := 3; LblURL.Margins.Bottom := 3; LblURL.Text := 'URL: ' + ArrayElement.GetValue<String>('url'); LblURL.StyledSettings := LblURL.StyledSettings - [TStyledSetting.FontColor, TStyledSetting.Size]; LblURLList.Add(LblURL); LblTitle := TLabel.Create(RctResultsCard); LblTitle.Parent := RctResultsCard; LblTitle.Align := TAlignLayout.Top; LblTitle.Height := 33; LblTitle.Width := 308; LblTitle.HitTest := False; LblTitle.AutoSize := True; LblTitle.Font.Size := 16; LblTitle.Margins.Left := 3; LblTitle.Margins.Right := 3; LblTitle.Margins.Top := 3; LblTitle.Margins.Bottom := 3; LblTitle.Text := 'Title: ' + ArrayElement.GetValue<String>('title'); LblTitle.StyledSettings := LblTitle.StyledSettings - [TStyledSetting.FontColor, TStyledSetting.Size]; LblTitleList.Add(LblTitle); {$endregion} end; finally FreeAndNil(RctList); FreeAndNil(LblURLList); FreeAndNil(LblDomainList); FreeAndNil(LblDisplayedURLList); end; end); end); aTask.Start; end; |
I am sure that the source code is straightforward to read. Check out the whole project over on this GitHub repository.
As you can see creating a native and cross-platform application with Delphi FireMonkey is so swift. Besides integration of APIs is in seconds because of REST client components.
Be sure to head over and get a free subscription plan on SerpStack.com right now!