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:

  1. Go to Apps > REST Client.

  2. 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:

  1. Rest calls. The call to be executed on the given client

  2. Rest service. The REST service class name.

    Configure pre-seeded services under /module/rest-client-app/config/serviceClasses.
  3. Service method. The method to be executed on the given client.

  4. Method annotations. The annotations of the service method and method parameters of the selected REST client. The parameter without annotations is the request body.

  5. Method parameters. The service method parameters or the queryParameters and defaultValues of the call. Enter one per line. Leave the line for the body parameter empty.

  6. 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).

  7. 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.

UI api testing

Example configuration

books.yaml
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 method, entityClass, and path.

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:

  1. Go to Apps > REST Client.

  2. Open the Debug subapp.

  3. 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.

  4. 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.

  5. In the Debug Content selector of the Debug subapp, you should see one or more timestamped REST call records.

  6. Select the record you wish to inspect.

  7. 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

    REST Debug subapp

Feedback

DX Core

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the DX Core docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules