inwx / java-client Goto Github PK
View Code? Open in Web Editor NEWINWX Domrobot Java Client
Home Page: https://www.inwx.com/en/
License: MIT License
INWX Domrobot Java Client
Home Page: https://www.inwx.com/en/
License: MIT License
Good day
can you please support me with one issue?
I am getting the error message Code: 2004 message: Parameter value range error.
How I can validate with which parameter I have an issue
Most weird that when I register another domain with the same parameters I do not get this error
regards
Bohdan
I am trying to use the java client in a scala application.
What happens:
Login works. Create contact doesn't work. Error message 2400 - Command failed
is returned.
Expected behaviour:
Contact will be created.
My Code:
private val username = settings.inwx.username
private val password = settings.inwx.password
private val url = if (settings.inwx.live) ApiClient.LIVE_URL else ApiClient.OTE_URL
private val debugMode = settings.inwx.debugMode
/**
* Create a new INWX contact
* Compare https://github.com/inwx/java-client
*
* @return
*/
def createInwxContact(userEntity: UserEntity): Unit = {
val client: ApiClient = new ApiClient(url, debugMode)
val loginResponse: BasicResponse = client.login(username, password)
if (!loginResponse.wasSuccessful) {
throw new Exception("INWX login failed")
}
val requestParameters: JsonObject = new JsonObject
requestParameters.addProperty("type", "PERSON")
requestParameters.addProperty("name", s"${userEntity.name}".trim)
requestParameters.addProperty("street", s"${userEntity.street.map(_.value).get}")
requestParameters.addProperty("city", s"${userEntity.city.map(_.value).get}")
requestParameters.addProperty("pc", s"${userEntity.postalCode.map(_.value).get}")
requestParameters.addProperty("cc", s"${userEntity.countryCode.map(_.value).get}")
requestParameters.addProperty("voice", s"+49.${userEntity.phone.map(_.value).get}")
requestParameters.addProperty("email", s"${userEntity.email.value}")
val response: BasicResponse = client.callApi("contact.create", requestParameters)
if (!response.wasSuccessful) {
client.logout
throw new Exception("INWX user couldn't be created")
}
client.logout
()
}
Logfile:
Request (account.login): {
"method": "account.login",
"params": {
"user": "myCompany",
"pass": "myPassword"
}
}
Response (account.login): {
"code": 1000,
"msg": "Command completed successfully",
"resData": {
"customerId": 00000, // id changed for privacy
"accountId": 00000, // id changed for privacy
"tfa": "0",
"builddate": "2017",
"version": "1"
}
}
Request (contact.create): {
"method": "contact.create",
"params": {
"type": "PERSON",
"name": "Test User",
"street": "MyStreet",
"city": "MyCity",
"pc": "MyPostalCode",
"cc": "MyCountryCode",
"voice": "+1.23324",
"email": "[email protected]",
"forceNew": true
}
}
Response (contact.create): {
"code": 2400,
"msg": "Command failed"
}
Taking the request parameters from the debug log and plugging them into postman works just fine, even if this strange formatting for voice
seems to be required, which is not in the documentation or the ajax endpoint.
Might also be interesting: The check domain endpoint does work with this client. I have not tried any other endpoints so far.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.