Giter Site home page Giter Site logo

java-client's People

Contributors

ddmler avatar kekskurse avatar nickufer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

java-client's Issues

Error Code: 2004, Message: Parameter value range error

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

Create Contact call does not work

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.