User Tools

Site Tools


Sidebar

WMC v3.x wiki


Introduction


Quick Start


System Management


Network Management


SNMP


Push


LoRa features


GMS API


Troubleshooting


Gateway software resources

WMC 3.2:

Previous version

Server software resources

WMC 3.2:

Previous version


FAQ

WMC 3.x:

WMC 3.0:

WMC 3.1:

>= WMC 3.2:

>= WMC 3.1:

wiki:wiki3:swagger_codegen

Swagger Codegen (WMC >= 3.1)

Swagger Codegen can simplify your build process by generating server stubs and client SDKs for any API, defined with the OpenAPI (formerly known as Swagger) specification, so your team can focus better on your API’s implementation and adoption.

Interesting link:
Swagger Codegen | API Development Tools | Swagger


Goal

The current page explains how to generate a REST java client in order to use Kerlink GMS API methods to create a customer, a fleet, a gatewway, a cluser and an end-device and get information about them.

Requirements

Building the API client library requires:

  1. JDK 1.7+ (JDK 12 is the best choice)
  2. Maven/Gradle (version 3.3.9-3 is available in the official Ubuntu 16.04 repository)
  3. Eclipse Java EE IDE for Web Developers (Version: 2019-06 (4.12.0) for instance)

For Eclipse, you can find it here: Enabling Open Innovation & Collaboration | The Eclipse Foundation

Download the GMS API JSON file

From the WMC 3.1 dashboard, import the GMS API JSON file:


Rename the file openapi to openapi.json

Download Swagger Codegen CLI tool

wget http://central.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.8/swagger-codegen-cli-3.0.8.jar


Generating a client

Swagger Codegen allows you to generate a client in a wide variety of languages. You may check if your preferred programming language is available by executing

java -jar swagger-codegen-cli-3.0.8.jar langs

Here is a sample of the results:

tda@KLK724-VirtualBox-64:~/Development/Swagger$ java -jar swagger-codegen-cli-3.0.8.jar langs
15:21:40.233 [main] DEBUG io.swagger.codegen.v3.cli.SwaggerCodegen - there are not options for command 'langs'
15:21:40.236 [main] DEBUG io.swagger.codegen.v3.cli.SwaggerCodegen - there are not options for command 'version'
Available languages: [aspnetcore, csharp, csharp-dotnet2, dynamic-html, html, html2, java, jaxrs-cxf-client, jaxrs-cxf, inflector, jaxrs-cxf-cdi, jaxrs-spec, jaxrs-jersey, jaxrs-di, jaxrs-resteasy-eap, jaxrs-resteasy, spring, nodejs-server, openapi, openapi-yaml, kotlin-client, kotlin-server, php, python, scala, scala-akka-http-server, swift3, swift4, typescript-angular]


Generating client code for Java

Here is the command to generate the JAVA client code:

java -jar swagger-codegen-cli-3.0.8.jar generate -i openapi.json -l java -o ./java_api_client/ --additional-properties hideGenerationTimestamp=true

This command has created the java_api_client directory:

tda@KLK724-VirtualBox-64:~/Development/Swagger$ ls
generating_client.log  java_api_client  openapi.json  swagger-codegen-cli-3.0.8.jar

tda@KLK724-VirtualBox-64:~/Development/Swagger/java_api_client$ ls
build.gradle  build.sbt  docs  git_push.sh  gradle  gradle.properties  gradlew  gradlew.bat  pom.xml  README.md  settings.gradle  src

You can find the Client API under ./java_api_client/src/main/java/io/swagger/client:

tda@KLK724-VirtualBox-64:~/Development/Swagger/java_api_client/src/main/java/io/swagger/client$ ls
api               ApiClient.java     ApiResponse.java  Configuration.java           JSON.java  Pair.java                 ProgressResponseBody.java
ApiCallback.java  ApiException.java  auth              GzipRequestInterceptor.java  model      ProgressRequestBody.java  StringUtil.java

The most useful files are ApiClient.java and ApiResponse.java. ApiClient is used to build an HTTP Request and ApiResponse to decode an HTTP response.

GMS API can be found in ./java_api_client/src/main/java/io/swagger/client/api:

tda@KLK724-VirtualBox-64:~/Development/Swagger/java_api_client/src/main/java/io/swagger/client/api$ ls
ActionsApi.java              ClustersApi.java           DefaultApi.java     FleetsApi.java        LnsEventsApi.java          PasswordApi.java            SelectionsApi.java    WebServicesApi.java
AlgorithmsApi.java           CustomersApi.java          DocApi.java         GatewaysApi.java      LoginApi.java              PingApi.java                SpectrumsApi.java     WorkflowApi.java
ApplicationSettingsApi.java  CustomersSettingsApi.java  DtosApi.java        GatewayTypesApi.java  MulticastDataDownApi.java  PushConfigurationsApi.java  TasksApi.java
AuthenticatedUserApi.java    DataDownApi.java           EndDevicesApi.java  KpisApi.java          MulticastGroupsApi.java    RncEventsApi.java           UsersApi.java
CapabilitiesApi.java         DataUpApi.java             EventsApi.java      LicensesApi.java      OpenapiApi.java            RolesApi.java               ValidateUserApi.java


All the DTO classes can be found in ./java_api_client/src/main/java/io/swagger/client/model:

tda@KLK724-VirtualBox-64:/media/VM_share/SWAGGER/java_api_client2/src/main/java/io/swagger/client/model$ ls
ActionDto.java                          EndDevicePositionDto.java              LnsCustomersLastEventsCountersDto.java
ActionParameterDto.java                 ErrorDto.java                          LnsEventDto.java
ActivityDto.java                        FileDto.java                           LnsGatewayKeyDto.java
AlgorithmDto.java                       FleetCountersDto.java                  MetaDto.java
ApplicationDto.java                     FleetDto.java                          MetaFieldDto.java
ApplicationSettingDto.java              FleetLastEventCounterDto.java          ModemStatisticInterferDto.java
Body1.java                              GatewayConfigurationDto.java           MulticastDataDownDlParametersDto.java
Body2.java                              GatewayConnectionDto.java              MulticastDataDownDto.java
Body3.java                              GatewayControlDto.java                 MulticastDataDownPathDto.java
Body4.java                              GatewayDto.java                        MulticastGroupDto.java
Body5.java                              GatewayEventDto.java                   NumericStatisticDto.java
Body6.java                              GatewayInfoDto.java                    PaginatedDto.java
Body7.java                              GatewayManagementDto.java              ProcessDto.java
Body.java                               GatewayModemDto.java                   ProgressMonitorDto.java
BscDto.java                             GatewayModemStatisticDto.java          PushConfigurationDto.java
CapabilitiesDto.java                    GatewayNumericStatisticsDto.java       PushConfigurationHeaderDto.java
ClusterCountersDto.java                 GatewayPositionDto.java                PushConfigurationHealthDto.java
ClusterDto.java                         GatewaySnmpLogDto.java                 RevisionDto.java
CommandDto.java                         GatewaysStatisticDto.java              RncCustomerLastEventsCountersDto.java
CsvEndDeviceDto.java                    GatewayStatisticsDto.java              RncGatewayEventDto.java
CsvGatewayDto.java                      GatewayTermStatisticsDto.java          RncGatewayLastEventDto.java
CustomerDto.java                        GatewayTypeDto.java                    RoleDto.java
CustomerLastEventsCountersDto.java      GatewayVersionDto.java                 SelectionDto.java
CustomerSettingDto.java                 InstanceDto.java                       SpectrumDto.java
CustomersLastEventsCountersDto.java     ItemDto.java                           TaskDto.java
DataDownDlParametersDto.java            JwtDto.java                            TaskMessageDto.java
DataDownDto.java                        KpiDto.java                            TemplateDto.java
DataDownStatusDto.java                  LastEventCounterDto.java               UserDto.java
DataUpDto.java                          LastEventDto.java                      VersionDto.java
EndDeviceDto.java                       LastOperationDto.java                  WanInterfaceTypeDto.java
EndDeviceLastGatewayDto.java            LastStatisticDto.java                  WebServiceDto.java
EndDeviceMessageDto.java                LicenseDto.java                        WebServiceParameterDto.java
EndDeviceMessageMacCommandDto.java      LinkDto.java
EndDeviceMessageRadioParameterDto.java  LnsCustomerLastEventsCountersDto.java


Importing and compiling the client code in ECLIPSE environment


Importing the client code in ECLIPSE environment


To import the client code in Eclipse environment:

  • select Import option
  • select Maven Project
  • select the browse option
  • select the swagger-java-client directory (containing the pom.xml file)


Building/Compiling

Read the README.md file located in the java_api_client directory.

README.md

Activating compilation errors on raw type

In Eclipse, right click on projet → properties, java compiler → Errors/warnings > generic types → use of a raw type. Choose “error” in the list.

Compiling

To compile the client code, select your “swagger-java-client” project, right-click, select “Run As” and then select “Run Configuration”:

Type the goal of the build process: “compile” and click the Run button:

The compilation result should be “BUILD SUCCESS”:

Fixing compilation errors on raw type

Compilation results are located in .\java_api_client\target\surefire-reports
Select the file you want to see compilation results.

Installing the client code library in MAVEN repository

To install the client API library to your local Maven repository, simply execute:

mvn clean install

This can be done like that:

This will build swagger-java-client-1.0.0.jar in the /target/ directory.



Executing the client code



Creating a test project

First, create a new MAVEN project: “test-swagger-java-client”.
Then define a dependency with the swagger-java-client project.
To achieve this, right click on the test-swagger-java-client project and select “Maven” then select “Add dependency”:

Add the following information:



Testing the Login API client code


Replace the “Hello World” code by your testing code:

Replaced by :

package io.swagger.test_swagger_java_client;

import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.LoginApi;
import io.swagger.client.model.JwtDto;
import io.swagger.client.model.UserDto;
import io.swagger.client.ApiResponse;


public class App {

    public static void main(String[] args) throws ApiException {
    	
      // Say Hello
      System.out.println("Hello world");
        
      String baseApiUrl = "https://wmcintegration.wanesy.com/";
  	 
  	  int connectTimeout = 60000;

  	  // Create an ApiClient per thread
  	  ApiClient client = new ApiClient();

  	  client.setBasePath(baseApiUrl); 	  
  	  client.setConnectTimeout(connectTimeout);
  	  client.setDebugging(true);
      
  	  // Call login method
  	  LoginApi loginApi = new LoginApi(client);
  	  
  	  UserDto body = new UserDto ();
  	  body.setLogin("your_login");
  	  body.setPassword("your_password");
  	  
  	  System.out.println("Login Post");
  	
  	  JwtDto jwt = loginApi.login(body);
	
  	  client.setApiKey("Bearer " + jwt.getToken());
  	  Configuration.setDefaultApiClient(client);
  	 	   	
  	  System.out.println("Test Done");
  	
    }
}

Compile this piece of code and execute it like this :

The result should be:

Hello world
Login Post
--> POST https://wmcintegration.wanesy.com//gms/application/login HTTP/1.1
Content-Type: application/json; charset=utf-8
Content-Length: 150
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java

{"lastName":"","role":"","avatar":"","login":"xxxxx","enabled":false,"firstName":"","password":"xxxxxx","validated":false,"phone":"","email":""}
--> END POST (150-byte body)
<-- HTTP/1.1 201  (462ms)
Server: nginx
Date: Fri, 28 Jun 2019 15:35:11 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 230
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1561736111681
OkHttp-Received-Millis: 1561736111812

{"expiredDate":1561772111781,"tokenType":"Bearer","token":"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MirtyuzeMiLCJleHAiOjE1NjE3NzIxMTF9.vhYdP3xy0Naqdeiq7Cx_kzd8bMMg6r0ig-aryAKYJZ8"}
<-- END HTTP (230-byte body)
Test Done

This token will be used for next GMS API requests like getCustomers, getGateways, getFleets, getClusters, etc…

You can find API samples in .\java_api_client\docs



Testing the Customer API client code


Modifying the CustomersAPI


Modify the CustomersAPi class located in ./java_api_client/src/main/java/io/swagger/client/api/CustomerApi.java to make it generic:

Modifying the getCustomers API

    public PaginatedDto getCustomers(String fields, String page, String pageSize, String search, String sort) throws ApiException {
        ApiResponse<PaginatedDto> resp = getCustomersWithHttpInfo(fields, page, pageSize, search, sort);
        return resp.getData();
    }

becomes

    public PaginatedDto<CustomerDto> getCustomers(final String fields, final String page, final String pageSize, final String search, final String sort) throws ApiException {
        ApiResponse<PaginatedDto<CustomerDto>> resp = getCustomersWithHttpInfo(fields, page, pageSize, search, sort);
        return resp.getData();
    }

Modifying getCustomersWithHttpInfo API

