Adding a response using the lime survey API

More
7 months 1 day ago - 7 months 1 day ago #164420 by Kabengwa
Kabengwa created the topic: Adding a response using the lime survey API
Hello,

I have been reading material all over the internet and trying to understand the Api that is provided here. how ever i am stack ... i have read the solutions offered by the users here and overflow but adding a response to a survey is playing me.
$answers_to_survey = array(
		"75195X10X117" => "A1",
		"75195X10X118" => "A1",
		"75195X11X119" => "A2",
		"75195X11X120" => "Y",
		"75195X11X121" => "Y",
		"75195X12X122" => "A1",
		"75195X12X123" => "Y",
		"75195X12X124" => "N",
		"75195X12X125" => "A2",
		"75195X13X126" => "A4",
		"75195X13X127" => "A2",
		"75195X13X128" => "N",
		"75195X13X129SQ001" => "Y",
		"75195X13X129SQ002" => "Sales",
		"75195X14X130" => "Y",
		"75195X14X131" => "N"
		);
		//adding the response to the survey
		$respond_to_survey = $myJSONRPCClient->add_response( $sessionKey, $survey_id, $answers_to_survey);
		echo '<pre>'; print_r($respond_to_survey); echo '<pre/>';
this is the little piece of php that i am trying to use to send some sort of response to the survey so that i can expand it further.

however its able to echo the number for the response but when i check in the response table there is nothing entered. am i doing something wrong?
 
"75195X10X117" => "Once a year [A1]",
"75195X10X118" => "Less than 24 hours [A1]",
"75195X11X119" => "Satisfactory [A2]",
"75195X11X120" => "Yes [Y]",
"75195X11X121" => "Yes [Y]",
"75195X12X122" => "1-5 Minutes [A1]",
"75195X12X123" => "Yes [Y]",
"75195X12X124" => "No [N]",
"75195X12X125" => "5-10 Times [A2]",
"75195X13X127" => "Satisfactory [A2]",
"75195X13X128" => "Just Okay [A3]",
"75195X13X129SQ001" => "Yes [Y]",
"75195X13X129SQ002" => "Sales",
"75195X14X130" => "Yes [Y]",
"75195X14X131" => "No [N]"
 
i also tried that format and it did not work.

I am using Version 2.72.3+171020 of limesurvey.

Let me attach some pictures for clarity.

Any help is welcome.




Attachments:
Last Edit: 7 months 1 day ago by Kabengwa.

Please Log in or Create an account to join the conversation.

More
6 months 4 weeks ago #164512 by tpartner
tpartner replied the topic: Adding a response using the lime survey API
Your first example is correct.

I am at a loss as to why it doesn't work - I have tested it successfully in versions 2.73.0 and 3.4.1.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in or Create an account to join the conversation.

More
6 months 2 days ago #165606 by Kabengwa
Kabengwa replied the topic: Adding a response using the lime survey API
I found what my problem was after u told me that my syntax was right. i was linking to the wrong database:unsure: ;) .... sorry had forgotte,n to update.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!