Skip to content

Overview

Concepts and Principles

Development

Overview

IDEs

API Explorer

Releases

Release Notes

TORO Integrate

Coder Studio

Coder Cloud

Bug Reports

Search

Using Generated HTTP Client Services

Introduction

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
│   │   │   ├── HttpClientMockEndpoints.api
│   │   │   ├── postData
│   │   │   │   └── ReturnPostData.gloop
│   │   │   └── weather
│   │   │       ├── GenerateCurrentWeather.gloop
│   │   │       ├── GenerateRandomTemperature.gloop
│   │   │       └── GenerateWeatherForecast.gloop
│   │   ├── 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.

How It Works...

The HTTP client services, which are under the httpClient.services package used a one-liner from the HttpMethods class to make the HTTP call. These services actually just call the mock APIs defined in httpClient.mockApis.

Mock data

The data generated by the services is only mock data.