Check out the LimeSurvey source code on GitHub!

surveyID vs iSurveyID

  • nicola_86
  • nicola_86's Avatar Topic Author
  • Visitor
  • Visitor
3 years 7 months ago #97579 by nicola_86
I was wondering why you specify two different names for the same attribute in the API? It seems that I have problems when I have to do that kind of call, because iSurveyID is an int type of variable.
For example the following call doesn't work:
{\"method\": \"get_participant_properties\", \"params\": {\"sSessionKey \": "+sessionKey+", \"iSurveyID \": 811861, \"iTokenID\": 5jmrj7dihsyhgjx  \"aTokenProperties\":[{\"email\":\"zooropa86@gmail.com\",\"lastname\":\"Prova\",\"firstname\":\"URL\",\"attribute_2\":\"http://manual.limesurvey.org/RemoteControl_2_API#Examples\"}]}, \"id\": 1}"

Please Log in to join the conversation.

More
3 years 7 months ago #97581 by mdekker
I think JSON-RPC 1.0 does not handle named parameters, only positional so there should be no problem with naming when you supply parameters in the correct order. I think it is more of a documentation problem with the api then a functional problem.

I don't see a duplicate parameter in the call, can you explain what the problem is and what kind of output you get/expect?

---
Menno Dekker

Please Log in to join the conversation.

  • nicola_86
  • nicola_86's Avatar Topic Author
  • Visitor
  • Visitor
3 years 7 months ago #97588 by nicola_86
uhm the problem is that the entity of the json object is empty. I just got this
HTTP/1.1 200 OK [Date: Mon, 01 Jul 2013 09:48:40 GMT, Server: Apache/2.2.15 (CentOS), X-Powered-By: PHP/5.3.3, Expires: Thu, 19 Nov 1981 08:52:00 GMT, Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0, Pragma: no-cache, Content-Length: 0, Keep-Alive: timeout=15, max=99, Connection: Keep-Alive, Content-Type: text/html; charset=UTF-8]

If I want to see the parameters that remotecontrol has from my call(I have access to that file on the server) what php command can I use to print the value of the fields of the method? print_r ?
And where do I aspect to see the the results of these prints?
thanks in advance.

Please Log in to join the conversation.

More
3 years 7 months ago #97589 by mdekker
pastebin.com/531uHQ2x

This first request lists the valid survey id's, and then when i insert one i get a valid response.

---
Menno Dekker

Please Log in to join the conversation.

  • nicola_86
  • nicola_86's Avatar Topic Author
  • Visitor
  • Visitor
3 years 7 months ago #97591 by nicola_86
ok, but that doesn't solve my problem unfortunately. Do you have an example of the sintaxt of a get_participant_properties call?

Please Log in to join the conversation.

More
3 years 7 months ago #97593 by mdekker
post.setEntity( new StringEntity("{\"method\": \"get_participant_properties\", \"params\": {\"sSessionKey \": "+sessionKey+", \"iSurveyId \": 12345, \"iTokenId\": 1, \"aTokenProperties\":[\"token\",\"lastname\"]}, \"id\": 1}"));

---
Menno Dekker

Please Log in to join the conversation.

  • nicola_86
  • nicola_86's Avatar Topic Author
  • Visitor
  • Visitor
3 years 7 months ago #97594 by nicola_86
new StringEntity("{\"method\": \"get_participant_properties\", \"params\": {\"sSessionKey \": "+sessionKey+", \"iSurveyId \": 811861, \"iTokenId\": 5jmrj7dihsyhgjx, \"aTokenProperties\":[\"token\",\"lastname\"]}, \"id\": 1}");

doesn't work too :( empty result..

Please Log in to join the conversation.

More
3 years 7 months ago #97596 by mdekker
Don't ask me why, but the tokenid should be a number, not the token itself. If you go to the token screen you can see the id. Not really sure if there are other ways to get the id (using remote control instead of admin interface).

---
Menno Dekker

Please Log in to join the conversation.

  • nicola_86
  • nicola_86's Avatar Topic Author
  • Visitor
  • Visitor
3 years 7 months ago #97597 by nicola_86
so that, if you leave the creation of tokens to limesurvey, than it won't work that method, because limesurvey doesn't accept alphanumerical token? Am I wrong?

Please Log in to join the conversation.

More
3 years 7 months ago #97598 by mdekker
I think list_participants can give you that info (tid <-> token mapping)

---
Menno Dekker

Please Log in to join the conversation.

  • nicola_86
  • nicola_86's Avatar Topic Author
  • Visitor
  • Visitor
3 years 7 months ago #97599 by nicola_86
I didn't try it, but It's not so good as the the other one. I mean you have to search the information among the list of partecipants, and I guess that it's not so easy to make the list smaller(using start & limit attribute).
Anyway thanks for the suggestion.

Please Log in to join the conversation.

  • nicola_86
  • nicola_86's Avatar Topic Author
  • Visitor
  • Visitor
3 years 7 months ago #97634 by nicola_86
I'm still try to understand how it works.
I've tried this call:
"{\"method\": \"get_participant_properties\", \"params\": {\"sSessionKey \": "+sessionKey+", \"iSurveyId \": 811861, \"iTokenId\": \"q4cxxfda68t8y2k\", \"aTokenProperties\":[\"token\",\"lastname\"]}, \"id\": 1}"

but the answer is this one:
hvdr8ur79b6kxstrtwysqt8afw6wbv9tsurvey: 811861token: q4cxxfda68t8y2kproperties: Array{"id":1,"result":{"status":"Error: Invalid tokenid"},"error":null}

The problem is that the token even in the token screen is alphanumerical.. and even if I use an integer as a token I got the same error.
Any suggestion?

Please Log in to join the conversation.

More
3 years 7 months ago #97637 by mdekker
The token might be, but the ID is numerical. It is the first column in the token screen.

---
Menno Dekker
The following user(s) said Thank You: nicola_86

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form