public ApiResponse<PaginatedDto<CustomerDto>> getCustomersWithHttpInfo(String fields, String page, String pageSize, String search, String sort) throws ApiException {
        com.squareup.okhttp.Call call = getCustomersValidateBeforeCall(fields, page, pageSize, search, sort, null, null);
        Type localVarReturnType = new TypeToken<PaginatedDto>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

becomes

public ApiResponse<PaginatedDto<CustomerDto>> getCustomersWithHttpInfo(final String fields, final String page, final String pageSize, final String search, final String sort) throws ApiException {
        com.squareup.okhttp.Call call = getCustomersValidateBeforeCall(fields, page, pageSize, search, sort, null, null);
        Type localVarReturnType = new TypeToken<PaginatedDto<CustomerDto>>(){}.getType();
        return this.apiClient.execute(call, localVarReturnType);
    }

Modifying the PaginatedDto class

Modify the PaginatedDto class located in ./java_api_client/src/main/java/io/swagger/client/model/PaginatedDto.java to make it generic:

  • Replace the definition “public class PaginatedDto” to “public class PaginatedDto<T>”
  • Replace the list member from “private List<Object> list = null;” to “private List<T> list = null;”
  • Replace all methods definitions using the PaginatedDto class by the generic form: PaginatedDto<ClusterDto> for instance (see below)

The result for the PaginatedDto class should be:

/**
 * PaginatedDto
 */

public class PaginatedDto<T> {

  @SerializedName("count")
  private Integer count = null;

  @SerializedName("pageSize")
  private Integer pageSize = null;

  @SerializedName("links")
  private List<LinkDto> links = null;

  @SerializedName("page")
  private Integer page = null;

  @SerializedName("totalCount")
  private Long totalCount = null;

  @SerializedName("list")
  private List<T> list = null;
  
  @SerializedName("totalCount")
  private Long totalCount = null;

  @SerializedName("nbPages")
  private Integer nbPages = null;
  public PaginatedDto<T> count(Integer count) {
    this.count = count;
    return this;
  }
  

Example of using PaginatedDto class:

public PaginatedDto getClusters(String fields, String page, String pageSize, String search, String sort) throws ApiException {
    ApiResponse<PaginatedDto> resp = getClustersWithHttpInfo(fields, page, pageSize, search, sort);
    return resp.getData();
}

becomes :

public PaginatedDto<ClusterDto> getClusters(String fields, String page, String pageSize, String search, String sort) throws ApiException {
    ApiResponse<PaginatedDto<ClusterDto>> resp = getClustersWithHttpInfo(fields, page, pageSize, search, sort);
    return resp.getData();
}

Modifying the customerDto class

All private variables of the customerDto constructor must be initialized to null:

./java_api_client/src/main/java/io/swagger/client/model/customerDto.java

public class CustomerDto {

  @SerializedName("maxUsers")
  private Integer maxUsers = null;

  @SerializedName("maxEndDevices")
  private Integer maxEndDevices = null;

  @SerializedName("maxGateways")
  private Integer maxGateways = null;

  @SerializedName("geolocationExpirationDate")
  private Long geolocationExpirationDate = null;

  @SerializedName("name")
  private String name = null;

  @SerializedName("logo")
  private String logo = null;

  @SerializedName("links")
  private List<LinkDto> links = null;

  @SerializedName("geolocationAuthorized")
  private Boolean geolocationAuthorized = null;

  @SerializedName("id")
  private Long id = null;

  @SerializedName("billing")
  private Boolean billing = null;
  public CustomerDto maxUsers(Integer maxUsers) {
    this.maxUsers = maxUsers;
    return this;
  }

Testing getCustomers


package io.swagger.test_swagger_java_client;

import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.LoginApi;
import io.swagger.client.model.JwtDto;
import io.swagger.client.model.UserDto;
import io.swagger.client.ApiResponse;
import io.swagger.client.api.CustomersApi;
import io.swagger.client.model.PaginatedDto;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;


public class App_CustomerAPITest {

    public static void main(String[] args) throws ApiException {
    	
      // Say Hello
      System.out.println("Hello world");
        
      String baseApiUrl = "https://wmcintegration.wanesy.com/";
  	  
  	  int connectTimeout = 60000;

  	  // Create an ApiClient per thread
  	  ApiClient defaultClient = Configuration.getDefaultApiClient();
  	  
  	  defaultClient.setBasePath(baseApiUrl); 	  
  	  defaultClient.setConnectTimeout(connectTimeout);
  	  defaultClient.setDebugging(true);
  	
  	  // Call login method
  	  LoginApi loginApi = new LoginApi(defaultClient);
  	  
  	  UserDto body = new UserDto ();
  	  body.setLogin("your_login_here");
  	  body.setPassword("your_password_here");
  	  
  	  System.out.println("Login Post");
  	
  	  JwtDto jwt = loginApi.login(body);
	
  	  defaultClient.setApiKey("Bearer " + jwt.getToken());
  	  Configuration.setDefaultApiClient(defaultClient);
  	 
  	  // getCustomers
  	  CustomersApi customerInstance = new CustomersApi();
  	  String sort = ""; // Sort value
	  String pageSize = ""; // Page size value
	  String search = "{\"operand\": \"name\", \"operation\": \"EQ\",	\"values\": [\"kerlink\"]}"; // Search condition
	  String fields = ""; // List of fields to display
	  String page = ""; // Page number
	  try {
		  PaginatedDto<CustomerDto> paginatedDto =  customerInstance.getCustomers(fields, page, pageSize, search, sort);
	  	  assertEquals(Integer.valueOf(1), paginatedDto.getCount());
	  	  
	  } catch (ApiException e) {
	  	    System.err.println("Exception when calling CustomersApi#applicationCustomersGet");
	  	    e.printStackTrace();
	  }
	  
  	  System.out.println("Test Done");
    }
}

Test Result:

Hello world
Login Post
--> POST https://wmcintegration.wanesy.com//gms/application/login HTTP/1.1
Content-Type: application/json; charset=utf-8
Content-Length: 150
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java

{"lastName":"","role":"","avatar":"","login":"xxxxx","enabled":false,"firstName":"","password":"xxxxxxxx","validated":false,"phone":"","email":""}
--> END POST (150-byte body)
<-- HTTP/1.1 201  (500ms)
Server: nginx
Date: Fri, 28 Jun 2019 15:21:15 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 230
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1561735275696
OkHttp-Received-Millis: 1561735275830

{"expiredDate":1561771275797,"tokenType":"Bearer","token":"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJbXMiLCJleHAiOjE1NjE3NzEyNzV9.kF53EEKMxqkV27WcJ5UDHwy-B-z4UTRChJc2gkJbWMU"}
<-- END HTTP (230-byte body)
--> GET https://wmcintegration.wanesy.com//gms/application/customers?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22kerlink%22%5D%7D&sort= HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJbXMiLCJleHAiOjE1NjE3NzEyNzV9.kF53EEKMxqkV27WcJ5UDHwy-B-z4UTRChJc2gkJbWMU
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (39ms)
Server: nginx
Date: Fri, 28 Jun 2019 15:21:15 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 1148
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1561735275881
OkHttp-Received-Millis: 1561735275920

{"count":1,"pageSize":50,"links":[{"rel":"first","href":"/application/customers?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22kerlink%22%5D%7D&sort="},{"rel":"last","href":"/application/customers?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22kerlink%22%5D%7D&sort="}],"page":1,"totalCount":1,"list":[{"id":1,"name":"KERLINK","logo":null,"maxGateways":null,"maxEndDevices":null,"maxUsers":null,"geolocationAuthorized":true,"geolocationExpirationDate":null,"billing":false,"links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"1\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"1\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"1\"]}"},{"rel":"rncKpis","href":"/application/customers/1/kpis"},{"rel":"self","href":"/application/customers/1"}]}],"nbPages":1}
<-- END HTTP (1148-byte body)
Test Done

Modifying the getId() method in CustomerDto class

Fixing the generated code issue: Replacing “return id;” by “return this.id”.

@Schema(required = true, description = "Identifier")
  public Long getId() {
    return id;
  }

becomes:

  
@Schema(required = true, description = "Identifier")
  public Long getId() {
    return this.id;
  }

Modifying all the get methods in CustomerDto class

Do the same for all get methods:

  • getMaxUsers(),
  • getMaxEndDevices(),
  • getMaxEndDevices(),
  • getGeolocationExpirationDate(),
  • getName(),
  • getLogo(),
  • getLinks().

Implementing the toId() method in CustomerDto class

public CustomerDto toId() {
	  CustomerDto customerDto = new CustomerDto();
	  customerDto.setId(this.getId());
	  return customerDto;
  }
}

Creating an abstract class to manage ids and keys

In your project, create an Abstract class:

package io.swagger.test_swagger_java_client;

import io.swagger.client.ApiResponse;

public abstract class AbstractTest {

	protected static Long getIdFromResponse(final ApiResponse<String> response) {
		String header = response.getHeaders().get("Location").get(0);
		Long id = Long.valueOf(header.substring(header.lastIndexOf('/') + 1));
		return id;
	}
	
	protected static String getKeyFromResponse(final ApiResponse<String> response) {
		String header = response.getHeaders().get("Location").get(0);
		String key = header.substring(header.lastIndexOf('/') + 1);
		return key;
	}
}

Testing CreateCustomer and deleteCustomer

package io.swagger.test_swagger_java_client;

import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.LoginApi;
import io.swagger.client.model.JwtDto;
import io.swagger.client.model.UserDto;
import io.swagger.client.ApiResponse;
import io.swagger.client.model.CustomerDto;
import io.swagger.client.api.CustomersApi;
import io.swagger.client.model.PaginatedDto;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;



public class App_CustomerAPITest extends AbstractTest {
	
	public static CustomerDto createCustomer(CustomerDto customerDto, CustomersApi customerInstance) throws ApiException {

		Long id = null;
		
		if(customerDto == null) {
			customerDto = new CustomerDto();
			ApiResponse<String> customerResponse = customerInstance.createCustomerWithHttpInfo(customerDto);
			id = getIdFromResponse(customerResponse);
		} else {
			if (customerDto.getId() == null) {
				ApiResponse<String> customerResponse = customerInstance.createCustomerWithHttpInfo(customerDto);
				id = getIdFromResponse(customerResponse);
			} else {
				id = customerDto.getId();
			}
		}

		assertNotNull(id);
		
		customerDto = customerInstance.getCustomer(id, null);

		return customerDto;
	}

    public static void main(String[] args) throws ApiException {

          long id1 = 0; 	

    	  // Say Hello
          System.out.println("Hello world");
        
          String baseApiUrl = "https://wmcintegration.wanesy.com/";
  	 
  	  int connectTimeout = 60000;

  	  // Create an ApiClient per thread
  	  ApiClient defaultClient = Configuration.getDefaultApiClient();
  	  
  	  defaultClient.setBasePath(baseApiUrl); 	  
  	  defaultClient.setConnectTimeout(connectTimeout);
  	  defaultClient.setDebugging(true);
  	
  	  // login 
  	  
  	  LoginApi loginApi = new LoginApi(defaultClient);
  	  
  	  UserDto body = new UserDto ();
  	  body.setLogin("your_login");
  	  body.setPassword("your_password");
  	  
  	  System.out.println("Login Post");
  	
  	  JwtDto jwt = loginApi.login(body);
	
  	  defaultClient.setApiKey("Bearer " + jwt.getToken());
  	  Configuration.setDefaultApiClient(defaultClient);
  	 
	 //createCustomer
  	 CustomersApi customerInstance = new CustomersApi();
	 CustomerDto customerDto = new CustomerDto();
	 	
  	 try {  
		 	  		
  		 	customerDto.setName("My company");
  		 	customerDto = createCustomer(customerDto, customerInstance);
  		 	id1 = customerDto.getId();
		  	System.out.println("CustomerId="+id1);	
		  	
	  } catch (ApiException e) {
	  	    System.err.println("Exception when calling CustomersApi#createCustomer");
	  	    e.printStackTrace();   
	  }
  	 
	  // getCustomers - a single instance
	  
  	  String sort = ""; // Sort value
	  String pageSize = ""; // Page size value
	  String search = "{\"operand\": \"name\", \"operation\": \"EQ\",	\"values\": [\"My company\"]}"; // Search condition
	  String fields = ""; // List of fields to display
	  String page = ""; // Page number
	  try {
		  PaginatedDto<CustomerDto> paginatedDto =  customerInstance.getCustomers(fields, page, pageSize, search, sort);
	  	  assertEquals(Integer.valueOf(1), paginatedDto.getCount());
	  	  
	  } catch (ApiException e) {
	  	    System.err.println("Exception when calling CustomersApi#applicationCustomersGet");
	  	    e.printStackTrace();
	  }
  	    
	  // getCustomers - all instances
	  PaginatedDto<CustomerDto> responseAll = customerInstance.getCustomers(null, null, null, null, null);
	  assertNotNull (responseAll.getCount());
	  	
	  // deleteCustomer
	  customerInstance.deleteCustomer(id1);
	  
	 System.out.println("Test Done"); 
  }
}
      

