REST Client app
The Magnolia REST Client app allows testing and debugging of configured REST clients.
Installing
The app is installed by the Rest Client module and is included in all Magnolia 6.2 preconfigured Magnolia bundles.
This excludes the magnolia-tomcat-barebone bundle.
|
Using
The REST Client app consists of two subapps, the REST Client subapp and the Debug subapp. Use the REST Client subapp to send a request using a configured REST client, together with specific parameters and/or request body. The response will be shown in the Response area.
Use the Debug subapp to check for possible issues connected with calls sent with the REST Client subapp.
REST Client subapp
To test a configured REST client:
-
Go to Apps > REST Client.
-
In the Rest client field, select a configured client.
If the client already includes a pre-configured REST call definition, a note about this will be displayed just below the field.
One or more of the following configuration fields and options will be either shown or hidden depending on the extent of the actual configuration:
-
Rest calls. The call to be executed on the given client
-
Rest service. The REST service class name.
Configure pre-seeded services under /module/rest-client-app/config/serviceClasses
. -
Service method. The method to be executed on the given client.
-
Method annotations. The annotations of the service method and method parameters of the selected REST client. The parameter without annotations is the request body.
-
Method parameters. The service method parameters or the
queryParameters
anddefaultValues
of the call. Enter one per line. Leave the line for thebody
parameter empty. -
Authentication. The options are
None
,Basic`and `Bearer
, with the last two requiring additional configuration data such as Username and Password (Basic
), and Token (Bearer
). -
Request body. An optional request body. The value will be used as the service method parameter without annotations, if present.
Click Send request when you have completed the fields.
The Response field displays the response received from the endpoint. |
Example configuration
baseUrl: http://openlibrary.org/api (1)
restCalls: (2)
searchByIsbn: (3)
method: get
entityClass: java.lang.String
path: /volumes/brief/isbn/{isbn}.json
1 | Specify the base URL for your API. |
2 | Declare the restCalls section. This is where your REST API calls will be. |
3 | Specify your REST call.
Typically, REST calls require a |
Use the Definitions app to check that your REST client definition has been registered in the instance. |
Debug subapp
To debug or inspect a REST request or response:
-
Go to Apps > REST Client.
-
Open the Debug subapp.
-
In the Available Definitions, select the client(s) whose requests/responses you would like to inspect and move the selected item(s) to the Debugging Definitions field.
Optionally, using the selectors further to the right, you can also specify:
-
Maximum records. The maximum number of REST calls to be recorded.
-
Response code. The type(s) of response code that should be taken into account: Successful, Client error, Server error or All.
-
-
Issue a REST call using the selected REST client(s).
You can do this from any app that utilizes the configured REST client(s). Alternatively, you can also use the REST Client subapp for this:
-
Switch back to the REST Client subapp.
-
Select the desired REST client and together with a specific call, call parameters or call body, initiate a REST call.
-
-
In the Debug Content selector of the Debug subapp, you should see one or more timestamped REST call records.
-
Select the record you wish to inspect.
-
In the two areas below the selector, you can then inspect the request and the response of the call.
Depending on what format or which part of call you prefer to see or work with, click one of the following tabs:
-
For a REST request, the All Request, Headers, Body, Cookies or as Curl tab.
-
For a REST response, the All Response, Headers or Body tab.
- Example debug content
-