Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

RC2 API - set_question_properties - answeroptions

  • web_digital
  • web_digital's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 6 months ago - 7 years 6 months ago #142373 by web_digital
Hi there

Trying to set answer options using the RC2 API, but just getting a "No valid Data" status at the mo....
JSON body is as follows:

Code:
{"method":"set_question_properties","params":{"sSessionKey":"{{token}}","iQuestionID":"19","aQuestionData":{"answeroptions":[{"A1":{"answer":"Red","assessment_value":"0","scale_id":"0"}}]}},"id":1}
I have tried a few variations on this.
Its possible to get this data out using get_question_properties, but doesn't look like its possible to set.
Any help greatly appreciated.

Thanks

Mat.
Last edit: 7 years 6 months ago by web_digital. Reason: typo
The topic has been locked.
More
7 years 3 months ago #146961 by dillusion13
Replied by dillusion13 on topic RC2 API - set_question_properties - answeroptions
Did you ever figure this out? I'm stuck on the same thing
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
7 years 3 months ago #146975 by LouisGac
So, here the code for set_question_properties:
github.com/LimeSurvey/LimeSurvey/blob/ma...ndle.php#L1453-L1539

The message "no valid data" happen when there is no intersection between the keys of the aQuestionData you provided and the column names of your question:
github.com/LimeSurvey/LimeSurvey/blob/ma...ndle.php#L1493-L1499

As explained in the documentation of the method:

* @param array|struct $aQuestionData - An array with the particular fieldnames as keys and their values to set on that particular question


So, let's remind the fieldnames of a question:

qid
parent_qid
sid
gid
type
title
question
preg
help
other
mandatory
question_order
language
scale_id
same_default
relevance
modulename



There is no field like "answeroptions", that's why you can't update it.
The topic has been locked.
More
7 years 3 months ago #146985 by dillusion13
Replied by dillusion13 on topic RC2 API - set_question_properties - answeroptions
So that being said, are you able to update question answers via rpc with some other call that is not set_question_properties?
The topic has been locked.
More
3 years 11 months ago #198958 by venkatmaran
Replied by venkatmaran on topic RC2 API - set_question_properties - answeroptions
I have built a plugin for setting the answer options. Please contact me if you need it.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose