limesurvey API error: get_question_properties always returns"invalid questionID"

More
6 months 1 week ago - 6 months 1 week ago #184942 by datamunger
Hi!

I'm trying to get info about questions through the API for an app I'm working on, but I can't seem to get any result. My API request looks like this (in Python)
api.open(password=password)
method = "get_question_properties"
 
 
question_a = {}
 
question_a = api.query(method=method, params=OrderedDict([
    ("sSessionKey", api.session_key),
    ("iSurveyID", '123456'),
    ("iQuestionID", '12345'),
    ('aQuestionSettings', 'available_answers')
]))

The result is invariably:
{'status': 'Error: Invalid questionid'}

Retrieving responses, surveys, participants, list_questions and other things works just fine, but this one seems to be determined to refuse my requests.

Does anyone have an idea what I'm doing wrong?
Last edit: 6 months 1 week ago by datamunger.

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

LimeSurvey Partners
More
6 months 1 week ago #184948 by tpartner
I can't help with Python but this works for me in PHP - www.limesurvey.org/forum/installation-a-...ssement-value#169809

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com

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

More
2 months 1 week ago #189355 by DivePeak
You need to remove the:
("iSurveyID", '123456')

For some reason, including the survey id makes it return "invalid questionID".

The request should look like:
{"method":"get_question_properties","params":{"sSessionKey":"yourKey","iQuestionID":571},"id":1}

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

More
2 months 1 week ago #189358 by datamunger

DivePeak wrote: You need to remove the:
("iSurveyID", '123456')

For some reason, including the survey id makes it return "invalid questionID".

The request should look like:
{"method":"get_question_properties","params":{"sSessionKey":"yourKey","iQuestionID":571},"id":1}


I also figured that out since asking the question, but thanks for completing the thread - I should've posted the answer as soon as I knew it.

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!