3

In an Android app i have implement LimeSurvey,in which list of different Survey are displayed from lime survey admin panel. I am able to display questions of a survey but not getting any structure to submit user answer's of survey to LimeSurvey database. Any one can please help me how can i submit answer and in what structure lime survey accept response of survey.

As document suggest to add response in format -

sSessionKey (string) - The session key

iSurveyID (integer) - The survey id

aResponseData (array) - array/structure containing your response data

so my query is what the structure for aResponseData (array) , so it properly store in lime survey database.

Edit:

How to add answer of sub-questions.I am able to submit answer of simple question but how to send answer of subquestion and in Survey question type-L(List of radio with comment)how to submit comment.

Thanks in advance.

Ravi Bhandari
  • 4,682
  • 8
  • 40
  • 68

2 Answers2

4

The only way I found to solve this was downloading the .sql database backup from the main taskbar and look for your table, which is *lime_survey_IDSURVEY*, and check for the columns which match with your questions, and use them for your mapping in the aResponseData. I'll leave you an example of that:

{"method": "add_response", "params": {"sSessionKey ": "ey2bv8v7zaw7uwj6fa9a8mmx9xqiikja", "iSurveyID ": 588636, "aResponseData ": {"588636X1X1":"Aja","588636X1X22":"Y" } }, "id": 1}

This will be the JSON that I send with my POST request, where 588636X1X1 is a column that match with a question, and "Aja" is the answer (in that case is a text-string), meanwhile, the other one, it's the same but it's a multiple choice question. As you can see, there is a pattern for the column names, 588636 it's my survey ID, X1 it's the group of the question, and X1 it's the ID for my question.

Hope it's useful.

oscar.rpr
  • 678
  • 1
  • 6
  • 23
  • thanks for your answer.it workes for me.i have problem in submitting answer of type-O(Radio list with comment box),in this type question how to submit comment data to lime survey database. – Ravi Bhandari Mar 28 '14 at 07:42
  • I haven't test that, maybe you should try answer that question on the web application and check the sql database backup and check how they insert that value – oscar.rpr Apr 01 '14 at 21:37
  • do you have any idea about how to upload file in uploadfile type question. – Ravi Bhandari Apr 02 '14 at 10:31
  • Super helpful answer that explains everything I need - particularly important is understanding those columns quickly. – shashin May 10 '23 at 10:22
1

You should be using the limesurvey remote control feature to call the webservices api for various tasks you want to perform: add_response in this case . Its documentation is here


--
amit

Amit Kumar
  • 97
  • 3
  • thanks for answer,but my question is in what format(structure) i have to pass response data.Docs say's i have to send data in 'aResponseData (array)' format but which structure i have to follow for each questions answer,can you please explain or give some links for example. – Ravi Bhandari Mar 18 '14 at 05:22