Welcome to the LimeSurvey Community Forum

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

limesurvey API error: get_question_properties always returns"invalid questionID"

  • datamunger
  • datamunger's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 10 months ago - 4 years 10 months 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)
Code:
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:
Code:
{'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: 4 years 10 months ago by datamunger.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 10 months 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.
The topic has been locked.
More
4 years 6 months 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}
The topic has been locked.
  • datamunger
  • datamunger's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 6 months 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.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose