- Posts: 12
- Thank you received: 0
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
- Topic Author
- Offline
- New Member
Less
More
4 years 10 months ago - 4 years 10 months ago #184942
by datamunger
limesurvey API error: get_question_properties always returns"invalid questionID" was created 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)
The result is invariably:
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?
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
4 years 10 months ago #184948
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic limesurvey API error: get_question_properties always returns"invalid questionID"
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.
- DivePeak
- Offline
- New Member
Less
More
- Posts: 1
- Thank you received: 0
4 years 6 months ago #189355
by DivePeak
Replied by DivePeak on topic limesurvey API error: get_question_properties always returns"invalid questionID"
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}
("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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 12
- Thank you received: 0
4 years 6 months ago #189358
by datamunger
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.
Replied by datamunger on topic limesurvey API error: get_question_properties always returns"invalid questionID"
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.