I love the new TRESTClient components in XE5. Especially the ability to visual bind a REST datasource with the use of the TRESTResponseDataSetAdapter. Now I find I’m always on the look out for new REST datasources. The REST Debugger makes the whole process really easy too.
The other day I hit the mother-load of REST datasources with Kimono Labs. It is a creative web service that makes it easy to scrape a web site and turn it into a REST data source. It looks for repeating data on the page. Their free service is enough to get you started. I created a simple REST datasource of San Francisco 49ers games from their schedule on their web site.
A few tips for working with the Kimonolabs REST API.
- Make sure the web data doesn’t include hyperlinks – if it does, then the REST data will include objects containing the href and the text, which doesn’t map to a grid well.
- Use results.collection1 as your root element in the TRESTResponseDataSetAdapter and you are off to the races.
- It doesn’t work with every web page because of malformed pages, but it works with a lot of them.
- There is no way to edit your API once you’ve finished it (yet), so you end up deleting and recreating it a few times.
They have a lot of videos and tutorials on their site walking you through how to use their service. Take a look and I’m looking forward to your REST enabled apps!
With the release of Delphi XE5 I’ve made the source of the Mobile REST Client Demo available. This is a really super simple demo of the Mobile REST Client in XE5. It is designed to show up how you can consume a JSON REST Service and adapt it into a DataSet and then bind that to the UI. If you change the data source you will probably need to change the live binding.
I’ve changed the demo from the one I used in the video to consume an OData data source. OData is a new standard backed by Microsoft for sharing data over the web. You can think of it as SQL for the web. It is a combination of other technologies, including REST, AtomPub, and JSON. Sybase supports OData on all of their databases now, as does Microsoft and others.
The change was simply a matter of pointing it to the Northwind OData endpoint provided on Odata.org. The binding is setup to show the company name in the listview. I added the ability to specify a Root Element, but that isn’t necessary for the demo.
This new technology works in both desktop and mobile, FireMonkey and VCL. It should also work in C++ Builder.
[Download the demo] (MobileRestXE5.7z 8 KB – Requires Delphi XE5 – Builds for iOS, Android or Win32)
Visiting with Marco Cantu and Cary Jensen.
If you have any other questions or comments for Marco or Cary you can leave them here, or catch them online:
I didn’t get the episode with Marco and Cary edited and posted yet (came close – might still get it posted tonight when I get home). In that episode Marco mentioned his free REST webinar which occurs at three different times tomorrow (March 3rd). So sign-up to attend one of those sessions and download the white paper, it will be really good.
Marco Cantù presents REST in Delphi and RAD Studio 2010
Let Marco Cantù show you how to get the most from RAD Studio 2010 with Representational State Transfer (REST) – a new architecture for Web services that is having a significant impact on the industry. Join Marco as he delves into the technologies involved in REST from the Delphi perspective.
Topics covered in this webinar will include:
- The Concepts Behind Representational State Transfer
- REST technologies and Delphi
- Creating Delphi REST clients that interface with RSS feeds, maps, and Twitter
- Data-Oriented REST Servers