Generating HTTP requests for invoking services
Aside from calling services via browser (using the Invoke in Browser option), you can also call services from the HTTP Client. By dragging and dropping the service or API file1 to the HTTP Client view, the request will automatically be generated for you. This is useful for sending requests to the server.
The HTTP Client supports the dragging and dropping of the following items:
- Gloop services (
- Groovy services (
- Flux services (
- Gloop REST API files (
- Gloop REST API path and operation nodes
Not only will the HTTP client populate your parameters with default values provided in your code, it will also populate headers and authentication data for you.
Use the context menu to invoke services via the HTTP Client
As an alternative to dragging and dropping a file to the HTTP Client, you may right click an invokable item and select Invoke in HTTP Client from the appearing context menu.
Default authentication type
When you drag and drop a service to the HTTP Client or use the context menu to invoke a service from it, the request's authentication type is set to Martini session by default.
Invoking a Gloop service
To invoke a Gloop service:
- Drag and drop the Gloop service file to the HTTP Client.
- Depending on your service and the type of call you want to make, populate the input data required and/or set the authentication.
- Click Send.
Invoking a Gloop REST API
You can drag and drop a Gloop REST API file (
.api) from the Navigator to the
HTTP Client and the HTTP Client will generate a request for every operation exposed in the API.
Aside from files, you can also drag and drop a path or operation node from the Operations tab of the Gloop REST API editor. When you drag and drop a path node, the HTTP Client will generate requests for all operations under that path. When you drag and drop an operation node, the HTTP Client will create a request for invoking that HTTP operation. This allows you to have finer control over which requests will be created.
REST APIs may contain multiple paths, and each path may be comprised of multiple operations
Consider these operations from Swagger's Petstore API:
/petAdd a new pet to the store
/petUpdate an existing pet
/pet/findByStatusFind pets by status
You will notice that there are two paths in our list above:
path holds only one operation: the operation whose method is
GET; but the
/pet path has two operations, each
Set an HTTP request's response code by adding a request parameter named
When the REST API operation you're invoking in the HTTP Client has its
Mock property enabled to
true, then a
$gloopResponseCode query parameter can be added to the generated request in order to set the response code.
Invoking a Flux service
To invoke a Flux service:
- Drag and drop the Flux service you want to invoke to the HTTP Client.
- Populate the necessary inputs of the service which are either in the Parameter or Body tab.
- Specify the start state by setting the
- Click Send.
Invoking a Groovy service
To invoke a Groovy service:
- Drag and drop the Groovy file you want to invoke from the Navigator view to the HTTP Client.
- Select the method you want to invoke from the service picker. Once done, click OK.
- Supply the required inputs of the service.
- Click Send.
You can also create a request to a Groovy service while in the Groovy service editor by clicking the run button beside the method you want to call and then choosing "Invoke '<service>' in HTTP Client".
Dragging and dropping of Gloop REST API paths or operations to the HTTP Client is also supported. ↩