I am following
www.limesurvey.org/manual/RemoteControl_2_API
and the official documentation of the API and trying to use export responses method by using Node.js and Python code. I am able to get my session key by get_session_key method, however when I am calling export_response method I am getting some sort of exception(' No JSON object could be decoded'/ ) in python.
Code:
def export_responses2(skey,sid):
req = urllib2.Request(url='https://DOMAIN/index.php/admin/remotecontrol',\
data='{\"method\":\"export_responses\",\"params\":[\"'+skey+'\",\"'+sid+'\",\"csv\",\"en\",\"full\"],\
"id\": 1}')
req.add_header('content-type','application/json')
req.add_header('connection','Keep-Alive')
try:
f = urllib2.urlopen(req)
myretun = f.read()
j=json.loads(myretun)print j
return j['result']
except :
e = sys.exc_info()[0]print("<p>Error: %s</p>"% e )
I have enabled JSON RPC under my interfaces section of global settings.