Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: Adding a Survey with the RPC

Adding a Survey with the RPC 1 Jahr 6 Monate her #87314

I'm using LimeSurvey Version 2.00+ Build 121024 and I'm having no luck adding a survey with the RPC. I'm putting in the correct parameters as far as I know it is:
$add_survey = $myJSONRPCClient->add_survey($sSessionKey, $iSurveyID, $sSurveyTitle, $sSurveyLanguage, $sformat = 'G');

Then I add a
print_r($add_survey);

Am I doing this correctly? When I load the page I get an Array with faulty parameters and I've tried changing the parameters over and over again.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Adding a Survey with the RPC 1 Jahr 5 Monate her #87922

  • rawson
  • rawsons Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 4
  • Dank erhalten: 1
  • Karma: 1
Try something like this:
$limesurvey = new jsonRPCClient('http://localhost/limesurvey/index.php/admin/remotecontrol/');
$sessionKey = $limesurvey->get_session_key('adminusername', 'adminpassword');
$survey = $limesurvey->add_survey($sessionKey, null, 'Survey Title', 'en', 'S');
$limesurvey->release_session_key($sessionKey);

passing null as the survey ID will have limesurvey generate one for you.

You will probably need to change the URL to the limesurvey installation (in this case http://localhost/limesurvey) as well as the username and password parameters of the get_session_key function
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Adding a Survey with the RPC 1 Jahr 5 Monate her #87923

Hmm thank you this seemed to work for me. The thing that I was missing was 'en' I had 'eng' for my language string. Also the survey that gets created is through a form so I had to set a variable for the survey ID because it is associated with a userid.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.270 Sekunden
Donation Image