REST.SurfSpotFinder Sample (C++)
This sample shows how to integrate and use REST services in your application by using the Spitcast API in a C++ application.
You can find the SurfSpotFinderApp sample project at:
- Start | Programs | Embarcadero RAD Studio Sydney | Samples and then navigate to:
CPP\Multi-Device Samples\Cloud\SurfSpot Finder
- Subversion Repository:
- You can find C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.
The application connects to the REST service from Spitcast to retrieve the list of Surf spots (sea locations for surfing). The application creates a main form that has a TMultiView component. The TMultiView component contains a list of Surf spots. Select a Surf spot from the SurfSpot finder list in order to display its location info: Location, Longitude and County. Each location info is displayed on an item of a TListBox. The sample also uses a TPanel with a TWebBrowser component for displaying the location on google maps.
- Note: Public distribution of Spitcast API content must acknowledge Spitcast as the content source, and provide a link to spitcast.com. The Spitcast API is available for non-commercial use. Commercial use is possible by prior arrangement.
How to Use the Sample
- Navigate to the location given above and open
- Select the target platform.
- Press F9 or choose Run > Run.
The project itself.
The main form.
TForm4, the form class, implements the main visual component of the application. It contains a TMultiView component and a TPanel with a TWebBrowser component for displaying the location on a map. It also contains the following components: TRESTClient, TRESTResponse, TRESTRequest, and TRESTResponseDataSetAdapter.
- For the TMultiView1 component, in the Object Inspector, set the TargetControl property to Panel1 and the MasterButton property to backbtn.
- For the RESTClient1 component, in the Object Inspector set the BaseURL property to http://api.spitcast.com.
- For the RESTRequest1 component, in the Object Inspector set the following properties:
- For the RESTResponseDataSetAdapter component, in the Object Inspector set the following properties:
- Right-click the FDMemTable and select Fields Editor.
- Right-click the Fields Editor, select Add Fields and the fields county_name, latitude, longitude, spot_id, and spot_name.
- For the TMultiView1 component, visually bind the Surf Spots list from the Spitcats API call.
- Mobile Tutorial: Using a MultiView Component to Display Alternate Views of Information (iOS and Android)
- DataSnap REST