latest
Models
Powered By GitBook
IONOS Cloud Java SDK

Overview

The IONOS Cloud SDK for Java provides you with access to the IONOS Cloud API. The client library supports both simple and complex requests. It is designed for developers who are building applications in Java . The SDK for Java wraps the IONOS Cloud API. All API operations are performed over SSL and authenticated using your IONOS Cloud portal credentials. The API can be accessed within an instance running in IONOS Cloud or directly over the Internet from any application that can send an HTTPS request and receive an HTTPS response.

Getting Started

Installation

To install the API client library to your local Maven repository, simply execute:
1
mvn clean install
Copied!
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
1
mvn clean deploy
Copied!
Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:
1
<dependency>
2
<groupId>com.ionoscloud</groupId>
3
<artifactId>ionos-cloud-sdk</artifactId>
4
<version>5.1.0-SNAPSHOT</version>
5
<scope>compile</scope>
6
</dependency>
Copied!
Also make sure to add the snapshot repository to your project's POM:
1
<repositories>
2
<repository>
3
<id>oss.sonatype.org-snapshot</id>
4
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
5
<releases>
6
<enabled>false</enabled>
7
</releases>
8
<snapshots>
9
<enabled>true</enabled>
10
</snapshots>
11
</repository>
12
</repositories>
Copied!

Gradle users

Add this dependency to your project's build file:
1
compile "com.ionoscloud:ionos-cloud-sdk:5.1.0-SNAPSHOT"
Copied!

Others

At first generate the JAR by executing:
1
mvn clean package
Copied!
Then manually install the following JARs:
    target/ionos-cloud-sdk-5.1.0-SNAPSHOT.jar
    target/lib/*.jar

Usage

1
// Import classes:
2
import com.ionoscloud.ApiClient;
3
import com.ionoscloud.ApiException;
4
import com.ionoscloud.Configuration;
5
import com.ionoscloud.auth.*;
6
import com.ionoscloud.model.*;
7
import com.ionoscloud.api.DataCenterApi;
8
9
public class Example {
10
public static void main(String[] args) {
11
ApiClient defaultClient = Configuration.getDefaultApiClient();
12
13
// Configure HTTP basic authorization: Basic Authentication
14
HttpBasicAuth basicAuthentication = (HttpBasicAuth) defaultClient.getAuthentication("Basic Authentication");
15
basicAuthentication.setUsername("YOUR USERNAME");
16
basicAuthentication.setPassword("YOUR PASSWORD");
17
18
19
DataCenterApi apiInstance = new DataCenterApi(defaultClient);
20
Boolean pretty = true; // Boolean | Controls whether response is pretty-printed (with indentation and new lines)
21
Integer depth = 0; // Integer | Controls the details depth of response objects. Eg. GET /datacenters/[ID] - depth=0: only direct properties are included. Children (servers etc.) are not included - depth=1: direct properties and children references are included - depth=2: direct properties and children properties are included - depth=3: direct properties and children properties and children's children are included - depth=... and so on
22
Integer xContractNumber = 56; // Integer | Users having more than 1 contract need to provide contract number, against which all API requests should be executed
23
Integer offset = 0; // Integer | the first element (of the total list of elements) to include in the response (use together with <code>limit</code> for pagination)
24
Integer limit = 1000; // Integer | the maximum number of elements to return (use together with <code>offset</code> for pagination)
25
try {
26
Datacenters result = apiInstance.datacentersGet(pretty, depth, xContractNumber, offset, limit);
27
System.out.println(result);
28
} catch (ApiException e) {
29
System.err.println("Exception when calling DataCenterApi#datacentersGet");
30
System.err.println("Status code: " + e.getCode());
31
System.err.println("Reason: " + e.getResponseBody());
32
System.err.println("Response headers: " + e.getResponseHeaders());
33
e.printStackTrace();
34
}
35
}
36
}
Copied!

Feature Reference

The IONOS Cloud SDK for JAVA aims to offer access to all resources in the IONOS Cloud API and also offers some additional features that make the integration easier:
    authentication for API calls
    handling of asynchronous requests

FAQ

    How can I open a bug/feature request? Bugs & feature requests can be open on the repository issues: https://github.com/ionos-cloud/sdk-java/issues/new/choose
    Can I contribute to the Java SDK? Pur SDKs are automatically generated using OpenAPI Generator and don’t support manual changes. If you need changes please open an issue and we’ll try to take care of it.
Last modified 1mo ago