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.
6 replies on “XE5 REST Debugger Supercharged”
[…] Jim McKeeth has a really nice video about it as well on XE5 REST Debugger Supercharged | The Podcast at Delphi.org. […]
I’m very new to the REST client and I’m trying to figure out how to consume the rest service API that AT&T has for submitting MMS messages. I cannot get past the Oauth authorization part. Is it possible to get help with that from someone at embarcadero?
Allen: There is some great documentation in the DocWiki on using the Oauth to connect to different services. http://docwiki.embarcadero.com/RADStudio/XE5/en/REST_Client_Library
Jim, can you help me with this.
I am creating a param of Content-Type: with a value of multipart/related; type”application/json”; start=”startpart”; boundary=”foo”. However, the client is creating an additional “Content-Type” param on its own which results in the server rejecting my request because of the duplication content-type headers.
How can I keep the Delphi rest client from creating a content-type if I have created it manually?
Thanks. I figured out the authentication.
Can you point me to an example of how I can send a file as part of a RestRequest?
[…] and paste the TRESTClient components out of it into your Firemonkey project. You really have to watch his video tutorial to see how awesome and easy it is to setup and consume REST APIs with Firemonkey on Android, IOS, […]