- Posts: 15
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
How to get questions / answers from a given survey? Through the RC API ?
- simogeo
- Topic Author
- Offline
- New Member
Less
More
9 years 11 months ago - 9 years 11 months ago #108087
by simogeo
How to get questions / answers from a given survey? Through the RC API ? was created by simogeo
Hi all,
I've seen the RemoteControl API : manual.limesurvey.org/RemoteControl_2_API . Which seem to be great!
I have in fact 2 questions :
I haven't explore fully the API yet -sorry if it's obvious. Any way, any precision would be appreciated. Thanks in advance.
edit : I use Version 2.05+ Build 140320
simo
I've seen the RemoteControl API : manual.limesurvey.org/RemoteControl_2_API . Which seem to be great!
I have in fact 2 questions :
- I'd like to know how can I get the list of questions for a given survey ID ? Is it possible through the API or through another tool/class/method ?
- I'd also like to know how can I get the list of answers for a given answer ID (SAVEDID) ? Is it possible through the API or through another tool/class/method ?
I haven't explore fully the API yet -sorry if it's obvious. Any way, any precision would be appreciated. Thanks in advance.
edit : I use Version 2.05+ Build 140320
simo
Last edit: 9 years 11 months ago by simogeo.
The topic has been locked.
- simogeo
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 0
9 years 11 months ago #108112
by simogeo
Replied by simogeo on topic How to get questions / answers from a given survey? Through the RC API ?
OK,
I'm able to list all my questions with the remoteControl API with the use of list_groups, list_questions and get_question_properties.
I would like now to get all given answer for a specific record. I haven't found this feature into the remoteControl ? Did I miss it?
According to you limesurvey gurus, how can I do that?
Thanks
I'm able to list all my questions with the remoteControl API with the use of list_groups, list_questions and get_question_properties.
I would like now to get all given answer for a specific record. I haven't found this feature into the remoteControl ? Did I miss it?
According to you limesurvey gurus, how can I do that?
Thanks
The topic has been locked.
- david2013
- Offline
- Senior Member
Less
More
- Posts: 42
- Thank you received: 6
9 years 11 months ago #108298
by david2013
Replied by david2013 on topic How to get questions / answers from a given survey? Through the RC API ?
Have you tried "export_responses_by_token" method?
The topic has been locked.
- simogeo
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 0
9 years 11 months ago #108309
by simogeo
Replied by simogeo on topic How to get questions / answers from a given survey? Through the RC API ?
Thanks for your reply,
I haven't tried since it exports the result to pdf,csv,xls,doc according to the doc ( manual.limesurvey.org/RemoteControl_2_AP...t_responses_by_token )
Anyway, I handled all this manually.
Thanks
I haven't tried since it exports the result to pdf,csv,xls,doc according to the doc ( manual.limesurvey.org/RemoteControl_2_AP...t_responses_by_token )
Anyway, I handled all this manually.
Thanks
The topic has been locked.
- jnjortn
- Offline
- New Member
Less
More
- Posts: 1
- Thank you received: 0
9 years 2 weeks ago #119143
by jnjortn
Replied by jnjortn on topic How to get questions / answers from a given survey? Through the RC API ?
Hi,
I am successfully using the API to access a survey's results but cannot figure out how to get the answers to the questions. Here is the ruby statement to access the results and the resulting output.
response = survey.export_responses_by_token(session_key, 948387,"json","ttvfgd35yfqqagx","English",'complete','full','long' )
Output
Responses: {"responses": [{"1":{"Response ID":"1","Date submitted":"2015-04-10 16:51:46","Last page":"1","Start language":"en","Token":"ttvfgd35yfqqagx","Date started":"2015-04-10 16:51:35","Date last action":"2015-04-10 16:51:46"}}]}
What is required to get the answers ? Any help would be appreciated.
I am successfully using the API to access a survey's results but cannot figure out how to get the answers to the questions. Here is the ruby statement to access the results and the resulting output.
response = survey.export_responses_by_token(session_key, 948387,"json","ttvfgd35yfqqagx","English",'complete','full','long' )
Output
Responses: {"responses": [{"1":{"Response ID":"1","Date submitted":"2015-04-10 16:51:46","Last page":"1","Start language":"en","Token":"ttvfgd35yfqqagx","Date started":"2015-04-10 16:51:35","Date last action":"2015-04-10 16:51:46"}}]}
What is required to get the answers ? Any help would be appreciated.
The topic has been locked.
- simogeo
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 0
9 years 1 week ago - 9 years 1 week ago #119156
by simogeo
Replied by simogeo on topic How to get questions / answers from a given survey? Through the RC API ?
Using PHP, I created a dedicated class to retrieve a given record :
And I use LSRC ( manual.limesurvey.org/RemoteControl_2_AP...w_to_configure_LSRC2 ) to retrieve questions.
Code:
<?php class lmAnswerManager { private $db; // PDO Instance /** * Constructeur du manager de la class Users */ public function __construct(){ $this->db = DbConnect::GetInstance()->GetConnexion(); } /** * Méthode permettant de lister toutes les réponses aux questionnaires * @return Array */ public function ListAnswers(){ $tabResult = false; $query = $this->db->prepare('SELECT * FROM lime_survey_'.$_SESSION["CONFIG"]["LS_SURVEYID"]); $result = $query->execute(); $tabResult = array(); while($result = $query->fetch(PDO::FETCH_ASSOC)){ $tabResult[] = $result; } return $tabResult; } /** * Méthode permettant d'instancier une réponse * @param int $id * @return Array */ public function GetAnswer($id){ $tabResult = false; $query = $this->db->prepare('SELECT * FROM lime_survey_'.$_SESSION["CONFIG"]["LS_SURVEYID"].' WHERE id=:id '); $query->bindValue(':id',$id); $query->execute(); while($result = $query->fetch(PDO::FETCH_ASSOC)){ $tabResult[] = $result; } return $tabResult; } } ?>
And I use LSRC ( manual.limesurvey.org/RemoteControl_2_AP...w_to_configure_LSRC2 ) to retrieve questions.
Last edit: 9 years 1 week ago by simogeo.
The topic has been locked.