Welcome to the LimeSurvey Community Forum

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

Problem getting JSON-RPC Interface to work

  • polarbearcv
  • polarbearcv's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 4 months ago #102483 by polarbearcv
Problem getting JSON-RPC Interface to work was created by polarbearcv
I enabled the JSON-RPC interface in the settings.
However if I browse to the url that it suggests I get an blank page.
https://myservername/limesurvey2/index.php/admin/remotecontrol

I also tried to use the PHP example from the manual

<?php
require_once 'jsonRPCClient.php';
define( 'LS_BASEURL', 'https://myservername/limesurvey2'); // adjust this one to your actual LimeSurvey URL
define( 'LS_USER', 'rpcuser' );
define( 'LS_PASSWORD', 'mypassword' );
// the survey to process
$survey_id=316154;
// instanciate a new client
$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.'/admin/remotecontrol' );
// receive session key
$sessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD );
// receive all ids and info of groups belonging to a given survey
$groups = $myJSONRPCClient->list_groups( $sessionKey, $survey_id );
print_r($groups, null );
// release the session key
$myJSONRPCClient->release_session_key( $sessionKey );
?>


Then I get the following error

Warning: fopen(https://myservername/limesurvey2/admin/remotecontrol) [function.fopen]: failed to open stream: Connection timed out in /var/www/jsonrpcphp/includes/jsonRPCClient.php on line 132

Fatal error: Uncaught exception 'Exception' with message 'Unable to connect to https://myservername/limesurvey2/admin/remotecontrol' in /var/www/jsonrpcphp/includes/jsonRPCClient.php:140 Stack trace: #0 [internal function]: jsonRPCClient->__call('get_session_key', Array) #1 /var/www/jsonrpcphp/includes/rpctest.php(11): jsonRPCClient->get_session_key('rpcuser', 'mypassword') #2 {main} thrown in /var/www/jsonrpcphp/includes/jsonRPCClient.php on line 140


What im I doing wrong?
Marc.
The topic has been locked.
More
5 years 8 months ago #171588 by MadhuraBL
Replied by MadhuraBL on topic Problem getting JSON-RPC Interface to work
Hi, I get the same error. Did you manage to solve this?
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 8 months ago #171589 by DenisChenu
Replied by DenisChenu on topic Problem getting JSON-RPC Interface to work
1. LimeSurvey version
2. Set API to published, and test the link
3. Unsure your server (with the RC script) can connect to LimeSurvey server. For example here,
Code:
Warning: fopen(https://myservername/limesurvey2/admin/remotecontrol) [function.fopen]: failed to open stream: Connection timed out in /var/www/jsonrpcphp/includes/jsonRPCClient.php on line 132
show there are surely a fopen disable with the limesurvey website.

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.
More
5 years 8 months ago #171640 by MadhuraBL
Replied by MadhuraBL on topic Problem getting JSON-RPC Interface to work
Hi,

1. LimeSurvey version I am using is 2.63.1 (from version.php file)
2. It works fine in my local machine when the "Publish API" is off. Tried setting it ON and tested the link, I still get the same error.
3. Regarding error, I don't get fopen warning posted in this post. I only get "Unable to connect" error.

Full error description:
Fatal error: Uncaught exception 'Exception' with message 'Unable to connect to https://myservername/limesurvey2/admin/remotecontrol' in /var/www/jsonrpcphp/includes/jsonRPCClient.php:140 Stack trace: #0 [internal function]: jsonRPCClient->__call('get_session_key', Array) #1 /var/www/jsonrpcphp/includes/rpctest.php(11): jsonRPCClient->get_session_key('rpcuser', 'mypassword') #2 {main} thrown in /var/www/jsonrpcphp/includes/jsonRPCClient.php on line 140

Any suggestions much appreciated.
Thanks
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 8 months ago #171646 by DenisChenu
Replied by DenisChenu on topic Problem getting JSON-RPC Interface to work
Do a little PHP file with just a curl to the index. It's surely broke too .
In my opinion, it's not related to LimeSurvey.

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.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 8 months ago #171647 by DenisChenu
Replied by DenisChenu on topic Problem getting JSON-RPC Interface to work
PLEASE : DO NOT CROSSPOST !

www.limesurvey.org/forum/development/115...et-sessionkey/171642

I close this 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.

Lime-years ahead

Online-surveys for every purse and purpose