Categories
REST webinar

Integrate Cloud Services with the REST/JSON Client

As part of the free Developer Skill Sprint on REST & JSON here are my slides and sample source code. Appmethod, RAD Studio, Delphi & C++Builder XE6 ship with the Desktop sample RESTDemos sample which includes examples for:

  • Twitter
  • Facebook
  • Google Tasks
  • Foursquare
  • Dropbox
  • Plus Some others

That includes both OAuth1 and OAuth2 usage. My Dropbox demo is a mobile app written in both C++ and Object Pascal. It uses OAuth2 and the mobile TWebBrowser to perform the authentication. You can view and download the slides as well. Useful links:

So upgrade to XE6 or download the trial today.

Here is the video for the Skill Sprint:

Categories
REST Source Code Tools

XE5 REST Debugger Supercharged

Some people asked for the source code to using the new XE5 REST Client Library to consume the Kimono web service. The crazy thing is there isn’t any. I decided to make a video about how easy it is to consume REST web services the the new REST Client Library and the REST Debugger. In the process I thought of a way to make it even easier by supercharging the Rest Debugger (source code below).

In this video I show you how to create a REST Web service with Kimono Labs (in beta, so it will change) and then bind that data to your XE5 app using the REST Debugger.

You can supercharge your REST Debugger too. The source code is installed with XE5

C:\Program Files (x86)\Embarcadero\RAD Studio\12.0\source\data\rest\restdebugger

You will want to copy it somewhere else before modifying it. Then add a button where ever you want, and on the click event for the button add the following code:

StreamToClipboard([RESTClient, RESTRequest, RESTResponse, RESTResponseDataSetAdapter, RESTClient.Authenticator]);

And then download uCopyComponents.pas and add it to your project and uses clause. It is pretty simple, but is designed specifically to work with non-visual components, although could be modified to work with visual components too.

If you want to include the TClientDataSet in the copy, then add it to the array (although make sure it is not active). Or you could modify it to add a TFDMemTable. Use it how you wish, I hope it works for you. If you discover any bugs make any changes let me know. If anyone is interested in contributing to it, let me know.

Categories
REST Tools

REST and the Kimono

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.

kimonolabs.comA 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!

 

 

Categories
Android Delphi Projects Mobile News REST

Hello Google Glass from Delphi XE5

Google’s new Glass platform is a very revolutionary Android device, but the question I really wanted to know is if I could develop for it with Delphi XE5. Turns out the answer is Yes.

There are actually two different options for developing Glassware: Mirror API and GDK.

The first is the Google Mirror API, which allows you to build services, called Glassware, that interact with Google Glass. It provides this functionality over a cloud-based API and does not require running code on Glass. This is accomplished through a REST and JSON based API. Thanks to the new TRESTClient components in Delphi XE5 this should be easy enough to do.

The GDK on the other hand is the avenue where you build an actual APK that runs on the Google Glass device itself. This gives you the most access to the device, its sensors and features. Turns out this is also easy enough to do with Delphi XE5.

The actual GDK builds on top of the Android SDK. You can develop apps to run on Glass with either the Android SDK or GDK, but the GDK is necessary to take advantage of some of the Glass specific features.

If you run SysCheck on Glass (which takes some effort) you discover it has an ARMv7 PRocessor rev 3 (v71) with Android OS Version 4.0.4 and NEON support. Those meet the main requirements for Delphi XE5 development. So I created a simple Hello World app and ran it.

This first screenshot shows Glass appearing in the Project Manager as a valid target (once the required USB drivers were installed, which was tricky for glass).

HelloGlassProjectManager

Here is a screenshot of the app running on Glass

Delphi XE5 App running on Google Glass

I didn’t hide the status bar, which most Glassware does, and it does nothing other than serve the purpose of showing a Delphi XE5 app running on Google Glass. There were no special settings (other than the dark theme, which is a matter of taste) to make the app run on Glass. It just works.

And lastly a quick selfie of me and Glass, taken through glass.

JimWithGlass

I was hoping it would look more red than orange, but should have known Tangerine would be orange.

Rest assured, there will be more coverage of Delphi and Glass. We are just getting warmed up. This app was not using the GDK (which is still in Beta) but it is an actual Delphi app running on Glass. What an exciting day!

Categories
Delphi Projects REST Source Code

Delphi XE5 Mobile REST Client Demo Source

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)

Categories
News REST

Delphi XE5 Mobile REST Client Demo

Short demo of the new TRESTClient on a mobile Android application with Delphi XE5. It consumes a JSON REST service and uses the TRESTResponseDataSetAdapter to adapt it into a TClientDataSet. The TRESTClient components are new in Delphi XE5 and work everywhere Delphi does: Windows, Mac OS X, iOS and Android.

Learn more about multi-device, true-native app development with Delphi XE5.

Get the source code.