Check out the LimeSurvey source code on GitHub!

Getting responses for a survey via Remote Control 2 API

More
3 years 6 months ago #98642 by Anurag01
I'm struggling with getting responses for a non-anonymized survey that has a tokens table properly initialized and that has some valid responses as well. The problem is:
  1. There doesn't seem to be a direct method in the API to get survey responses. There is export_responses, but that's not what I want as it exports responses to a file.
  2. A potential solution seems to exist in get_summary (completed_responses and full_responses stats), but even that isn't working for me. But it may be that I'm calling it in the wrong way. I pass as arguments to this method -- session key, survey id and the stat name. What I get in response is this JSON object --
    { "id": "1", "result": "1", "error": null }

And no, I'm not calling the JSON-RPC webservice the wrong way. Several other methods, like list_questions, list_participants, etc., are working fine.

Could someone help me out here?

Please Log in to join the conversation.

More
3 years 6 months ago #98675 by Anurag01
A gentle bump :)

Please Log in to join the conversation.

More
3 years 6 months ago #98709 by Anurag01
Another gentle bump. Anybody home? :whistle:

Please Log in to join the conversation.

More
3 years 6 months ago #98714 by mdekker
What are you trying to do? Do you know the token or responseid you would like to request? Exporting to csv would result in something easy to parse after receiving it.

What exact calls are you using (minus the sessionid)? What version (build) are you using?

---
Menno Dekker

Please Log in to join the conversation.

More
3 years 6 months ago #98715 by Anurag01

mdekker wrote: What are you trying to do? Do you know the token or responseid you would like to request? Exporting to csv would result in something easy to parse after receiving it.

What exact calls are you using (minus the sessionid)? What version (build) are you using?


I'm trying to retrieve all responses to the survey as they would appear in an exported file. I do not want to retrieve info for a particular token, but for the entire respondents. Hence, token info is not required in my request.

Exporting to CSV is not an option as I want to get data in JSON format. As I mentioned before, I'm calling the get_summary function with these arguments -- session key, survey id and the stat name (full_responses).

Limesurvey Version 2.00+ Build 130611

Thanks

Please Log in to join the conversation.

More
3 years 6 months ago #98722 by mdekker
The get_summary will only report how many responses are available, not the response itself. So if you want responses, the only option you have is to use export_responses and parse csv output.

---
Menno Dekker

Please Log in to join the conversation.

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