Test result:

Hello world
Login Post
--> POST https://wmcintegration.wanesy.com//gms/application/login HTTP/1.1
Content-Type: application/json; charset=utf-8
Content-Length: 150
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java

{"lastName":"","role":"","avatar":"","login":"your_login_here","enabled":false,"firstName":"","password":"your_password_here","validated":false,"phone":"","email":""}
--> END POST (150-byte body)
<-- HTTP/1.1 201  (520ms)
Server: nginx
Date: Mon, 01 Jul 2019 14:43:04 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 230
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1561992184114
OkHttp-Received-Millis: 1561992184259

{"expiredDate":1562028184225,"tokenType":"Bearer","token":"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIwMjgxODR9.Vt3zJL9027MRDrEja4u2Dfg_fcehObHWD6W1ij3EN3s"}
<-- END HTTP (230-byte body)
--> POST https://wmcintegration.wanesy.com//gms/application/customers HTTP/1.1
Content-Type: application/json; charset=utf-8
Content-Length: 77
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIwMjgxODR9.Vt3zJL9027MRDrEja4u2Dfg_fcehObHWD6W1ij3EN3s
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java

{"name":"My company","logo":"","geolocationAuthorized":false,"billing":false}
--> END POST (77-byte body)
<-- HTTP/1.1 201  (46ms)
Server: nginx
Date: Mon, 01 Jul 2019 14:43:04 GMT
Content-Length: 0
Connection: keep-alive
Location: /application/customers/21
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1561992184303
OkHttp-Received-Millis: 1561992184347
<-- END HTTP (0-byte body)
--> GET https://wmcintegration.wanesy.com//gms/application/customers/21 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIwMjgxODR9.Vt3zJL9027MRDrEja4u2Dfg_fcehObHWD6W1ij3EN3s
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (42ms)
Server: nginx
Date: Mon, 01 Jul 2019 14:43:04 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 678
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1561992184360
OkHttp-Received-Millis: 1561992184401

{"maxEndDevices":null,"maxUsers":null,"maxGateways":null,"geolocationExpirationDate":null,"name":"My company","logo":"","links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"21\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"21\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"21\"]}"},{"rel":"rncKpis","href":"/application/customers/21/kpis"},{"rel":"self","href":"/application/customers/21"}],"id":21,"geolocationAuthorized":false,"billing":false}
<-- END HTTP (678-byte body)
CustomerId=21
--> GET https://wmcintegration.wanesy.com//gms/application/customers?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20company%22%5D%7D&sort= HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIwMjgxODR9.Vt3zJL9027MRDrEja4u2Dfg_fcehObHWD6W1ij3EN3s
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (39ms)
Server: nginx
Date: Mon, 01 Jul 2019 14:43:04 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 1166
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1561992184406
OkHttp-Received-Millis: 1561992184445

{"count":1,"pageSize":50,"links":[{"rel":"first","href":"/application/customers?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20company%22%5D%7D&sort="},{"rel":"last","href":"/application/customers?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20company%22%5D%7D&sort="}],"page":1,"totalCount":1,"list":[{"id":21,"name":"My company","logo":"","maxGateways":null,"maxEndDevices":null,"maxUsers":null,"geolocationAuthorized":false,"geolocationExpirationDate":null,"billing":false,"links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"21\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"21\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"21\"]}"},{"rel":"rncKpis","href":"/application/customers/21/kpis"},{"rel":"self","href":"/application/customers/21"}]}],"nbPages":1}
<-- END HTTP (1166-byte body)
--> GET https://wmcintegration.wanesy.com//gms/application/customers HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIwMjgxODR9.Vt3zJL9027MRDrEja4u2Dfg_fcehObHWD6W1ij3EN3s
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (40ms)
Server: nginx
Date: Mon, 01 Jul 2019 14:43:04 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 7604
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1561992184450
OkHttp-Received-Millis: 1561992184490

{"count":11,"pageSize":50,"links":[{"rel":"first","href":"/application/customers?page=1"},{"rel":"last","href":"/application/customers?page=1"}],"page":1,"totalCount":11,"list":[{"id":3,"name":"supervision","logo":null,"maxGateways":1,"maxEndDevices":1,"maxUsers":1,"geolocationAuthorized":false,"geolocationExpirationDate":null,"billing":true,"links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"3\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"3\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"3\"]}"},{"rel":"rncKpis","href":"/application/customers/3/kpis"},{"rel":"self","href":"/application/customers/3"}]},{"id":4,"name":"DoNotDeleteSupervision","logo":null,"maxGateways":1,"maxEndDevices":1,"maxUsers":1,"geolocationAuthorized":false,"geolocationExpirationDate":null,"billing":true,"links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"4\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"4\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"4\"]}"},{"rel":"rncKpis","href":"/application/customers/4/kpis"},{"rel":"self","href":"/application/customers/4"}]},{"id":1,"name":"KERLINK","logo":null,"maxGateways":null,"maxEndDevices":null,"maxUsers":null,"geolocationAuthorized":true,"geolocationExpirationDate":null,"billing":false,"links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"1\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"1\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"1\"]}"},{"rel":"rncKpis","href":"/application/customers/1/kpis"},{"rel":"self","href":"/application/customers/1"}]},{"id":5,"name":"kerlinksg","logo":"","maxGateways":null,"maxEndDevices":null,"maxUsers":null,"geolocationAuthorized":true,"geolocationExpirationDate":null,"billing":false,"links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"5\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"5\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"5\"]}"},{"rel":"rncKpis","href":"/application/customers/5/kpis"},{"rel":"self","href":"/application/customers/5"}]},{"id":6,"name":"ACCORINVEST","logo":"","maxGateways":null,"maxEndDevices":null,"maxUsers":null,"geolocationAuthorized":false,"geolocationExpirationDate":null,"billing":false,"links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"6\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"6\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"6\"]}"},{"rel":"rncKpis","href":"/application/customers/6/kpis"},{"rel":"self","href":"/application/customers/6"}]},{"id":7,"name":"KAS","logo":"","maxGateways":null,"maxEndDevices":null,"maxUsers":null,"geolocationAuthorized":false,"geolocationExpirationDate":null,"billing":false,"links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"7\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"7\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"7\"]}"},{"rel":"rncKpis","href":"/application/customers/7/kpis"},{"rel":"self","href":"/application/customers/7"}]},{"id":8,"name":"KerlinkTraining","logo":"","maxGateways":null,"maxEndDevices":null,"maxUsers":null,"geolocationAuthorized":false,"geolocationExpirationDate":null,"billing":false,"links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"8\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"8\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"8\"]}"},{"rel":"rncKpis","href":"/application/customers/8/kpis"},{"rel":"self","href":"/application/customers/8"}]},{"id":9,"name":"Tanalink","logo":"","maxGateways":null,"maxEndDevices":null,"maxUsers":null,"geolocationAuthorized":true,"geolocationExpirationDate":null,"billing":false,"links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"9\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"9\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"9\"]}"},{"rel":"rncKpis","href":"/application/customers/9/kpis"},{"rel":"self","href":"/application/customers/9"}]},{"id":10,"name":"Sigma3","logo":"","maxGateways":null,"maxEndDevices":null,"maxUsers":null,"geolocationAuthorized":true,"geolocationExpirationDate":1569772800000,"billing":false,"links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"10\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"10\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"10\"]}"},{"rel":"rncKpis","href":"/application/customers/10/kpis"},{"rel":"self","href":"/application/customers/10"}]},{"id":17,"name":"British Telecom","logo":"","maxGateways":10,"maxEndDevices":10,"maxUsers":10,"geolocationAuthorized":false,"geolocationExpirationDate":null,"billing":false,"links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"17\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"17\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"17\"]}"},{"rel":"rncKpis","href":"/application/customers/17/kpis"},{"rel":"self","href":"/application/customers/17"}]},{"id":21,"name":"My company","logo":"","maxGateways":null,"maxEndDevices":null,"maxUsers":null,"geolocationAuthorized":false,"geolocationExpirationDate":null,"billing":false,"links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"21\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"21\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"21\"]}"},{"rel":"rncKpis","href":"/application/customers/21/kpis"},{"rel":"self","href":"/application/customers/21"}]}],"nbPages":1}
<-- END HTTP (7604-byte body)
Test Done
--> DELETE https://wmcintegration.wanesy.com//gms/application/customers/21 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIwMjgxODR9.Vt3zJL9027MRDrEja4u2Dfg_fcehObHWD6W1ij3EN3s
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END DELETE
<-- HTTP/1.1 204  (46ms)
Server: nginx
Date: Mon, 01 Jul 2019 14:43:04 GMT
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1561992184498
OkHttp-Received-Millis: 1561992184542
<-- END HTTP

If we don't execute the deleteCustomer() method, here is the result on the WMC dashboard:



Testing the Fleet API client code


Modifying all the get methods in FleetDto class

Do the same as for CustomerDto class for all get methods:

  • getName(),
  • getLinks(),
  • getId().

Modifying PaginatedDto types

Do the same changes as for CustomerDto class but use these types instead:

Replace By In method
<PaginatedDto> <PaginatedDto<GatewayEventDto» getFleetEvents
<PaginatedDto> <PaginatedDto<GatewayEventDto» getFleetEventsWithHttpInfo
<PaginatedDto> <PaginatedDto<GatewayEventDto» getFleetEventsAsync
<PaginatedDto> <PaginatedDto<GatewayEventDto» getFleetEventsValidateBeforeCall
<PaginatedDto> <PaginatedDto<LastEventDto» getFleetLastEvents
<PaginatedDto> <PaginatedDto<LastEventDto» getFleetLastEventsWithHttpInfo
<PaginatedDto> <PaginatedDto<LastEventDto» getFleetLastEventsAsync
<PaginatedDto> <PaginatedDto<LastEventDto» getFleetLastEventsValidateBeforeCall
<PaginatedDto> <PaginatedDto<LastOperationDto» getFleetLastOperations
<PaginatedDto> <PaginatedDto<LastOperationDto» getFleetLastOperationsWithHttpInfo
<PaginatedDto> <PaginatedDto<LastOperationDto» getFleetLastOperationsAsync
<PaginatedDto> <PaginatedDto<LastOperationDto» getFleetLastOperationsValidateBeforeCall
<PaginatedDto> <PaginatedDto<GatewaysStatisticDto» getFleetLastStatistics
<PaginatedDto> <PaginatedDto<GatewaysStatisticDto» getFleetLastStatisticsWithHttpInfo
<PaginatedDto> <PaginatedDto<GatewaysStatisticDto» getFleetLastStatisticsAsync
<PaginatedDto> <PaginatedDto<GatewaysStatisticDto» getFleetLastStatisticsValidateBeforeCall
<PaginatedDto> <PaginatedDto<FleetDto» getFleets
<PaginatedDto> <PaginatedDto<FleetDto» getFleetsWithHttpInfo
<PaginatedDto> <PaginatedDto<FleetDto» getFleetsAsync
<PaginatedDto> <PaginatedDto<FleetDto» getFleetsValidateBeforeCall

For instance:

 public PaginatedDto getFleetEvents(String endDate, Long id, String startDate, String fields, String page, String pageSize, String type) throws ApiException {
        ApiResponse<PaginatedDto> resp = getFleetEventsWithHttpInfo(endDate, id, startDate, fields, page, pageSize, type);
        return resp.getData();
    }

becomes:

public PaginatedDto<GatewayEventDto> getFleetEvents(final String endDate, final Long id, final String startDate, final String fields, final String page, final String pageSize, final String type) throws ApiException {
        ApiResponse<PaginatedDto<GatewayEventDto>> resp = getFleetEventsWithHttpInfo(endDate, id, startDate, fields, page, pageSize, type);
        return resp.getData();
    }

Don't forget to import the GatewayEventDto class.

import io.swagger.client.model.GatewayEventDto;

Testing CreateCluster, getFleets, getFleet and deleteFleet

package io.swagger.test_swagger_java_client;

import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.LoginApi;
import io.swagger.client.model.JwtDto;
import io.swagger.client.model.UserDto;
import io.swagger.client.ApiResponse;
import io.swagger.client.model.CustomerDto;
import io.swagger.client.api.CustomersApi;
import io.swagger.client.model.FleetDto;
import io.swagger.client.api.FleetsApi;
import io.swagger.client.model.PaginatedDto;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;



public class App_FleetAPITest extends AbstractTest {
	
	public static CustomerDto createCustomer(CustomerDto customerDto, CustomersApi customerInstance) throws ApiException {

		Long id = null;
		
		if(customerDto == null) {
			customerDto = new CustomerDto();
			ApiResponse<String> customerResponse = customerInstance.createCustomerWithHttpInfo(customerDto);
			id = getIdFromResponse(customerResponse);
			customerDto.setId(id);
		} else {
			if (customerDto.getId() == null) {
				ApiResponse<String> customerResponse = customerInstance.createCustomerWithHttpInfo(customerDto);
				id = getIdFromResponse(customerResponse);
				customerDto.setId(id);
			} else {
				id = customerDto.getId();
			}
		}

		assertNotNull(id);
		
		customerDto = customerInstance.getCustomer(id, null);

		return customerDto;
	}
	
