- Posts: 17
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
RC2 API returns a wrong empty result as response for all surveys
- eduardocosta
- Topic Author
- Offline
- New Member
Less
More
7 years 3 months ago - 7 years 3 months ago #147011
by eduardocosta
RC2 API returns a wrong empty result as response for all surveys was created by eduardocosta
Hi all,
after hours of work without success trying to understand what is happening on my environment I decide to ask for some help here. I appreciate if someone could at least point me for some direction.
I had the Lime Survey Version 2.50+ Build 160606 hosted on a Shared Server and I´m facing an issue using the REMOTE CONTROL 2 API.
When I sent a json post request with the export_responses method as follow:
As response I have a json message with wrong empty result as follow:
The response header of the previous POST request is:
The result should not be empty because the the json message is correct and the response id exists. I tried another type of message to see the result, now using the list_group method:
So I had a correct response:
The response header of the previous POST request is:
This show me that RC2 API is working on my Hosted Lime Survey for the list_group but not for the export_response. On the server side I did no found any error.
[hr]
In order to investigate the issue I backup my remote Lime Survey installation and I installed on my local machine on an AMP Stack called WAMP Server which integrates the APACHE,MYSQL and PHP on Windows.
In the local installation, when I send the same json POST REQUEST:
To my surprise it worked correctly and I had the following result as return:
The response header for the previous POST REQUEST is:
With this behavior looks that there is something wrong on my Shared Sever where the Lime survey is installed, something that makes the JSON POST REQUEST return an empty result. However I had no clue about what could be wrong, should be something on PHP ? on Apache ? Mysql maybe ? I did not find any error on php logs.
I attached here in this post the PHP Info page of both server.
I appreciate any help.
Thank you.
after hours of work without success trying to understand what is happening on my environment I decide to ask for some help here. I appreciate if someone could at least point me for some direction.
I had the Lime Survey Version 2.50+ Build 160606 hosted on a Shared Server and I´m facing an issue using the REMOTE CONTROL 2 API.
When I sent a json post request with the export_responses method as follow:
Code:
{ "method":"export_responses", "id":1, "params":[ "wxvn7wmpmwymn8z9tw6pruz85jf8ytdh", "988452", "json", "pt-BR", "complete", "code", "short", "3048", "3048" ] }
Code:
{ "id":1, "result":"", "error":null }
Code:
Status Code: 200 OK Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Connection: Keep-Alive Content-Encoding: gzip Content-Type: text/javascript Date: Thu, 12 Jan 2017 01:46:00 GMT Expires: Thu, 19 Nov 1981 08:52:00 GMT Keep-Alive: timeout=5, max=500 Pragma: no-cache Server: Apache Transfer-Encoding: chunked Vary: Accept-Encoding
Code:
{ "method":"list_groups", "params":[ "gdv64ra8i6iu2knzvdknhaar3yi2zeiq", "988452" ], "id":1 }
Code:
{ "method":"list_groups", "params":[ "gdv64ra8i6iu2knzvdknhaar3yi2zeiq", "988452" ], "id":1 }{ "id":1, "result":[ { "id":{ "gid":"22", "language":"pt-BR" }, "gid":"22", "sid":"988452", "group_name":"Informa\u00e7\u00f5es para contato", "group_order":"0", "description":"info", "language":"pt-BR", "randomization_group":"", "grelevance":"" } ], "error":null }
Code:
Status Code: 200 OK Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Connection: Keep-Alive Content-Encoding: gzip Content-Type: text/javascript Date: Thu, 12 Jan 2017 10:51:26 GMT Expires: Thu, 19 Nov 1981 08:52:00 GMT Keep-Alive: timeout=5, max=500 Pragma: no-cache Server: Apache Transfer-Encoding: chunked Vary: Accept-Encoding
[hr]
In order to investigate the issue I backup my remote Lime Survey installation and I installed on my local machine on an AMP Stack called WAMP Server which integrates the APACHE,MYSQL and PHP on Windows.
In the local installation, when I send the same json POST REQUEST:
Code:
{ "method":"export_responses", "id":1, "params":[ "vnnje8v8vtqk542ijkjkcwbvh9zc4wrf", "988452", "json", "pt-BR", "complete", "code", "short", "3048", "3048" ] }
Code:
{ "id":1, "result":"eyJyZXNwb25zZXMiOiBbeyIzMDQ4Ijp7ImlkIjoiMzA0OCIsI...(I cut the text here)", "error":null }
Code:
Status Code: 200 OK Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Connection: Keep-Alive Content-Length: 1187 Content-Type: text/javascript Date: Thu, 12 Jan 2017 01:34:25 GMT Expires: Thu, 19 Nov 1981 08:52:00 GMT Keep-Alive: timeout=5, max=100 Pragma: no-cache Server: Apache/2.4.9 (Win32) PHP/5.5.12 x-powered-by: PHP/5.5.12
With this behavior looks that there is something wrong on my Shared Sever where the Lime survey is installed, something that makes the JSON POST REQUEST return an empty result. However I had no clue about what could be wrong, should be something on PHP ? on Apache ? Mysql maybe ? I did not find any error on php logs.
I attached here in this post the PHP Info page of both server.
I appreciate any help.
Thank you.
Attachments:
Last edit: 7 years 3 months ago by eduardocosta. Reason: Correction spelling
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
7 years 3 months ago #147047
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic RC2 API returns a wrong empty result as response for all surveys
Lime Survey Version 2.50+ Build 160606 : maybe an issue in RPC in this version, best seems to try updating before
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: LouisGac
The topic has been locked.
- eduardocosta
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
- Thank you received: 1
7 years 3 months ago #147059
by eduardocosta
Replied by eduardocosta on topic RC2 API returns a wrong empty result as response for all surveys
Hi DenisChenu, thank you for read and reply my message.
It´s a good suggestion I will upgrade my Lime Survey to the last stable release and see whether it will work.
I came back soon with the results.
Thank you.
It´s a good suggestion I will upgrade my Lime Survey to the last stable release and see whether it will work.
I came back soon with the results.
Thank you.
The topic has been locked.
- eduardocosta
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
- Thank you received: 1
7 years 3 months ago #147231
by eduardocosta
Replied by eduardocosta on topic RC2 API returns a wrong empty result as response for all surveys
Hello DenisChenu, now my LimeSurvey version is the latest 2.59.1+170116 and unfortunately the behaviour is the same that I wrote in the first post. I keep receiving an empty result with no errors:
..when I send the message bellow:
I already tried to send some variations of this message like do not send the optional values. If I do not send the two last parameters ("3048") per example then the message take more time to give me a response but the response is empty as well. Looks like the query are being executed but for some reason the response is created.
That´s frustrating because I have no idea what could be wrong and I wrote my third party Java application to grab survey responses using the RCP2 however I had no luck when I put the application on production.
Any suggestion will be welcome.
Thank you.
Ed.
Code:
{"id":1, "result":"", "error":null}
..when I send the message bellow:
Code:
{ "method":"export_responses", "id":1, "params":[ "ivpmi2e39hr3n9iui4psytfs6cv6zdnr", "988452", "json", "pt-BR", "complete", "code", "short", "3048", "3048" ] }
I already tried to send some variations of this message like do not send the optional values. If I do not send the two last parameters ("3048") per example then the message take more time to give me a response but the response is empty as well. Looks like the query are being executed but for some reason the response is created.
That´s frustrating because I have no idea what could be wrong and I wrote my third party Java application to grab survey responses using the RCP2 however I had no luck when I put the application on production.
Any suggestion will be welcome.
Thank you.
Ed.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
7 years 3 months ago #147287
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic RC2 API returns a wrong empty result as response for all surveys
Did you try with only the 1st 3 params for testing ? And adding params one by one ?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- LouisGac
- Visitor
7 years 3 months ago #147294
by LouisGac
Replied by LouisGac on topic RC2 API returns a wrong empty result as response for all surveys
I agree with Denis. You should try different requests to see if one works. Your problem could be related to your survey (wrong language, no complete answers for this qid, etc etc ).
The topic has been locked.
- eduardocosta
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
- Thank you received: 1
7 years 3 months ago #147308
by eduardocosta
Replied by eduardocosta on topic RC2 API returns a wrong empty result as response for all surveys
Hi, thank you for take your time to read and reply this message.
I already tried some variations of this message but the result was the same. I tried to send messages without the optional parameters and also changing the parameters values like the qid, answer id, language, return format (jso,csv) etc...
I also tried to do the test from other network... (that crazy moment where you suspect till of the coffee machine ).
Just to double check I sent now the message with just the 1st 3 parameters like DenisChenu suggested:
The response:
The header:
In my first post I attached the Limesurvey debug output, I see nothing wrong and as I explained before when I installed in my local machine a backup of my production Limesurvey the same message worked.
I suspect that something wrong on my "shared hosting" can cause the issue but I had no clue about what (I attached the phpinfo from both servers), I also can not explain why other messages is working correctly...
Anyway thanks.
I already tried some variations of this message but the result was the same. I tried to send messages without the optional parameters and also changing the parameters values like the qid, answer id, language, return format (jso,csv) etc...
I also tried to do the test from other network... (that crazy moment where you suspect till of the coffee machine ).
Just to double check I sent now the message with just the 1st 3 parameters like DenisChenu suggested:
Code:
{ "method":"export_responses", "id":1, "params":[ "t33xd8wcntedm58zhp37jumsbuducska", "988452", "json" ] }
The response:
Code:
{"id":1, "result":"", "error":null}
The header:
Code:
Status Code: 200 OK Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Connection: Keep-Alive Content-Encoding: gzip Content-Type: text/javascript Date: Wed, 18 Jan 2017 10:41:32 GMT Expires: Thu, 19 Nov 1981 08:52:00 GMT Keep-Alive: timeout=5, max=500 Pragma: no-cache Server: Apache Transfer-Encoding: chunked Vary: Accept-Encoding
In my first post I attached the Limesurvey debug output, I see nothing wrong and as I explained before when I installed in my local machine a backup of my production Limesurvey the same message worked.
I suspect that something wrong on my "shared hosting" can cause the issue but I had no clue about what (I attached the phpinfo from both servers), I also can not explain why other messages is working correctly...
Anyway thanks.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
7 years 3 months ago - 7 years 3 months ago #147329
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic RC2 API returns a wrong empty result as response for all surveys
I just test RPC with last master with a superadmin user : seems to work. No clue here.
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 7 years 3 months ago by DenisChenu.
The following user(s) said Thank You: LouisGac
The topic has been locked.
- eduardocosta
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
- Thank you received: 1
7 years 3 months ago #147331
by eduardocosta
Replied by eduardocosta on topic RC2 API returns a wrong empty result as response for all surveys
Ok Thank you for your help.
For awhile I will have to abandon to use RCP2 as my API interface to read answers. I´m writing a new API interface where I can execute a SQL query straight on the database and return a JSON message as response.
I´m using the Slim framework ( www.slimframework.com/ ) what make things simple.
I do not like to reinvent the wheel but I have no choice for now.
For awhile I will have to abandon to use RCP2 as my API interface to read answers. I´m writing a new API interface where I can execute a SQL query straight on the database and return a JSON message as response.
I´m using the Slim framework ( www.slimframework.com/ ) what make things simple.
I do not like to reinvent the wheel but I have no choice for now.
The topic has been locked.
- LouisGac
- Visitor
7 years 3 months ago #147332
by LouisGac
Replied by LouisGac on topic RC2 API returns a wrong empty result as response for all surveys
I strongly suggest you to do it with Yii 1 Framework (the one that LimeSurvey uses):
www.yiiframework.com/
If you do it as a Yii module, it will be then quiet easy to integrate it inside LimeSurvey.
www.yiiframework.com/doc/guide/1.1/en/basics.module
www.yiiframework.com/
If you do it as a Yii module, it will be then quiet easy to integrate it inside LimeSurvey.
www.yiiframework.com/doc/guide/1.1/en/basics.module
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
7 years 3 months ago #147334
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic RC2 API returns a wrong empty result as response for all surveys
Did you test with a superadmin ? Because seems there are issue if user have onlmy read access on all surveys.
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- LouisGac
- Visitor
7 years 2 months ago #147426
by LouisGac
Replied by LouisGac on topic RC2 API returns a wrong empty result as response for all surveys
also, could you try with different value for debug mode?
The topic has been locked.