Adding a Survey with the RPC

Mehr
5 Jahre 2 Monate her #87314 von rbauling0818
rbauling0818 erstellte das Thema Adding a Survey with the RPC
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.

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
5 Jahre 2 Monate her #87922 von rawson
rawson antwortete auf das Thema: Adding a Survey with the RPC
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

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
5 Jahre 2 Monate her #87923 von rbauling0818
rbauling0818 antwortete auf das Thema: Adding a Survey with the RPC
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.

Bitte Anmelden um an der Konversation teilzunehmen.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha