RC2 API - set_question_properties - answeroptions

More
3 years 9 months ago - 3 years 9 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:

{"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: 3 years 9 months ago by web_digital. Reason: typo

Please Log in to join the conversation.

LimeSurvey Partners
More
3 years 6 months ago #146961 by dillusion13
Did you ever figure this out? I'm stuck on the same thing

Please Log in to join the conversation.

  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
3 years 6 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.

Please Log in to join the conversation.

More
3 years 6 months ago #146985 by dillusion13
So that being said, are you able to update question answers via rpc with some other call that is not set_question_properties?

Please Log in to join the conversation.

More
2 months 3 days ago #198958 by venkatmaran
I have built a plugin for setting the answer options. Please contact me if you need it.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now