	public static FleetDto createFleet(FleetDto fleetDto, FleetsApi fleetInstance, CustomerDto customerDto) throws ApiException {

		Long id = null;
		
		if (customerDto != null) {
			if(fleetDto == null) {
				fleetDto = new FleetDto();
				fleetDto.setCustomer(customerDto.toId());
				ApiResponse<String> fleetResponse = fleetInstance.createFleetWithHttpInfo(fleetDto);
				id = getIdFromResponse(fleetResponse);
			} else {
				if (fleetDto.getId() == null) {				
					fleetDto.setCustomer(customerDto.toId());
					ApiResponse<String> fleetResponse = fleetInstance.createFleetWithHttpInfo(fleetDto);
					id = getIdFromResponse(fleetResponse);
				} else {
					id = fleetDto.getId();
				}
			}
	
			assertNotNull(id);
			
			fleetDto = fleetInstance.getFleet(id, null);
		}
		
		return fleetDto;
	}
	

    public static void main(String[] args) throws ApiException {

      long id1=0, id_fleet=0; 	

      // Say Hello
      System.out.println("Hello world");
        
      String baseApiUrl = "https://wmcintegration.wanesy.com/";
  	  int connectTimeout = 60000;
  	  
  	  // Create an ApiClient per thread
  	  ApiClient defaultClient = Configuration.getDefaultApiClient();
  	  
  	  defaultClient.setBasePath(baseApiUrl); 	  
  	  defaultClient.setConnectTimeout(connectTimeout);
  	  defaultClient.setDebugging(true);
  	
  	  // login 
  	  
  	  LoginApi loginApi = new LoginApi(defaultClient);
  	  
  	  UserDto body = new UserDto ();
  	  body.setLogin("your_login");
  	  body.setPassword("your password");
  	  
  	  System.out.println("Login Post");
  	
  	  JwtDto jwt = loginApi.login(body);
	
  	  defaultClient.setApiKey("Bearer " + jwt.getToken());
  	  Configuration.setDefaultApiClient(defaultClient);
  	 
	 //createCustomer
  	  
  	 CustomersApi customerInstance = new CustomersApi();
	 CustomerDto customerDto = new CustomerDto();
	 	
  	 try {  
		 	  		
  		 	customerDto.setName("My company");  		 	
  		 	customerDto = createCustomer(customerDto, customerInstance);
  		 	id1 = customerDto.getId();
		  	System.out.println("CustomerId="+id1);	
		  	
	  } catch (ApiException e) {
	  	    System.err.println("Exception when calling CustomersApi#createCustomer");
	  	    e.printStackTrace();   
	  }
  	 
	  // getCustomers - a single instance
	  
  	  String sort = ""; // Sort value
	  String pageSize = ""; // Page size value
	  String search = "{\"operand\": \"name\", \"operation\": \"EQ\",	\"values\": [\"My company\"]}"; // Search condition
	  String fields = ""; // List of fields to display
	  String page = ""; // Page number
	  try {
		  PaginatedDto<CustomerDto> paginatedDto =  customerInstance.getCustomers(fields, page, pageSize, search, sort);
	  	  assertEquals(Integer.valueOf(1), paginatedDto.getCount());
	  	  
	  } catch (ApiException e) {
	  	    System.err.println("Exception when calling CustomersApi#applicationCustomersGet");
	  	    e.printStackTrace();
	  }
  	    
	  
	  // createFleet
	  FleetsApi fleetInstance = new FleetsApi();
	  FleetDto fleetDto = new FleetDto();
	  
	  try { 		  
		  
		  fleetDto.setName("My fleet");
		  fleetDto = createFleet(fleetDto, fleetInstance, customerDto);
		  id_fleet = fleetDto.getId();
		  System.out.println("FleetId="+id_fleet);	
	  }
	  catch (ApiException e) {
	  	    System.err.println("Exception when calling FleetsApi#createFleet");
	  	    e.printStackTrace();   
	  }
	  
	  // getFleets
	  
	  sort = ""; // Sort value
	  pageSize = ""; // Page size value
	  search = "{\"operand\": \"name\", \"operation\": \"EQ\",	\"values\": [\"My fleet\"]}"; // Search condition
	  fields = ""; // List of fields to display
	  page = ""; // Page number
	  try {
		  PaginatedDto<FleetDto> paginatedDto =  fleetInstance.getFleets(fields, page, pageSize, search, sort);
	  	  assertEquals(Integer.valueOf(1), paginatedDto.getCount());
	  	  
	  } catch (ApiException e) {
	  	    System.err.println("Exception when calling FleetsApi#getFleets");
	  	    e.printStackTrace();
	  }
  	    
	  // getFleet
	  fleetDto = fleetInstance.getFleet(id_fleet, null);
	  System.out.println("The fleet Id="+id_fleet+" has name \""+fleetDto.getName()+"\"");	
	  
	  // deleteFleet
	  fleetInstance.deleteFleet(id_fleet);
	  System.out.println("The fleet Id="+id_fleet+" has been deleted=");
	  
	  // deleteCustomer
	  customerInstance.deleteCustomer(id1);
	  System.out.println("The customer Id="+id1+" has been deleted");
  }
}
    
    

Test result:

Hello world
Login Post
--> POST https://wmcintegration.wanesy.com//gms/application/login HTTP/1.1
Content-Type: application/json; charset=utf-8
Content-Length: 150
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java

{"lastName":"","role":"","avatar":"","login":"your_login","enabled":false,"firstName":"","password":"your_password","validated":false,"phone":"","email":""}
--> END POST (150-byte body)
<-- HTTP/1.1 201  (529ms)
Server: nginx
Date: Tue, 02 Jul 2019 15:09:25 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 230
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562080165068
OkHttp-Received-Millis: 1562080165190

{"expiredDate":1562116165167,"tokenType":"Bearer","token":"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxMTYxNjV9.1ZdVyOfYt6Jixxu_oAN8eHp-qplqGnwuDj68AQ_Z0Bw"}
<-- END HTTP (230-byte body)
--> POST https://wmcintegration.wanesy.com//gms/application/customers HTTP/1.1
Content-Type: application/json; charset=utf-8
Content-Length: 21
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxMTYxNjV9.1ZdVyOfYt6Jixxu_oAN8eHp-qplqGnwuDj68AQ_Z0Bw
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java

{"name":"My company"}
--> END POST (21-byte body)
<-- HTTP/1.1 201  (41ms)
Server: nginx
Date: Tue, 02 Jul 2019 15:09:25 GMT
Content-Length: 0
Connection: keep-alive
Location: /application/customers/37
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562080165204
OkHttp-Received-Millis: 1562080165243
<-- END HTTP (0-byte body)
--> GET https://wmcintegration.wanesy.com//gms/application/customers/37 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxMTYxNjV9.1ZdVyOfYt6Jixxu_oAN8eHp-qplqGnwuDj68AQ_Z0Bw
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (40ms)
Server: nginx
Date: Tue, 02 Jul 2019 15:09:25 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 680
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562080165251
OkHttp-Received-Millis: 1562080165290

{"maxEndDevices":null,"maxUsers":null,"maxGateways":null,"geolocationExpirationDate":null,"name":"My company","logo":null,"links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"37\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"37\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"37\"]}"},{"rel":"rncKpis","href":"/application/customers/37/kpis"},{"rel":"self","href":"/application/customers/37"}],"id":37,"geolocationAuthorized":false,"billing":false}
<-- END HTTP (680-byte body)
CustomerId=37
--> GET https://wmcintegration.wanesy.com//gms/application/customers?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20company%22%5D%7D&sort= HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxMTYxNjV9.1ZdVyOfYt6Jixxu_oAN8eHp-qplqGnwuDj68AQ_Z0Bw
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (41ms)
Server: nginx
Date: Tue, 02 Jul 2019 15:09:25 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 1168
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562080165296
OkHttp-Received-Millis: 1562080165337

{"count":1,"pageSize":50,"links":[{"rel":"first","href":"/application/customers?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20company%22%5D%7D&sort="},{"rel":"last","href":"/application/customers?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20company%22%5D%7D&sort="}],"page":1,"totalCount":1,"list":[{"id":37,"name":"My company","logo":null,"maxGateways":null,"maxEndDevices":null,"maxUsers":null,"geolocationAuthorized":false,"geolocationExpirationDate":null,"billing":false,"links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"37\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"37\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"37\"]}"},{"rel":"rncKpis","href":"/application/customers/37/kpis"},{"rel":"self","href":"/application/customers/37"}]}],"nbPages":1}
<-- END HTTP (1168-byte body)
--> POST https://wmcintegration.wanesy.com//gms/application/fleets HTTP/1.1
Content-Type: application/json; charset=utf-8
Content-Length: 40
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxMTYxNjV9.1ZdVyOfYt6Jixxu_oAN8eHp-qplqGnwuDj68AQ_Z0Bw
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java

{"name":"My fleet","customer":{"id":37}}
--> END POST (40-byte body)
<-- HTTP/1.1 201  (46ms)
Server: nginx
Date: Tue, 02 Jul 2019 15:09:25 GMT
Content-Length: 0
Connection: keep-alive
Location: /application/fleets/15
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562080165345
OkHttp-Received-Millis: 1562080165390
<-- END HTTP (0-byte body)
--> GET https://wmcintegration.wanesy.com//gms/application/fleets/15 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxMTYxNjV9.1ZdVyOfYt6Jixxu_oAN8eHp-qplqGnwuDj68AQ_Z0Bw
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (43ms)
Server: nginx
Date: Tue, 02 Jul 2019 15:09:25 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 599
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562080165393
OkHttp-Received-Millis: 1562080165436

{"name":"My fleet","links":[{"rel":"customer","href":"/application/customers/37"},{"rel":"fleetEvents","href":"/application/fleets/15/events"},{"rel":"fleetLastEvents","href":"/application/fleets/15/events/last"},{"rel":"fleetLastEventsCounters","href":"/application/fleets/15/events/last/counters"},{"rel":"fleetLastStatistics","href":"/application/fleets/15/lastStatistics"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.id\",\"operation\":\"EQ\",\"values\":[\"15\"]}"},{"rel":"self","href":"/application/fleets/15"}],"id":15,"customer":{"name":"My company","id":37}}
<-- END HTTP (599-byte body)
FleetId=15
--> GET https://wmcintegration.wanesy.com//gms/application/fleets?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20fleet%22%5D%7D&sort= HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxMTYxNjV9.1ZdVyOfYt6Jixxu_oAN8eHp-qplqGnwuDj68AQ_Z0Bw
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (45ms)
Server: nginx
Date: Tue, 02 Jul 2019 15:09:25 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 1077
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562080165440
OkHttp-Received-Millis: 1562080165484

{"count":1,"pageSize":50,"links":[{"rel":"first","href":"/application/fleets?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20fleet%22%5D%7D&sort="},{"rel":"last","href":"/application/fleets?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20fleet%22%5D%7D&sort="}],"page":1,"totalCount":1,"list":[{"id":15,"customer":{"name":"My company","id":37},"name":"My fleet","links":[{"rel":"customer","href":"/application/customers/37"},{"rel":"fleetEvents","href":"/application/fleets/15/events"},{"rel":"fleetLastEvents","href":"/application/fleets/15/events/last"},{"rel":"fleetLastEventsCounters","href":"/application/fleets/15/events/last/counters"},{"rel":"fleetLastStatistics","href":"/application/fleets/15/lastStatistics"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.id\",\"operation\":\"EQ\",\"values\":[\"15\"]}"},{"rel":"self","href":"/application/fleets/15"}]}],"nbPages":1}
<-- END HTTP (1077-byte body)
--> GET https://wmcintegration.wanesy.com//gms/application/fleets/15 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxMTYxNjV9.1ZdVyOfYt6Jixxu_oAN8eHp-qplqGnwuDj68AQ_Z0Bw
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (41ms)
Server: nginx
Date: Tue, 02 Jul 2019 15:09:25 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 599
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562080165487
OkHttp-Received-Millis: 1562080165528

