Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:
  • Seite:
  • 1
  • 2

THEMA: Client Java for testing the API

Client Java for testing the API 1 Jahr 2 Monate her #97456

  • mdekker
  • mdekkers Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 341
  • Dank erhalten: 68
  • Karma: 38
Try this: pastebin.com/GsmWbTgy and take it from there

(btw i am no java programmer, but this got me a json response)
---
Menno Dekker
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Client Java for testing the API 1 Jahr 2 Monate her #97457

  • mdekker
  • mdekkers Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 341
  • Dank erhalten: 68
  • Karma: 38
Actually this line:
post.setEntity( new StringEntity("{\"method\": \"get_session_key\", \"params\": [\"admin\",\"password\"], \"id\": 99}"));

should be able to give you a valid response
---
Menno Dekker
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Client Java for testing the API 1 Jahr 2 Monate her #97459

  • nicola_86
  • nicola_86s Avatar
thanks mdekker. Now I have finally a response.
{"id":99,"result":null,"error":null}

I was wondering what is "id". Anyway I use the username and password to do the login at the administration panel of limesurvey, but the result is null, what does it mean?
Thanks in advance.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Client Java for testing the API 1 Jahr 2 Monate her #97466

  • nicola_86
  • nicola_86s Avatar
sorry the error was like that: {"id":1,"result":{"status":"Invalid user name or password"},"error":null}

I've also tried with the demo version that you have with username:admin and password:test
and the message is the same. Any suggestion?
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Client Java for testing the API 1 Jahr 2 Monate her #97481

  • nicola_86
  • nicola_86s Avatar
Ok I've solved the problem.
The problem was also in the json string. The correct one is:
post.setEntity( new StringEntity("{\"method\": \"get_session_key\", \"params\": {\"admin\",\"password\"}, \"id\": 99}"));

Here a client to test the key session and a random function of the api, using gson for decoding the message(it's not very optimized, I'm still working on it, but it could be a good start for anyone else that will struggle with java like me)
pastebin.com/7jeGB6vA
Letzte Änderung: 1 Jahr 2 Monate her von nicola_86. Begründung: the message wasn't written well..sorry
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Client Java for testing the API 1 Jahr 2 Monate her #97489

  • mdekker
  • mdekkers Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 341
  • Dank erhalten: 68
  • Karma: 38
Could you please add your example to our documentation wiki?

Somewhere at the end just like the ruby and php examples.
manual.limesurvey.org/RemoteControl_2_API#Ruby_Example

Posts like this on the forum tend to get lost over time.
---
Menno Dekker
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Client Java for testing the API 1 Jahr 2 Monate her #97491

  • nicola_86
  • nicola_86s Avatar
Could you tell me how I can modify the wiki?
I'd like to do that :)
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Client Java for testing the API 1 Jahr 2 Monate her #97495

  • mdekker
  • mdekkers Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 341
  • Dank erhalten: 68
  • Karma: 38
Using this link:
manual.limesurvey.org/index.php?title=Re...tion=edit§ion=54

You should be able to edit the relevant section in the wiki. User accounts on wiki and forum are the same.
---
Menno Dekker
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Client Java for testing the API 1 Jahr 2 Monate her #97517

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6277
  • Dank erhalten: 802
  • Karma: 241
Starting Help page for the wiki : manual.limesurvey.org/Help:Contents ;)
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Client Java for testing the API 1 Jahr 2 Monate her #97578

  • nicola_86
  • nicola_86s Avatar
Done :) thanks for the support guys.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
  • Seite:
  • 1
  • 2
Moderatoren: ITEd
Ladezeit der Seite: 0.146 Sekunden
Donation Image