GoLand 2021.1 Help

REST Client Tool Window

Tools | HTTP Client | Test RESTful Web Service
View | Tool Windows | REST Client

Use the REST Client tool window for testing a RESTful Web Service. The tool window is intended for composing and submitting test requests to Web service methods based on the service API, as well as for viewing and analyzing server responses.

Note the following:

  • View | Tool Windows | REST Client- the tool window can be accessed this way after you have opened it using the Tools | HTTP Client | Test RESTful Web Service command.

  • The tool window is available only when the REST Client bundled plugin is enabled. The plugin is active by default. If not, activate it in the Plugins page of the Settings dialog.

Common Request Settings

In this area, choose the request method and specify the data to compose the request URI from.

The server response code and the content length are shown in the upper-right corner of the REST Client tool window.

ItemDescription
HTTP method

In this list, specify the request method.

The available options are:

Host/portIn this field, type the URL address of the host where the target Web service is deployed and the port it listens to. By default, the port number is 80. If another port is used, specify it explicitly in the format <host URL>:<port number>.
PathIn this list, specify the relative path to the target method.

You can enter the entire URL address of a method to test in the Host/port field. Regardless of the chosen HTTP method, upon pressing the Run button GoLand will split the URL address into the host/port and the path to the method. The extracted relative path will be shown in the Path field and the extracted parameters will be added to the list in the Request Parameters pane of the Request tab.

Toolbar

ItemTooltip and shortcutDescription
RunSubmit Request

Click this button to submit the generated test request to the server.

Replay Recent RequestsReplay Recent RequestsClick this button to have a Recent Requests list displayed and select the relevant request. The fields are filled in with the settings of the selected request. Click the Submit Request button Run.
Export RequestExport RequestClick this button to have the current request settings saved in an XML file so they are available in another GoLand session. In the dialog that opens, specify the name of the file to save the settings in and its parent folder. When necessary, you can retrieve the saved settings and run the request again.
Import RequestImport RequestClick this button to have the settings of a previously saved request retrieved from an XML file. In the dialog that opens, select the relevant XML file.
Generate Authorization HeaderGenerate Authorization Header

Click this button to open the Generate Authorization Header dialog and specify your username and password for accessing the target RESTful Web service through.

Based on these credentials GoLand will generate an authentication header which will be used in basic authentication. Learn more at http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm.
Configure HTTP ProxyConfigure HTTP ProxyClick this button to specify proxy server settings in the dialog that opens.
Close the REST Client tool windowCloseClose the REST Client tool window.
HelpHelpShow this page.

Request Tab

Use this tab to specify the parameters to be passed to the service in the generated test request either through the query string for GET requests or through the request body for other request types. Also configure interaction between the client side and the Web service by specifying the format of data that the service and the client accept.

ItemDescription
HeadersIn this pane, specify the technical data included in the request header. These data are passed through header fields and define the format of the input parameters (accept field), the response format (content-type field), the caching mechanism (cache-control field), and so on.

To add a field to the list, click Add   the Add button, then specify the field name in the Name field and the field value in the Value list.

The set of fields and their values should comply with the Web service API. In other words, the specified input format should be exactly the one expected by the Web service as well as the expected response format should be exactly the one that the service returns.

For accept, content-type, and some other fields GoLand provides a list of suggested values. Choose the relevant format type from the Value list.

Request Parameters

In this pane, specify the parameters to be passed to the target method through a query string inside the URL. This approach is used for requests of the type GET. By default, the pane shows an empty list with one line.

  • To add a parameter, click Add   the Add button, then specify the name of the parameter in the Name field and the value of the parameter in the Value list.

  • To delete a parameter from the list, select it and click Remove   the Remove button.

  • To suppress sending the specified query string parameters and disable the controls in the Request Parameters pane, press the Don't send anything toggle button Clear.

The set of parameters and their types should comply with the Web service API, in particular, they should be exactly the same as the input parameters of the target method.

  • select this checkbox This may be helpful, for example, if you want to test passing parameters through other request methods in the request body but still preserve the data typed in the Query string parameters pane.

Request Body

The pane is disabled when the GET, DELETE, HEAD, or OPTIONS request method is selected. In this pane, specify the input parameters to be passed to the target method inside a request message body.

  • Empty: choose this option to send a request with an empty body.

  • Text: choose this option to send a request with a string of parameters with values. Specify the parameters in the field next to the option.

  • File contents: choose this option to have the parameters inserted in the request body from a local text file. Specify the source text file in the File to send field.

  • File upload(multipart/form-data): choose this option if you want to pass a binary file as a parameter, which requires that the file be converted. Specify the source binary file in the File to send field.

Cookies Tab

Use this tab to create, save, edit, and remove cookies, both received through responses and created manually. The name and value of a cookie is automatically included in each request to the URL address that matches the domain and path specified for the cookie, provided that the expiry date has not been reached.

The tab shows a list of all currently available cookies that you received through responses or created manually. The cookies are shown in the order they were added to the list. When you click a cookie, its details become editable and are displayed in text boxes.

ItemDescription
NameIn this fields, specify the name of the cookie to be included in the request.
ValueIn this field, specify the value of the cookie to be included in requests.
DomainIn this field, specify the host and port the requests to which must be supplied with the name and value of the cookie.
PathIn this field, specify the path of the URL the requests to which must be supplied with the name and value of the cookie.
Expiry dateIn this field, specify the expiry date of the cookie.
the Add buttonClick this button to add a new row to the list and define a new coolie in it.
the Remove buttonClick this button to remove the selected cookie from the list.

Response Tab

Use this tab to view responses from the Web service. By default, responses are shown in the plain text form. Use the icons of the tab to have them displayed in the editor in the HTML, XML, and JSON formats.

ItemTooltipDescription
View as HTMLView as HTMLClick this button to open a new tab in the main editor window and display there the response as HTML.
View as XMLView as XMLClick this button to open a new tab in the main editor window and display there the server response as XML.
View as JSONView as JSONClick this button to open a new tab in the main editor window and display there the server response as JSON.
iconOpenInDefaultWebBrowser.pngOpen in browserClick this button to view the response in your default Web browser.

Response Headers Tab

The tab shows the technical data provided in the headers of Web service responses.

Last modified: 08 March 2021