User:RominaU/Response

From RAD Studio
Jump to: navigation, search

The Response

Use the Response page to read the returned data from the service through the TRESTResponse class.

Item Description

lbl_LastRequestURL TLabel

Displays the BaseURL property of TRESTClient.

lbl_LastRequestStats TLabel

Contains information about:

  1. response status - displays the StatusCode, StatusText and ContentLength properties of TRESTResponse
  2. execution performance - displays timing information:
    • PreProcessingTime : time from starting the execution until the request is handed over to the the actual http client and sent to the server
    • ExecutionTime : time since the request is sent to the server and until the response is received
    • PostProcessingTime : time from receiving the server response until all post processing work is done(including JSON parsing)
    • TotalExecutionTime : the total execution time - the sum of PreProcessingTime, ExecutionTime and PostProcessingTime

lbl_ProxyState TLabel

Specifies if the Proxy-server 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.

Note: For more information about header fields, see this link.

Item Description

memo_ResponseHeader TMemo

Displays the Headers property of 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 TLabel

Specifies if:

  • the content has a JSON representantion or not
  • the JSON root element is an invalid one

JSON Root Element

Represents the RootElement property of TRESTResponse. Insert the wanted root element into EditRootElement TClearingEdit.

memo_ResponseBody TMemo

Displays all the returned data from the service, situated right after the header.

Apply button

Limits the contents of the response body shown, based on 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

StringGrid1 TStringGrid

Shows the response organized as a dataset.