{"name":"My fleet","links":[{"rel":"customer","href":"/application/customers/37"},{"rel":"fleetEvents","href":"/application/fleets/15/events"},{"rel":"fleetLastEvents","href":"/application/fleets/15/events/last"},{"rel":"fleetLastEventsCounters","href":"/application/fleets/15/events/last/counters"},{"rel":"fleetLastStatistics","href":"/application/fleets/15/lastStatistics"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.id\",\"operation\":\"EQ\",\"values\":[\"15\"]}"},{"rel":"self","href":"/application/fleets/15"}],"id":15,"customer":{"name":"My company","id":37}}
<-- END HTTP (599-byte body)
The fleet Id=15 has name "My fleet"
--> DELETE https://wmcintegration.wanesy.com//gms/application/fleets/15 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxMTYxNjV9.1ZdVyOfYt6Jixxu_oAN8eHp-qplqGnwuDj68AQ_Z0Bw
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END DELETE
<-- HTTP/1.1 204  (46ms)
Server: nginx
Date: Tue, 02 Jul 2019 15:09:25 GMT
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562080165531
OkHttp-Received-Millis: 1562080165575
<-- END HTTP
The fleet Id=15 has been deleted=
--> DELETE https://wmcintegration.wanesy.com//gms/application/customers/37 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxMTYxNjV9.1ZdVyOfYt6Jixxu_oAN8eHp-qplqGnwuDj68AQ_Z0Bw
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END DELETE
<-- HTTP/1.1 204  (52ms)
Server: nginx
Date: Tue, 02 Jul 2019 15:09:25 GMT
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562080165578
OkHttp-Received-Millis: 1562080165629
<-- END HTTP
The customer Id=37 has been deleted

If we don't execute the deleteCustomer() and deleteFleet() methods, here is the result on the WMC dashboard:


Testing the Gateway API client code


Modifying all the get methods in GatewayDto class

In ./java_api_client/src/main/java/io/swagger/client/model/GatewayDto.java, add “this” member as done previously for CustomerDto class for all get methods:

  • getFleet(),
  • getAltitude(),
  • getDoor(),
  • getRegion(),
  • getName(),
  • getEui(),
  • getPort(),
  • getMaxTxPower(),
  • getIp(), getGps(),
  • getVisibility(),
  • getNetworkMaxDelayDown(),
  • getLongitude(),
  • getLatitude(),
  • getGpsLatitude(),
  • getGpsLongitude(),
  • getDescription(),
  • getType(),
  • getNetworkMaxDelayUp(),
  • getGatewayKeys(),
  • getBearer(),
  • getLinks(),
  • getId()

Modifying members initialization in GatewayDto class

You must set some values to null instead of empty string in order for these fields to be not included in the REST mesage body. You code must be like this:

public class GatewayDto {

  @SerializedName("fleet")
  private FleetDto fleet = null;

  @SerializedName("altitude")
  private Integer altitude = null;

  @SerializedName("door")
  private String door = null;

  @SerializedName("gpsLongitude")
  private Double gpsLongitude = null;

  @SerializedName("latitude")
  private Double latitude = null;

  @SerializedName("description")
  private String description = null;

  @SerializedName("gpsAltitude")
  private Integer gpsAltitude = null;

  @SerializedName("type")
  private GatewayTypeDto type = null;

  @SerializedName("networkMaxDelayUp")
  private Integer networkMaxDelayUp = null;

  @SerializedName("gatewayKeys")
  private List<LnsGatewayKeyDto> gatewayKeys = null;

  @SerializedName("bearer")
  private String bearer = null;

  @SerializedName("links")
  private List<LinkDto> links = null;

  @SerializedName("connection")
  private Boolean connection = null;

  @SerializedName("gpsLatitude")
  private Double gpsLatitude = null;

  @SerializedName("longitude")
  private Double longitude = null;

  @SerializedName("dlAllowed")
  private Boolean dlAllowed = false;

  @SerializedName("networkMaxDelayDown")
  private Integer networkMaxDelayDown = null;

  @SerializedName("allowGPSPosition")
  private Boolean allowGPSPosition = true;

  @SerializedName("visibility")
  private String visibility = "";

  @SerializedName("gpsPositionAllowed")
  private Boolean gpsPositionAllowed = true;

  @SerializedName("ip")
  private String ip = "";

  @SerializedName("gps")
  private String gps = null;

  @SerializedName("maxTxPower")
  private Integer maxTxPower = null;

  @SerializedName("port")
  private Integer port = null;

  @SerializedName("adaptiveLatencyEnabled")
  private Boolean adaptiveLatencyEnabled = false;

  @SerializedName("eui")
  private String eui = "";

  @SerializedName("name")
  private String name = "";

  @SerializedName("region")
  private String region = "";
  public GatewayDto fleet(FleetDto fleet) {
    this.fleet = fleet;
    return this;
  }

Modifying PaginatedDto types in GatewayApi class

Do the same changes as for GatewaysDto class but use these types instead:

Replace By In method
<PaginatedDto> <PaginatedDto<GatewayConfigurationDto» getGatewayConfigurations
<PaginatedDto> <PaginatedDto<GatewayConfigurationDto» getGatewayConfigurationsWithHttpInfo
<PaginatedDto> <PaginatedDto<GatewayConfigurationDto» getGatewayConfigurationsAsync
<PaginatedDto> <PaginatedDto<GatewayConfigurationDto» getGatewayConfigurationsValidateBeforeCall
<PaginatedDto> <PaginatedDto<GatewayConnectionDto» getGatewayConnections
<PaginatedDto> <PaginatedDto<GatewayConnectionDto» getGatewayConnectionsWithHttpInfo
<PaginatedDto> <PaginatedDto<GatewayConnectionDto» getGatewayConnectionsAsync
<PaginatedDto> <PaginatedDto<GatewayConnectionDto» getGatewayConnectionsValidateBeforeCall
<PaginatedDto> <PaginatedDto<GatewayEventDto» getGatewayEvents
<PaginatedDto> <PaginatedDto<GatewayEventDto» getGatewayEventsWithHttpInfo
<PaginatedDto> <PaginatedDto<GatewayEventDto» getGatewayEventsAsync
<PaginatedDto> <PaginatedDto<GatewayEventDto» getGatewayEventsValidateBeforeCall
<PaginatedDto> <PaginatedDto<LastOperationDto» getGatewayLastOperations
<PaginatedDto> <PaginatedDto<LastOperationDto» getGatewayLastOperationsWithHttpInfo
<PaginatedDto> <PaginatedDto<LastOperationDto» getGatewayLastOperationsAsync
<PaginatedDto> <PaginatedDto<LastOperationDto» getGatewayLastOperationsValidateBeforeCall
<PaginatedDto> <PaginatedDto<LastStatisticDto» getGatewayLastStatistics
<PaginatedDto> <PaginatedDto<LastStatisticDto» getGatewayLastStatisticsWithHttpInfo
<PaginatedDto> <PaginatedDto<LastStatisticDto» getGatewayLastStatisticsAsync
<PaginatedDto> <PaginatedDto<LastStatisticDto» getGatewayLastStatisticsValidateBeforeCall
<PaginatedDto> <PaginatedDto<GatewayNumericStatisticsDto» getGatewayNumericStatistics
<PaginatedDto> <PaginatedDto<GatewayNumericStatisticsDto» getGatewayNumericStatisticsWithHttpInfo
<PaginatedDto> <PaginatedDto<GatewayNumericStatisticsDto» getGatewayNumericStatisticsAsync
<PaginatedDto> <PaginatedDto<GatewayNumericStatisticsDto» getGatewayNumericStatisticsValidateBeforeCall
<PaginatedDto> <PaginatedDto<GatewaySnmpLogDto» getGatewaySnmpLogs
<PaginatedDto> <PaginatedDto<GatewaySnmpLogDto» getGatewaySnmpLogsWithHttpInfo
<PaginatedDto> <PaginatedDto<GatewaySnmpLogDto» getGatewaySnmpLogsAsync
<PaginatedDto> <PaginatedDto<GatewaySnmpLogDto» getGatewaySnmpLogsValidateBeforeCall
<PaginatedDto> <PaginatedDto<GatewayTermStatisticsDto» getGatewayTermStatistics
<PaginatedDto> <PaginatedDto<GatewayTermStatisticsDto» getGatewayTermStatisticsWithHttpInfo
<PaginatedDto> <PaginatedDto<GatewayTermStatisticsDto» getGatewayTermStatisticsAsync
<PaginatedDto> <PaginatedDto<GatewayTermStatisticsDto» getGatewayTermStatisticsValidateBeforeCall
<PaginatedDto> <PaginatedDto<GatewayVersionDto» getGatewayVersions
<PaginatedDto> <PaginatedDto<GatewayVersionDto» getGatewayVersionsWithHttpInfo
<PaginatedDto> <PaginatedDto<GatewayVersionDto» getGatewayVersionsAsync
<PaginatedDto> <PaginatedDto<GatewayVersionDto» getGatewayVersionsValidateBeforeCall
<PaginatedDto> <PaginatedDto<GatewayDto» getGateways
<PaginatedDto> <PaginatedDto<GatewayDto» getGatewaysWithHttpInfo
<PaginatedDto> <PaginatedDto<GatewayDto» getGatewaysAsync
<PaginatedDto> <PaginatedDto<GatewayDto» getGatewaysValidateBeforeCall
<PaginatedDto> <PaginatedDto<GatewayModemStatisticDto» getModemStatistics
<PaginatedDto> <PaginatedDto<GatewayModemStatisticDto» getModemStatisticsWithHttpInfo
<PaginatedDto> <PaginatedDto<GatewayModemStatisticDto» getModemStatisticsAsync
<PaginatedDto> <PaginatedDto<GatewayModemStatisticDto» getModemStatisticsValidateBeforeCall
<PaginatedDto> <PaginatedDto<KpiDto» getRncCustomerGatewayKpi
<PaginatedDto> <PaginatedDto<KpiDto» getRncCustomerGatewayKpiWithHttpInfo
<PaginatedDto> <PaginatedDto<KpiDto» getRncCustomerGatewayKpiAsync
<PaginatedDto> <PaginatedDto<KpiDto» getRncCustomerGatewayKpiValidateBeforeCall
<PaginatedDto> <PaginatedDto<TaskDto» updateGatewaysFirmware
<PaginatedDto> <PaginatedDto<TaskDto» updateGatewaysFirmwareWithHttpInfo
<PaginatedDto> <PaginatedDto<TaskDto» updateGatewaysFirmwareAsync
<PaginatedDto> <PaginatedDto<TaskDto» updateGatewaysFirmwareValidateBeforeCall

For instance:

   public PaginatedDto getGatewayConnections(String eui, String fields, String page, String pageSize, String untilDate) throws ApiException {
        ApiResponse<PaginatedDto> resp = getGatewayConnectionsWithHttpInfo(eui, fields, page, pageSize, untilDate);
        return resp.getData();
    }

becomes:

public PaginatedDto<GatewayConnectionDto> getGatewayConnections(final String eui, final String fields, final String page, final String pageSize, final String untilDate) throws ApiException {
        ApiResponse<PaginatedDto<GatewayConnectionDto>> resp = getGatewayConnectionsWithHttpInfo(eui, fields, page, pageSize, untilDate);
        return resp.getData();
    }

import io.swagger.client.ApiClient;
import io.swagger.client.ApiException;
import io.swagger.client.ApiResponse;
import io.swagger.client.Configuration;
import io.swagger.client.Pair;
import io.swagger.client.ProgressRequestBody;
import io.swagger.client.ProgressResponseBody;
import io.swagger.client.model.GatewayConfigurationDto;
import io.swagger.client.model.GatewayConnectionDto;
import io.swagger.client.model.GatewayControlDto;
import io.swagger.client.model.GatewayDto;
import io.swagger.client.model.GatewayEventDto;
import io.swagger.client.model.GatewayManagementDto;
import io.swagger.client.model.GatewayModemStatisticDto;
import io.swagger.client.model.GatewayNumericStatisticsDto;
import io.swagger.client.model.GatewaySnmpLogDto;
import io.swagger.client.model.GatewayStatisticsDto;
import io.swagger.client.model.GatewayTermStatisticsDto;
import io.swagger.client.model.GatewayVersionDto;
import io.swagger.client.model.KpiDto;
import io.swagger.client.model.LastEventDto;
import io.swagger.client.model.LastOperationDto;
import io.swagger.client.model.LastStatisticDto;
import io.swagger.client.model.LnsGatewayKeyDto;
import io.swagger.client.model.PaginatedDto;
import io.swagger.client.model.ProgressMonitorDto;
import io.swagger.client.model.TaskDto;

Implementing GatewayAPI test code

Add those import derectives:

import io.swagger.client.model.GatewayDto;
import io.swagger.client.api.GatewaysApi;
import io.swagger.client.model.GatewayTypeDto;
import io.swagger.client.api.GatewayTypesApi;

import java.util.List;

Then add following code:

...
  	    
	  // getFleet
	  
	  fleetDto = fleetInstance.getFleet(id_fleet, null);
	  System.out.println("The fleet Id="+id_fleet+" has name \""+fleetDto.getName()+"\"");	
	  
	  
	  // createGateway
	  
	  GatewayTypesApi gatewayTypesInstance = new GatewayTypesApi();
	  List<GatewayTypeDto> types = gatewayTypesInstance.getGatewayTypes(null, null, null);
		
