Skip to content

Commit 49a0773

Browse files
authored
Create the best Readme in the history of Readmes
1 parent 13e15d2 commit 49a0773

1 file changed

Lines changed: 109 additions & 0 deletions

File tree

README.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<p align="center">
2+
<a href="https://www.inwx.com/en/" target="_blank">
3+
<img src="https://images.inwx.com/logos/inwx.png">
4+
</a>
5+
</p>
6+
7+
INWX Domrobot Java Client
8+
=========
9+
You can access all functions of our frontend via our API, which is available via the JSON-RPC protocol and thus can be easily consumed with all programming languages.
10+
11+
There is also an OT&E test system, which you can access via [ote.inwx.com](https://ote.inwx.com/en/). Here you will find the known web interface which is using a test database. On the OT&E system no actions will be charged. So you can test as much as you like there.
12+
13+
Documentation
14+
------
15+
You can view a detailed description of the API functions in our documentation. You can find the online documentation [by clicking here](https://www.inwx.de/en/help/apidoc).
16+
17+
If you still experience any kind of problems don't hesitate to contact our [support via email](mailto:support@inwx.de).
18+
19+
Installation
20+
-------
21+
Currently you have to publish the gradle project to your local repository.
22+
23+
#### Build the project and publish it to your local maven repository:
24+
```bash
25+
./gradlew publishToMavenLocal
26+
```
27+
28+
#### Add the domrobot as a dependency:
29+
30+
If you use gradle:
31+
```gradle
32+
compile 'com.inwx.domrobot:java-client:3.0'
33+
```
34+
35+
Or if you use maven:
36+
```xml
37+
<dependency>
38+
<groupId>com.inwx.domrobot</groupId>
39+
<artifactId>java-client</artifactId>
40+
<version>3.0</version>
41+
</dependency>
42+
```
43+
44+
We are working on getting it into the official maven repository.
45+
46+
Example
47+
-------
48+
49+
```java
50+
package com.inwx.domrobot;
51+
52+
import com.google.gson.JsonObject;
53+
import com.inwx.domrobot.model.BasicResponse;
54+
55+
public class DomaincheckExample {
56+
57+
public static void main(String[] args) throws Exception {
58+
59+
String username = "";
60+
String password = "";
61+
String sharedSecret = "";
62+
String domain = "my-test-domain-which-is-definitely-not-registered6737.com";
63+
64+
// By default the ApiClient uses the test api (OT&E). If you want to use the production/live api
65+
// we have a constant named LIVE_URL in the ApiClient class you can use.
66+
ApiClient client = new ApiClient(ApiClient.OTE_URL, true);
67+
68+
BasicResponse loginResponse = client.login(username, password, sharedSecret);
69+
if (!loginResponse.wasSuccessful()) {
70+
throw new Exception("Api login error. Code: " + loginResponse.getCode()
71+
+ ", Message: " + loginResponse.getMsg());
72+
}
73+
74+
// Create an object with all parameters for the request.
75+
JsonObject requestParameters = new JsonObject();
76+
requestParameters.addProperty("domain", domain);
77+
78+
BasicResponse response = client.callApi("domain.check", requestParameters);
79+
80+
if (!response.wasSuccessful()) {
81+
client.logout();
82+
throw new Exception("Api error while checking the domain status. Code: " + response.getCode()
83+
+ ", Message: " + response.getMsg());
84+
}
85+
86+
// get the first domain in the result array 'domain'
87+
JsonObject domainObject = response.getResData()
88+
.get("domain")
89+
.getAsJsonArray().get(0)
90+
.getAsJsonObject();
91+
92+
// when avail is 1 the domain is available, when it's 0 its not available
93+
if (domainObject.get("avail").getAsInt() != 0) {
94+
System.out.println(domain + " is still available!");
95+
} else {
96+
System.out.println("Unfortunately, " + domain + " is already registered.");
97+
}
98+
99+
client.logout();
100+
}
101+
}
102+
```
103+
104+
You can also have a look at the [examples folder](examples) in the project for even more info.
105+
106+
License
107+
----
108+
109+
MIT

0 commit comments

Comments
 (0)