Welcome, Guest
Username: Password: Remember me

TOPIC: How to get questions / answers from a given survey? Through the RC API ?

How to get questions / answers from a given survey? Through the RC API ? 1 year 2 months ago #108087

  • simogeo
  • simogeo's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 19
  • Karma: 0
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'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: 1 year 2 months ago by simogeo.
The administrator has disabled public write access.

How to get questions / answers from a given survey? Through the RC API ? 1 year 2 months ago #108112

  • simogeo
  • simogeo's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 19
  • Karma: 0
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
The administrator has disabled public write access.

How to get questions / answers from a given survey? Through the RC API ? 1 year 2 months ago #108298

  • david2013
  • david2013's Avatar
  • Offline
  • Senior Lime
  • Posts: 47
  • Thank you received: 7
  • Karma: 3
Have you tried "export_responses_by_token" method?
The administrator has disabled public write access.

How to get questions / answers from a given survey? Through the RC API ? 1 year 2 months ago #108309

  • simogeo
  • simogeo's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 19
  • Karma: 0
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
The administrator has disabled public write access.

How to get questions / answers from a given survey? Through the RC API ? 3 months 2 weeks ago #119143

  • jnjortn
  • jnjortn's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 1
  • Karma: 0
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.
The administrator has disabled public write access.

How to get questions / answers from a given survey? Through the RC API ? 3 months 2 weeks ago #119156

  • simogeo
  • simogeo's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 19
  • Karma: 0
Using PHP, I created a dedicated class to retrieve a given record :
<?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: 3 months 2 weeks ago by simogeo.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.150 seconds