Adding a response using the lime survey API

More
1 year 2 months ago - 1 year 2 months ago #164420 by Kabengwa
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: 1 year 2 months ago by Kabengwa.

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

LimeSurvey Partners
More
1 year 2 months ago #164512 by tpartner
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
1 year 1 month ago #165606 by Kabengwa
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!