	  GatewayDto gatewayDto = new GatewayDto();
	  gatewayDto.setEui("1231654687987746");
	  gatewayDto.setName("My Gateway");
	  gatewayDto.setRegion("EU868");
	  gatewayDto.setVisibility("PUBLIC");
	  gatewayDto.setAllowGPSPosition(false);
	  gatewayDto.setDlAllowed(true);
	  gatewayDto.setAdaptiveLatencyEnabled(true);
	  gatewayDto.setType(types.get(0));
		
	  gatewayDto.setFleet(fleetDto.toId());
	  
	  GatewaysApi gatewayInstance = new GatewaysApi();
	  gatewayInstance.createGatewayWithHttpInfo(gatewayDto, gatewayDto.getEui());
          System.out.println("The gateway which name is \""+gatewayDto.getName()+"\" has been correctly created");	
          
	  //deleteGateway

	  gatewayInstance.deleteGateway(gatewayDto.getEui());
          System.out.println("The gateway which name is \""+gatewayDto.getName()+"\" has been correctly deleted");	
          
	  // deleteFleet
	  
	  //fleetInstance.deleteFleet(id_fleet);
	  System.out.println("The fleet Id="+id_fleet+" has been deleted");
	  
	  // deleteCustomer
	  
	  //customerInstance.deleteCustomer(id1);
	  System.out.println("The customer Id="+id1+" has been deleted");
  }
}

Test result

Hello world
Login Post
--> POST https://wmcintegration.wanesy.com//gms/application/login HTTP/1.1
Content-Type: application/json; charset=utf-8
Content-Length: 150
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java

{"lastName":"","role":"","avatar":"","login":"your_login","enabled":false,"firstName":"","password":"your_password","validated":false,"phone":"","email":""}
--> END POST (150-byte body)
<-- HTTP/1.1 201  (563ms)
Server: nginx
Date: Wed, 03 Jul 2019 10:18:32 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 230
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562149112481
OkHttp-Received-Millis: 1562149112599

{"expiredDate":1562185112588,"tokenType":"Bearer","token":"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxODUxMTJ9.XI58WNU4yc-7ngkM89b7Gkq5Ucjb7aNseUhGk1UAIMc"}
<-- END HTTP (230-byte body)
--> POST https://wmcintegration.wanesy.com//gms/application/customers HTTP/1.1
Content-Type: application/json; charset=utf-8
Content-Length: 21
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxODUxMTJ9.XI58WNU4yc-7ngkM89b7Gkq5Ucjb7aNseUhGk1UAIMc
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java

{"name":"My company"}
--> END POST (21-byte body)
<-- HTTP/1.1 201  (37ms)
Server: nginx
Date: Wed, 03 Jul 2019 10:18:32 GMT
Content-Length: 0
Connection: keep-alive
Location: /application/customers/43
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562149112611
OkHttp-Received-Millis: 1562149112646
<-- END HTTP (0-byte body)
--> GET https://wmcintegration.wanesy.com//gms/application/customers/43 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxODUxMTJ9.XI58WNU4yc-7ngkM89b7Gkq5Ucjb7aNseUhGk1UAIMc
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (47ms)
Server: nginx
Date: Wed, 03 Jul 2019 10:18:32 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 680
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562149112653
OkHttp-Received-Millis: 1562149112701

{"maxEndDevices":null,"maxUsers":null,"maxGateways":null,"geolocationExpirationDate":null,"name":"My company","logo":null,"links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"43\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"43\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"43\"]}"},{"rel":"rncKpis","href":"/application/customers/43/kpis"},{"rel":"self","href":"/application/customers/43"}],"id":43,"geolocationAuthorized":false,"billing":false}
<-- END HTTP (680-byte body)
The customer Id=43 has been created
--> GET https://wmcintegration.wanesy.com//gms/application/customers?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20company%22%5D%7D&sort= HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxODUxMTJ9.XI58WNU4yc-7ngkM89b7Gkq5Ucjb7aNseUhGk1UAIMc
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (36ms)
Server: nginx
Date: Wed, 03 Jul 2019 10:18:32 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 1168
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562149112706
OkHttp-Received-Millis: 1562149112742

{"count":1,"pageSize":50,"links":[{"rel":"first","href":"/application/customers?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20company%22%5D%7D&sort="},{"rel":"last","href":"/application/customers?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20company%22%5D%7D&sort="}],"page":1,"totalCount":1,"list":[{"id":43,"name":"My company","logo":null,"maxGateways":null,"maxEndDevices":null,"maxUsers":null,"geolocationAuthorized":false,"geolocationExpirationDate":null,"billing":false,"links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"43\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"43\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"43\"]}"},{"rel":"rncKpis","href":"/application/customers/43/kpis"},{"rel":"self","href":"/application/customers/43"}]}],"nbPages":1}
<-- END HTTP (1168-byte body)
--> POST https://wmcintegration.wanesy.com//gms/application/fleets HTTP/1.1
Content-Type: application/json; charset=utf-8
Content-Length: 40
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxODUxMTJ9.XI58WNU4yc-7ngkM89b7Gkq5Ucjb7aNseUhGk1UAIMc
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java

{"name":"My fleet","customer":{"id":43}}
--> END POST (40-byte body)
<-- HTTP/1.1 201  (36ms)
Server: nginx
Date: Wed, 03 Jul 2019 10:18:32 GMT
Content-Length: 0
Connection: keep-alive
Location: /application/fleets/20
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562149112750
OkHttp-Received-Millis: 1562149112785
<-- END HTTP (0-byte body)
--> GET https://wmcintegration.wanesy.com//gms/application/fleets/20 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxODUxMTJ9.XI58WNU4yc-7ngkM89b7Gkq5Ucjb7aNseUhGk1UAIMc
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (36ms)
Server: nginx
Date: Wed, 03 Jul 2019 10:18:32 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 599
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562149112787
OkHttp-Received-Millis: 1562149112823

{"name":"My fleet","links":[{"rel":"customer","href":"/application/customers/43"},{"rel":"fleetEvents","href":"/application/fleets/20/events"},{"rel":"fleetLastEvents","href":"/application/fleets/20/events/last"},{"rel":"fleetLastEventsCounters","href":"/application/fleets/20/events/last/counters"},{"rel":"fleetLastStatistics","href":"/application/fleets/20/lastStatistics"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.id\",\"operation\":\"EQ\",\"values\":[\"20\"]}"},{"rel":"self","href":"/application/fleets/20"}],"id":20,"customer":{"name":"My company","id":43}}
<-- END HTTP (599-byte body)
The fleet Id=20 has been created
--> GET https://wmcintegration.wanesy.com//gms/application/fleets?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20fleet%22%5D%7D&sort= HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxODUxMTJ9.XI58WNU4yc-7ngkM89b7Gkq5Ucjb7aNseUhGk1UAIMc
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (35ms)
Server: nginx
Date: Wed, 03 Jul 2019 10:18:32 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 1077
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562149112827
OkHttp-Received-Millis: 1562149112863

{"count":1,"pageSize":50,"links":[{"rel":"first","href":"/application/fleets?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20fleet%22%5D%7D&sort="},{"rel":"last","href":"/application/fleets?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20fleet%22%5D%7D&sort="}],"page":1,"totalCount":1,"list":[{"id":20,"customer":{"name":"My company","id":43},"name":"My fleet","links":[{"rel":"customer","href":"/application/customers/43"},{"rel":"fleetEvents","href":"/application/fleets/20/events"},{"rel":"fleetLastEvents","href":"/application/fleets/20/events/last"},{"rel":"fleetLastEventsCounters","href":"/application/fleets/20/events/last/counters"},{"rel":"fleetLastStatistics","href":"/application/fleets/20/lastStatistics"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.id\",\"operation\":\"EQ\",\"values\":[\"20\"]}"},{"rel":"self","href":"/application/fleets/20"}]}],"nbPages":1}
<-- END HTTP (1077-byte body)
--> GET https://wmcintegration.wanesy.com//gms/application/fleets/20 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxODUxMTJ9.XI58WNU4yc-7ngkM89b7Gkq5Ucjb7aNseUhGk1UAIMc
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (35ms)
Server: nginx
Date: Wed, 03 Jul 2019 10:18:32 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 599
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562149112865
OkHttp-Received-Millis: 1562149112900

{"name":"My fleet","links":[{"rel":"customer","href":"/application/customers/43"},{"rel":"fleetEvents","href":"/application/fleets/20/events"},{"rel":"fleetLastEvents","href":"/application/fleets/20/events/last"},{"rel":"fleetLastEventsCounters","href":"/application/fleets/20/events/last/counters"},{"rel":"fleetLastStatistics","href":"/application/fleets/20/lastStatistics"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.id\",\"operation\":\"EQ\",\"values\":[\"20\"]}"},{"rel":"self","href":"/application/fleets/20"}],"id":20,"customer":{"name":"My company","id":43}}
<-- END HTTP (599-byte body)
The fleet Id=20 has name "My fleet"
--> GET https://wmcintegration.wanesy.com//gms/application/gatewayTypes HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxODUxMTJ9.XI58WNU4yc-7ngkM89b7Gkq5Ucjb7aNseUhGk1UAIMc
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (33ms)
Server: nginx
Date: Wed, 03 Jul 2019 10:18:32 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 40
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562149112905
OkHttp-Received-Millis: 1562149112938

[{"name":"KERLINK SNMP","id":"KERLINK"}]
<-- END HTTP (40-byte body)
--> PUT https://wmcintegration.wanesy.com//gms/application/gateways/1231654687987746 HTTP/1.1
Content-Type: application/json; charset=utf-8
Content-Length: 265
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIxODUxMTJ9.XI58WNU4yc-7ngkM89b7Gkq5Ucjb7aNseUhGk1UAIMc
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java

{"fleet":{"name":"","id":20},"type":{"name":"KERLINK SNMP","id":"KERLINK"},"dlAllowed":true,"allowGPSPosition":false,"visibility":"PUBLIC","gpsPositionAllowed":true,"ip":"","adaptiveLatencyEnabled":true,"eui":"1231654687987746","name":"My Gateway","region":"EU868"}
--> END PUT (265-byte body)
<-- HTTP/1.1 204  (70ms)
Server: nginx
Date: Wed, 03 Jul 2019 10:18:33 GMT
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562149112966
OkHttp-Received-Millis: 1562149113034
<-- END HTTP
The gateway which name is "My Gateway" has been correctly created

After removing the delete methods, the result should be the following on the WMC dashboard:




Testing the Cluster API client code


package io.swagger.test_swagger_java_client;

import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.LoginApi;
import io.swagger.client.model.JwtDto;
import io.swagger.client.model.UserDto;
import io.swagger.client.ApiResponse;
import io.swagger.client.model.CustomerDto;
import io.swagger.client.api.CustomersApi;
import io.swagger.client.model.ClusterDto;
import io.swagger.client.api.ClustersApi;
import io.swagger.client.model.PaginatedDto;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;



public class App_ClusterAPITest extends AbstractTest {
	
	public static CustomerDto createCustomer(CustomerDto customerDto, CustomersApi customerInstance) throws ApiException {

		Long id = null;
		
		if(customerDto == null) {
			customerDto = new CustomerDto();
			ApiResponse<String> customerResponse = customerInstance.createCustomerWithHttpInfo(customerDto);
			id = getIdFromResponse(customerResponse);
			customerDto.setId(id);
		} else {
			if (customerDto.getId() == null) {
				ApiResponse<String> customerResponse = customerInstance.createCustomerWithHttpInfo(customerDto);
				id = getIdFromResponse(customerResponse);
				customerDto.setId(id);
			} else {
				id = customerDto.getId();
			}
		}

		assertNotNull(id);
		
		customerDto = customerInstance.getCustomer(id, null);

		return customerDto;
	}
	
	public static ClusterDto createCluster(ClusterDto ClusterDto, ClustersApi ClusterInstance, CustomerDto customerDto) throws ApiException {

		Long id = null;
		
		if (customerDto != null) {
			if(ClusterDto == null) {
				ClusterDto = new ClusterDto();
				ClusterDto.setCustomer(customerDto.toId());
				ApiResponse<String> ClusterResponse = ClusterInstance.createClusterWithHttpInfo(ClusterDto);
				id = getIdFromResponse(ClusterResponse);
			} else {
				if (ClusterDto.getId() == null) {				
					ClusterDto.setCustomer(customerDto.toId());
					ApiResponse<String> ClusterResponse = ClusterInstance.createClusterWithHttpInfo(ClusterDto);
					id = getIdFromResponse(ClusterResponse);
				} else {
					id = ClusterDto.getId();
				}
			}
	
			assertNotNull(id);
			
			ClusterDto = ClusterInstance.getCluster(id, null);
		}
		
		return ClusterDto;
	}
	

