REST Debugger Tool
Go Up to REST Debugger
Tools > REST Debugger
The REST Debugger is a tool for making ad hoc requests. The TRESTDataSetAdapter and TClientDataSet components convert the JSON representation into a dataset.
With this tool, you can use different authentication methods to connect to services such as Google API or Twitter. You can send a request to the specified service and view the response.
Contents
The Request Pane
Request
Use the Request tab to specify the TRESTClient and the TRESTRequest properties.
Item | Description |
---|---|
Method |
Lists the TRESTRequest methods, as follows: |
URL |
Specifies the BaseURL property of the TRESTClient. The BaseURL property is the first half of the complete request-url.
|
Content-Type |
Specifies the ContentType property of the TRESTRequestParameterList. |
Custom body |
Specifies the CustomBody property of the TRESTRequestParameterList. |
Parameters
Use the Parameters tab to define the actual action to be executed on the service and the TRESTRequest parameters.
Item | Description |
---|---|
Resource |
Specifies the Resource property of the TRESTRequest. |
Request Parameters |
Specifies the TRESTRequest parameters. There are different parameters types: |
Add |
Adds a new parameter to the TRESTRequest Parameter List. Specify the parameter type using the Kind ComboBox, the parameter name in the Name TComboEdit, and the parameter value in the Value TEdit. |
Edit |
Edits a parameter from the TRESTRequest Parameter List. Change the type, name, or value of the parameter selected. |
Delete |
Deletes the parameter selected from the TRESTRequest Parameter List. |
Authentication
Authentication is required by most of the services. An authenticator is attached to the client and is automatically executed on each completed request.
Item | Description |
---|---|
Method |
Specifies the standard authenticators that are attached to the rest-clients. |
Username |
Represents the AuthUsername property of the TRESTRequestParameterList. The Username TEdit is enabled for the simple and basic authenticators. |
Password |
Represents the AuthPassword property of the TRESTRequestParameterList. The Password TEdit is enabled for the simple and basic authenticators. |
Username-key |
Represents the AuthUsernameKey property of the TRESTRequestParameterList. The Username-key TEdit is enabled for the simple authenticator. |
Password-key |
Represents the AuthPasswordKey property of the TRESTRequestParameterList. The Password-key TEdit is enabled for the simple authenticator. |
Client-ID |
Represents the ClientID property of the TRESTRequestParameterList. The Client-ID TEdit is enabled for the OAUTH and OAUTH2 methods. |
Client-Secret |
Represents the ClientSecret property of the TRESTRequestParameterList. The Client-Secret TEdit is enabled for the OAUTH and OAUTH2 methods. |
Access-token |
Represents the AccessToken property of the TRESTRequestParameterList. The Access-token TEdit is enabled for the OAUTH and OAUTH2 methods. |
Request-token |
Represents the AccessTokenSecret property of the TRESTRequestParameterList. The Request-token TEdit is enabled for the OAUTH and OAUTH2 methods. |
OAuth-Assistant |
Opens a new window that has all the parameter values for OAUTH or OAUTH2 methods. In this newly opened window, there are fields that are not present in the main page of Authentication, so you can use different services, as Google or Twitter. |
Connection
Use the Connection tab to specify the Proxy properties of TRESTClient.
Item | Description |
---|---|
Use Proxy Server |
Check the Use Proxy Server TCheckBox or leave the checkbox unchecked to specify if the TRESTClient handles proxy servers. |
Proxy Server |
Specifies the ProxyServer property of the TRESTClient. |
Proxy Port |
Specifies the ProxyPort property of the TRESTClient. By default, the value of ProxyPort is 0. |
Username |
Specifies the ProxyUsername property of the TRESTClient. |
Password |
Specifies the ProxyPassword property of the TRESTClient. |
Request Buttons
Item | Description |
---|---|
Send Request |
Configures the Proxy Server if needed, defines the BaseURL and the Resource properties, and the TRESTRequest method. Click the Send Request button to execute TRESTRequest and show the response. |
New Request |
Resets the Request, Parameters, Authentication, and Connection page fields to their default values. |
Load Request |
Uses the TOpenDialog component to load the properties values for TRESTClient, TRESTRequest, or TRESTResponse from the file selected. |
Save Request |
Saves into a file the properties values of the TRESTClient, TRESTRequest, or TRESTResponse component. |
Copy Components |
Copies the TRESTClient, TRESTRequest, and TRESTResponse components to the clipboard. You can copy these components to the clipboard, and then paste them to the Form Designer. |
The Response Pane
Use the Response page to read the returned data from the service through the TRESTResponse class.
There are three labels within the TGroupBox that show the response received from the service: the LastRequest URL and the LastRequest Stats labels are right on the top of the TGroupBox, while the Proxy State label is at the bottom of the TGroupBox.
Item | Description |
---|---|
LastRequest URL |
Displays the BaseURL property of the TRESTClient. |
LastRequest Stats |
Contains information about:
|
Proxy State |
Specifies if the ProxyServer is enabled or not. |
Headers
The response header contains pairs of (key=value) and has information such as date, size, and type of file that the server sends to the client, and also data about the server itself.
The HTTP header fields retrieved by the server differ from an API to another.
Item | Description |
---|---|
ResponseHeader |
Displays the Headers property of the TRESTResponse. |
Body
The response holds all the returned data from the service. The data includes the HTTP status code, error messages (if these exist), and the returned JSON data.
The response data can be accessed using one of the properties: Content, JSONValue, or RAWbytes.
Item | Description |
---|---|
LabelJSON |
Specifies if:
|
JSON Root Element |
Represents the RootElement property of TRESTResponse. Insert the needed root element into JSON Root Element TClearingEdit. |
ResponseBody |
Displays all the returned data from the service, that are right after the header. |
Apply |
Limits the contents of the response body shown, based on the RootElement property. |
Tabular Data
A JSON formed response of a service can be transformed into any TDataSet-descendant class with a dataset adapter.
Each JSON object will be a new record in the dataset. The properties of the JSON object(s) will typically form the columns of the dataset.
Item | Description |
---|---|
StringGrid |
Shows the response organized as a dataset. |