Skip to content

Home

Introduction

Development

IDEs

Services

Service manager

API Explorer

examples package: Using generated HTTP client services

To make HTTP calls in Gloop, you will have to use one-liners from HttpMethods. Calls to these one-liners can easily be generated using Coder's HTTP client service wizard. Using this wizard, the Gloop service which calls the web service is generated along with the models required for the request and response.

The examples package contains a couple of models and services generated from the HTTP client service wizard to demonstrate how HTTP client services work. The generated models are in httpClient.model and the generated services are in httpClient.services. The services were modified so that they include additional steps relevant to achieve the desired flow of the program (e.g. error-handling).

Related articles

Please see the following articles for more information:

Try it!

Under the Coder Navigator, expand the examples package entry and navigate to the code folder. Afterwards, look for the httpClient package. This package contains models, Gloop services, and API files, shown below:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
examples
├── ...
├── code
   ├── httpClient
      ├── mockApis
      │   ├── postData
      │   │     └── ReturnPostData.gloop
      │   └── weather
      │        ├── GenerateCurrentWeather.gloop
      │        ├── GenerateRandomTemperature.gloop
      │        └── GenerateWeatherForecast.gloop
         └── HttpClientMockEndpoints.api
      ├── model
         ├── GetCurrentWeatherOutput.model
         ├── GetWeatherForecastOutput.model
         └── PostHelloWorldOutput.model
      └── services
          ├── GetCurrentWeather.gloop
          ├── GetWeatherForecast.gloop
          └── PostHelloWorld.gloop
   ├── ...

Simply run the services under the httpClient.services package to see HTTP client services in action. You can also open these services to inspect their contents and read their line comments to understand them better.

Explanation

The HTTP client services, which are under the httpClient.services package, use a one-liner from the HttpMethods class to make the HTTP call. We've configured these services to call the mock APIs defined in httpClient.mockApis.

Mock data only

The data generated by the services is mock data only.