    public static void main(String[] args) throws ApiException {

      long id1=0, id_Cluster=0; 	

      // Say Hello
      System.out.println("Hello world");
        
      String baseApiUrl = "https://wmcintegration.wanesy.com/";
  	  int connectTimeout = 60000;
  	  
  	  // Create an ApiClient per thread
  	  ApiClient defaultClient = Configuration.getDefaultApiClient();
  	  
  	  defaultClient.setBasePath(baseApiUrl); 	  
  	  defaultClient.setConnectTimeout(connectTimeout);
  	  defaultClient.setDebugging(true);
  	
  	  // login 
  	  
  	  LoginApi loginApi = new LoginApi(defaultClient);
  	  
  	  UserDto body = new UserDto ();
  	  body.setLogin("your_login");
  	  body.setPassword("your_password");
  	  
  	  System.out.println("Login Post");
  	
  	  JwtDto jwt = loginApi.login(body);
	
  	  defaultClient.setApiKey("Bearer " + jwt.getToken());
  	  Configuration.setDefaultApiClient(defaultClient);
  	 
	 //createCustomer
  	  
  	 CustomersApi customerInstance = new CustomersApi();
	 CustomerDto customerDto = new CustomerDto();
	 	
  	 try {  
		 	  		
  		 	customerDto.setName("My company");  		 	
  		 	customerDto = createCustomer(customerDto, customerInstance);
  		 	id1 = customerDto.getId();
		  	System.out.println("CustomerId="+id1);	
		  	
	  } catch (ApiException e) {
	  	    System.err.println("Exception when calling CustomersApi#createCustomer");
	  	    e.printStackTrace();   
	  }
  	 
	  // getCustomers - a single instance
	  
  	  String sort = ""; // Sort value
	  String pageSize = ""; // Page size value
	  String search = "{\"operand\": \"name\", \"operation\": \"EQ\",	\"values\": [\"My company\"]}"; // Search condition
	  String fields = ""; // List of fields to display
	  String page = ""; // Page number
	  try {
		  PaginatedDto<CustomerDto> paginatedDto =  customerInstance.getCustomers(fields, page, pageSize, search, sort);
	  	  assertEquals(Integer.valueOf(1), paginatedDto.getCount());
	  	  
	  } catch (ApiException e) {
	  	    System.err.println("Exception when calling CustomersApi#applicationCustomersGet");
	  	    e.printStackTrace();
	  }
  	    
	  
	  // createCluster
	  ClustersApi ClusterInstance = new ClustersApi();
	  ClusterDto ClusterDto = new ClusterDto();
	  
	  try { 		  
		  
		  ClusterDto.setName("My Cluster");
		  ClusterDto = createCluster(ClusterDto, ClusterInstance, customerDto);
		  id_Cluster = ClusterDto.getId();
		  System.out.println("ClusterId="+id_Cluster);	
	  }
	  catch (ApiException e) {
	  	    System.err.println("Exception when calling ClustersApi#createCluster");
	  	    e.printStackTrace();   
	  }
	  
	  // getClusters
	  
	  sort = ""; // Sort value
	  pageSize = ""; // Page size value
	  search = "{\"operand\": \"name\", \"operation\": \"EQ\",	\"values\": [\"My Cluster\"]}"; // Search condition
	  fields = ""; // List of fields to display
	  page = ""; // Page number
	  try {
		  PaginatedDto<ClusterDto> paginatedDto =  ClusterInstance.getClusters(fields, page, pageSize, search, sort);
	  	  assertEquals(Integer.valueOf(1), paginatedDto.getCount());
	  	  
	  } catch (ApiException e) {
	  	    System.err.println("Exception when calling ClustersApi#getClusters");
	  	    e.printStackTrace();
	  }
  	    
	  // getCluster
	  ClusterDto = ClusterInstance.getCluster(id_Cluster, null);
	  System.out.println("The Cluster Id="+id_Cluster+" has name \""+ClusterDto.getName()+"\"");	
	  
	  // deleteCluster
	  ClusterInstance.deleteCluster(id_Cluster);
	  System.out.println("The Cluster Id="+id_Cluster+" has been deleted=");
	  
	  // deleteCustomer
	  customerInstance.deleteCustomer(id1);
	  System.out.println("The customer Id="+id1+" has been deleted");
  }
}

The result should be on WMC dashboard after removing the delete methods:



Testing the EndDevice API client code


After all changes have been done in EndDeviceDTO and EndDeviceApi classes, here is the client test code:

package io.swagger.test_swagger_java_client;

import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.LoginApi;
import io.swagger.client.model.JwtDto;
import io.swagger.client.model.UserDto;
import io.swagger.client.ApiResponse;
import io.swagger.client.model.CustomerDto;
import io.swagger.client.api.CustomersApi;
import io.swagger.client.model.ClusterDto;
import io.swagger.client.api.ClustersApi;
import io.swagger.client.model.PaginatedDto;
import io.swagger.client.model.EndDeviceDto;
import io.swagger.client.api.EndDevicesApi;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;


public class App_EndDeviceAPITest extends AbstractTest {
	
	public static CustomerDto createCustomer(CustomerDto customerDto, CustomersApi customerInstance) throws ApiException {

		Long id = null;
		
		if(customerDto == null) {
			customerDto = new CustomerDto();
			ApiResponse<String> customerResponse = customerInstance.createCustomerWithHttpInfo(customerDto);
			id = getIdFromResponse(customerResponse);
			customerDto.setId(id);
		} else {
			if (customerDto.getId() == null) {
				ApiResponse<String> customerResponse = customerInstance.createCustomerWithHttpInfo(customerDto);
				id = getIdFromResponse(customerResponse);
				customerDto.setId(id);
			} else {
				id = customerDto.getId();
			}
		}

		assertNotNull(id);
		
		customerDto = customerInstance.getCustomer(id, null);

		return customerDto;
	}
	
	public static ClusterDto createCluster(ClusterDto ClusterDto, ClustersApi ClusterInstance, CustomerDto customerDto) throws ApiException {

		Long id = null;
		
		if (customerDto != null) {
			if(ClusterDto == null) {
				ClusterDto = new ClusterDto();
				ClusterDto.setCustomer(customerDto.toId());
				ApiResponse<String> ClusterResponse = ClusterInstance.createClusterWithHttpInfo(ClusterDto);
				id = getIdFromResponse(ClusterResponse);
			} else {
				if (ClusterDto.getId() == null) {				
					ClusterDto.setCustomer(customerDto.toId());
					ApiResponse<String> ClusterResponse = ClusterInstance.createClusterWithHttpInfo(ClusterDto);
					id = getIdFromResponse(ClusterResponse);
				} else {
					id = ClusterDto.getId();
				}
			}
	
			assertNotNull(id);
			
			ClusterDto = ClusterInstance.getCluster(id, null);
		}
		
		return ClusterDto;
	}

	public static EndDeviceDto createEndDevice(CustomerDto customerDto , ClusterDto clusterDto, EndDeviceDto endDeviceDto, EndDevicesApi endDevicesInstance) throws ApiException {


		if(endDeviceDto == null) {						

			endDeviceDto.setCluster(clusterDto.toId());
			
			ApiResponse<String> clusterResponse = endDevicesInstance.putEndDeviceWithHttpInfo(endDeviceDto, endDeviceDto.getDevEui());

		} else {

			endDeviceDto.setCluster(clusterDto.toId());					
			ApiResponse<String> clusterResponse = endDevicesInstance.putEndDeviceWithHttpInfo(endDeviceDto, endDeviceDto.getDevEui());
		}
							
		assertNotNull(endDeviceDto.getDevEui());

		//get
		endDeviceDto = endDevicesInstance.getEndDevice(endDeviceDto.getDevEui(), null);

		return endDeviceDto;
	}


    public static void main(String[] args) throws ApiException {

      long id1=0, id_Cluster=0; 	

      // Say Hello
      System.out.println("Hello world");
        
      String baseApiUrl = "https://wmcintegration.wanesy.com/";
  	  int connectTimeout = 60000;
  	  
  	  // Create an ApiClient per thread
  	  ApiClient defaultClient = Configuration.getDefaultApiClient();
  	  
  	  defaultClient.setBasePath(baseApiUrl); 	  
  	  defaultClient.setConnectTimeout(connectTimeout);
  	  defaultClient.setDebugging(true);
  	
  	  // login 
  	  
  	  LoginApi loginApi = new LoginApi(defaultClient);
  	  
  	  UserDto body = new UserDto ();
  	  body.setLogin("your_login");
  	  body.setPassword("your_password");
  	  
  	  System.out.println("Login Post");
  	
  	  JwtDto jwt = loginApi.login(body);
	
  	  defaultClient.setApiKey("Bearer " + jwt.getToken());
  	  Configuration.setDefaultApiClient(defaultClient);
  	 
	 //createCustomer
  	  
  	 CustomersApi customerInstance = new CustomersApi();
	 CustomerDto customerDto = new CustomerDto();
	 	
  	 try {  
		 	  		
  		 	customerDto.setName("My company");  		 	
  		 	customerDto = createCustomer(customerDto, customerInstance);
  		 	id1 = customerDto.getId();
		  	System.out.println("CustomerId="+id1);	
		  	
	  } catch (ApiException e) {
	  	    System.err.println("Exception when calling CustomersApi#createCustomer");
	  	    e.printStackTrace();   
	  }
  	 
	  // getCustomers - a single instance
	  
  	  String sort = ""; // Sort value
	  String pageSize = ""; // Page size value
	  String search = "{\"operand\": \"name\", \"operation\": \"EQ\",	\"values\": [\"My company\"]}"; // Search condition
	  String fields = ""; // List of fields to display
	  String page = ""; // Page number
	  try {
		  PaginatedDto<CustomerDto> paginatedDto =  customerInstance.getCustomers(fields, page, pageSize, search, sort);
	  	  assertEquals(Integer.valueOf(1), paginatedDto.getCount());
	  	  
	  } catch (ApiException e) {
	  	    System.err.println("Exception when calling CustomersApi#applicationCustomersGet");
	  	    e.printStackTrace();
	  }
  	    
	  
	  // createCluster
	  ClustersApi clusterInstance = new ClustersApi();
	  ClusterDto clusterDto = new ClusterDto();
	  
	  try { 		  
		  
		  clusterDto.setName("My Cluster");
		  clusterDto = createCluster(clusterDto, clusterInstance, customerDto);
		  id_Cluster = clusterDto.getId();
		  System.out.println("ClusterId="+id_Cluster);	
	  }
	  catch (ApiException e) {
	  	    System.err.println("Exception when calling ClustersApi#createCluster");
	  	    e.printStackTrace();   
	  }
	  
	  // getClusters
	  
	  sort = ""; // Sort value
	  pageSize = ""; // Page size value
	  search = "{\"operand\": \"name\", \"operation\": \"EQ\",	\"values\": [\"My Cluster\"]}"; // Search condition
	  fields = ""; // List of fields to display
	  page = ""; // Page number
	  try {
		  PaginatedDto<ClusterDto> paginatedDto =  clusterInstance.getClusters(fields, page, pageSize, search, sort);
	  	  assertEquals(Integer.valueOf(1), paginatedDto.getCount());
	  	  
	  } catch (ApiException e) {
	  	    System.err.println("Exception when calling ClustersApi#getClusters");
	  	    e.printStackTrace();
	  }
  	    
	  // getCluster
	  
	  clusterDto = clusterInstance.getCluster(id_Cluster, null);
	  System.out.println("The Cluster Id="+id_Cluster+" has name \""+clusterDto.getName()+"\"");	
	  
	  // CreateEndDevice
	  
	  EndDevicesApi endDevicesInstance = new EndDevicesApi();
	  EndDeviceDto endDeviceDto = new EndDeviceDto();
	  endDeviceDto = new EndDeviceDto();
	  endDeviceDto.setName("My end-device");
	  endDeviceDto.setProfile("walking");
	  endDeviceDto.setClassType("A");
	  endDeviceDto.setAdrEnabled(true);
	  endDeviceDto.setRfRegion("EU868");
	  endDeviceDto.setMacVersion("1.0.1");
	  endDeviceDto.setRegParamsRevision("");
		
	  endDeviceDto.setActivation("ABP");
	  endDeviceDto.setDevEui("1234567897894561");
	  endDeviceDto.setAppSKey("12345678978945612345678945612345");
	  endDeviceDto.setNwkSKey("12345678978945612345678945612345");
	  endDeviceDto.setDevAddr("12345678");
	  endDeviceDto.setGeolocation("Inherited");
	  createEndDevice(customerDto , clusterDto, endDeviceDto, endDevicesInstance);
	  
	  //deleteEndDevice
	  
	  endDevicesInstance.deleteEndDevice(endDeviceDto.getDevEui());
	  System.out.println("The EndDevice DevEui="+endDeviceDto.getDevEui()+" has been deleted=");
	  
	  // deleteCluster
	  
	  clusterInstance.deleteCluster(id_Cluster);
	  System.out.println("The Cluster Id="+id_Cluster+" has been deleted=");
	  
	  // deleteCustomer
	  
	  customerInstance.deleteCustomer(id1);
	  System.out.println("The customer Id="+id1+" has been deleted");
  }
}
    
    

Test result:

Hello world
Login Post
--> POST https://wmcintegration.wanesy.com//gms/application/login HTTP/1.1
Content-Type: application/json; charset=utf-8
Content-Length: 150
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java

{"lastName":"","role":"","avatar":"","login":"your_login","enabled":false,"firstName":"","password":"your_password","validated":false,"phone":"","email":""}
--> END POST (150-byte body)
<-- HTTP/1.1 201  (826ms)
Server: nginx
Date: Thu, 04 Jul 2019 14:27:08 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 230
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562250428039
OkHttp-Received-Millis: 1562250428164

{"expiredDate":1562286428135,"tokenType":"Bearer","token":"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIyODY0Mjh9.U4guqiWANuofbF9r7hIC27RSM84glujzfkt7-a-UIeo"}
<-- END HTTP (230-byte body)
--> POST https://wmcintegration.wanesy.com//gms/application/customers HTTP/1.1
Content-Type: application/json; charset=utf-8
Content-Length: 21
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIyODY0Mjh9.U4guqiWANuofbF9r7hIC27RSM84glujzfkt7-a-UIeo
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java

{"name":"My company"}
--> END POST (21-byte body)
<-- HTTP/1.1 201  (40ms)
Server: nginx
Date: Thu, 04 Jul 2019 14:27:08 GMT
Content-Length: 0
Connection: keep-alive
Location: /application/customers/60
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562250428188
OkHttp-Received-Millis: 1562250428226
<-- END HTTP (0-byte body)
--> GET https://wmcintegration.wanesy.com//gms/application/customers/60 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIyODY0Mjh9.U4guqiWANuofbF9r7hIC27RSM84glujzfkt7-a-UIeo
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (38ms)
Server: nginx
Date: Thu, 04 Jul 2019 14:27:08 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 680
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562250428241
OkHttp-Received-Millis: 1562250428279

{"maxEndDevices":null,"maxUsers":null,"maxGateways":null,"geolocationExpirationDate":null,"name":"My company","logo":null,"links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"60\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"60\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"60\"]}"},{"rel":"rncKpis","href":"/application/customers/60/kpis"},{"rel":"self","href":"/application/customers/60"}],"id":60,"geolocationAuthorized":false,"billing":false}
<-- END HTTP (680-byte body)
CustomerId=60
--> GET https://wmcintegration.wanesy.com//gms/application/customers?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20company%22%5D%7D&sort= HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIyODY0Mjh9.U4guqiWANuofbF9r7hIC27RSM84glujzfkt7-a-UIeo
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (39ms)
Server: nginx
Date: Thu, 04 Jul 2019 14:27:08 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 1168
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562250428300
OkHttp-Received-Millis: 1562250428339

{"count":1,"pageSize":50,"links":[{"rel":"first","href":"/application/customers?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20company%22%5D%7D&sort="},{"rel":"last","href":"/application/customers?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20company%22%5D%7D&sort="}],"page":1,"totalCount":1,"list":[{"id":60,"name":"My company","logo":null,"maxGateways":null,"maxEndDevices":null,"maxUsers":null,"geolocationAuthorized":false,"geolocationExpirationDate":null,"billing":false,"links":[{"rel":"clusters","href":"/application/clusters?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"60\"]}"},{"rel":"fleets","href":"/application/fleets?search={\"operand\":\"customer.id\",\"operation\":\"EQ\",\"values\":[\"60\"]}"},{"rel":"gateways","href":"/application/gateways?search={\"operand\":\"fleet.customer.id\",\"operation\":\"EQ\",\"values\":[\"60\"]}"},{"rel":"rncKpis","href":"/application/customers/60/kpis"},{"rel":"self","href":"/application/customers/60"}]}],"nbPages":1}
<-- END HTTP (1168-byte body)
--> POST https://wmcintegration.wanesy.com//gms/application/clusters HTTP/1.1
Content-Type: application/json; charset=utf-8
Content-Length: 42
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIyODY0Mjh9.U4guqiWANuofbF9r7hIC27RSM84glujzfkt7-a-UIeo
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java

{"name":"My Cluster","customer":{"id":60}}
--> END POST (42-byte body)
<-- HTTP/1.1 201  (42ms)
Server: nginx
Date: Thu, 04 Jul 2019 14:27:08 GMT
Content-Length: 0
Connection: keep-alive
Location: /application/clusters/25
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562250428364
OkHttp-Received-Millis: 1562250428404
<-- END HTTP (0-byte body)
--> GET https://wmcintegration.wanesy.com//gms/application/clusters/25 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIyODY0Mjh9.U4guqiWANuofbF9r7hIC27RSM84glujzfkt7-a-UIeo
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (38ms)
Server: nginx
Date: Thu, 04 Jul 2019 14:27:08 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 496
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562250428423
OkHttp-Received-Millis: 1562250428463

{"pushConfiguration":null,"hexa":false,"name":"My Cluster","pushEnabled":false,"geolocEnabled":false,"links":[{"rel":"clusterLastEvents","href":"/application/clusters/25/events/last"},{"rel":"customer","href":"/application/customers/60"},{"rel":"endDevices","href":"/application/endDevices?search={\"operand\":\"cluster.id\",\"operation\":\"EQ\",\"values\":[\"25\"]}"},{"rel":"self","href":"/application/clusters/25"}],"id":25,"customer":{"name":"My company","id":60},"geolocExpirationDate":null}
<-- END HTTP (496-byte body)
ClusterId=25
--> GET https://wmcintegration.wanesy.com//gms/application/clusters?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20Cluster%22%5D%7D&sort= HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIyODY0Mjh9.U4guqiWANuofbF9r7hIC27RSM84glujzfkt7-a-UIeo
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (38ms)
Server: nginx
Date: Thu, 04 Jul 2019 14:27:08 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 982
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562250428468
OkHttp-Received-Millis: 1562250428506

{"count":1,"pageSize":50,"links":[{"rel":"first","href":"/application/clusters?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20Cluster%22%5D%7D&sort="},{"rel":"last","href":"/application/clusters?fields=&page=&pageSize=&search=%7B%22operand%22%3A%20%22name%22%2C%20%22operation%22%3A%20%22EQ%22%2C%09%22values%22%3A%20%5B%22My%20Cluster%22%5D%7D&sort="}],"page":1,"totalCount":1,"list":[{"id":25,"customer":{"name":"My company","id":60},"name":"My Cluster","pushEnabled":false,"pushConfiguration":null,"geolocEnabled":false,"geolocExpirationDate":null,"hexa":false,"links":[{"rel":"clusterLastEvents","href":"/application/clusters/25/events/last"},{"rel":"customer","href":"/application/customers/60"},{"rel":"endDevices","href":"/application/endDevices?search={\"operand\":\"cluster.id\",\"operation\":\"EQ\",\"values\":[\"25\"]}"},{"rel":"self","href":"/application/clusters/25"}]}],"nbPages":1}
<-- END HTTP (982-byte body)
--> GET https://wmcintegration.wanesy.com//gms/application/clusters/25 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIyODY0Mjh9.U4guqiWANuofbF9r7hIC27RSM84glujzfkt7-a-UIeo
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (37ms)
Server: nginx
Date: Thu, 04 Jul 2019 14:27:08 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 496
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562250428509
OkHttp-Received-Millis: 1562250428546

{"pushConfiguration":null,"hexa":false,"name":"My Cluster","pushEnabled":false,"geolocEnabled":false,"links":[{"rel":"clusterLastEvents","href":"/application/clusters/25/events/last"},{"rel":"customer","href":"/application/customers/60"},{"rel":"endDevices","href":"/application/endDevices?search={\"operand\":\"cluster.id\",\"operation\":\"EQ\",\"values\":[\"25\"]}"},{"rel":"self","href":"/application/clusters/25"}],"id":25,"customer":{"name":"My company","id":60},"geolocExpirationDate":null}
<-- END HTTP (496-byte body)
The Cluster Id=25 has name "My Cluster"
--> PUT https://wmcintegration.wanesy.com//gms/application/endDevices/1234567897894561 HTTP/1.1
Content-Type: application/json; charset=utf-8
Content-Length: 345
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIyODY0Mjh9.U4guqiWANuofbF9r7hIC27RSM84glujzfkt7-a-UIeo
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java

{"devAddr":"12345678","cluster":{"id":25},"appSKey":"12345678978945612345678945612345","nwkSKey":"12345678978945612345678945612345","devEui":"1234567897894561","adrEnabled":true,"rfRegion":"EU868","profile":"walking","regParamsRevision":"","name":"My end-device","macVersion":"1.0.1","activation":"ABP","classType":"A","geolocation":"Inherited"}
--> END PUT (345-byte body)
<-- HTTP/1.1 201  (48ms)
Server: nginx
Date: Thu, 04 Jul 2019 14:27:08 GMT
Content-Length: 0
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562250428561
OkHttp-Received-Millis: 1562250428607
<-- END HTTP (0-byte body)
--> GET https://wmcintegration.wanesy.com//gms/application/endDevices/1234567897894561 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZGEiLCJyb2xlIjoiU1VQRVJfQURNSU4iLCJjdXN0b21lcklkIjoxLCJpc3MiOiJnbXMiLCJleHAiOjE1NjIyODY0Mjh9.U4guqiWANuofbF9r7hIC27RSM84glujzfkt7-a-UIeo
Accept: application/json
User-Agent: Swagger-Codegen/1.0.0/java
--> END GET
<-- HTTP/1.1 200  (37ms)
Server: nginx
Date: Thu, 04 Jul 2019 14:27:08 GMT
Content-Type: application/json; qs=0;charset=UTF-8
Content-Length: 2332
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Expose-Headers: Location
OkHttp-Sent-Millis: 1562250428614
OkHttp-Received-Millis: 1562250428650

{"devAddr":"12345678","cluster":{"name":"My Cluster","links":[{"rel":"clusterLastEvents","href":"/application/clusters/25/events/last"},{"rel":"customer","href":"/application/customers/60"},{"rel":"endDevices","href":"/application/endDevices?search={\"operand\":\"cluster.id\",\"operation\":\"EQ\",\"values\":[\"25\"]}"},{"rel":"self","href":"/application/clusters/25"}],"id":25},"altitude":null,"appSKey":"12345678978945612345678945612345","pingSlotFreq":null,"nwkSKey":"12345678978945612345678945612345","latitude":null,"fcntUp":0,"devEui":"1234567897894561","fNwkSIntKey":null,"adrEnabled":true,"cfList":null,"lastDataUpDate":null,"appKey":null,"links":[{"rel":"cluster","href":"/application/clusters/25"},{"rel":"createMacCommand","href":"/application/endDevices/1234567897894561/macCommands"},{"rel":"customer","href":"/application/customers/60"},{"rel":"dataDown","href":"/application/dataDown?search={\"operand\":\"endDevice.devEui\",\"operation\":\"EQ\",\"values\":[\"1234567897894561\"]}"},{"rel":"dataUp","href":"/application/dataUp?search={\"operand\":\"endDevice.devEui\",\"operation\":\"EQ\",\"values\":[\"1234567897894561\"]}"},{"rel":"endDeviceEvents","href":"/application/endDevices/1234567897894561/events"},{"rel":"endDeviceGatewaysPositions","href":"/application/endDevices/1234567897894561/positions/gateways"},{"rel":"endDeviceLastEvents","href":"/application/endDevices/1234567897894561/events/last"},{"rel":"endDeviceLastGateways","href":"/application/endDevices/1234567897894561/gateways/last"},{"rel":"endDeviceMessages","href":"/application/endDevices/1234567897894561/messages"},{"rel":"endDevicePositions","href":"/application/endDevices/1234567897894561/positions"},{"rel":"resetEndDeviceFrameCounters","href":"/application/endDevices/1234567897894561/resetFrameCounters"},{"rel":"rncKpis","href":"/application/endDevices/1234567897894561/kpis"},{"rel":"self","href":"/application/endDevices/1234567897894561"}],"rx1DrOffset":null,"longitude":null,"pingSlotDr":null,"rx1Delay":null,"rfRegion":"EU868","profile":"WALKING","rx2Dr":null,"rx2Freq":null,"lastDataDownDate":null,"sNwkSIntKey":null,"rxWindows":null,"regParamsRevision":"","name":"My end-device","appEui":null,"fcntDown":0,"activation":"ABP","macVersion":"1.0.1","classType":"A","dwellTime":null,"geolocation":"INHERITED","status":"NEVER_SEEN"}
<-- END HTTP (2332-byte body)

The result on the WMC dashboard (after removing the delete methods):



Ressources

wiki/wiki3/swagger_codegen.txt · Last modified: 2020/04/07 17:19 by tda