- Posts: 9
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
You can see the group ID in the "List groups" screen or in the "Group summary" screen....but I don't know I tried looking into the details of the group but it only shows the name
<?php require_once 'jsonRPCClient.php'; define( 'LS_BASEURL', 'https://path/to/limeSurvey/'); define( 'LS_USER', 'adminUsername' ); define( 'LS_PASSWORD', 'adminPassword' ); $iSurveyID = 358123; // The survey ID $iGroupID = 44; // The group ID $sLanguage = 'en'; // The language $sImportData = 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxkb2N1bWVudD4NCiA8TGltZVN1cnZleURvY1R5cGU+UXVlc3Rpb248L0xpbWVTdXJ2ZXlEb2NUeXBlPg0KIDxEQlZlcnNpb24+MjU3PC9EQlZlcnNpb24+DQogPGxhbmd1YWdlcz4NCiAgPGxhbmd1YWdlPmVuPC9sYW5ndWFnZT4NCiA8L2xhbmd1YWdlcz4NCiA8cXVlc3Rpb25zPg0KICA8ZmllbGRzPg0KICAgPGZpZWxkbmFtZT5xaWQ8L2ZpZWxkbmFtZT4NCiAgIDxmaWVsZG5hbWU+cGFyZW50X3FpZDwvZmllbGRuYW1lPg0KICAgPGZpZWxkbmFtZT5zaWQ8L2ZpZWxkbmFtZT4NCiAgIDxmaWVsZG5hbWU+Z2lkPC9maWVsZG5hbWU+DQogICA8ZmllbGRuYW1lPnR5cGU8L2ZpZWxkbmFtZT4NCiAgIDxmaWVsZG5hbWU+dGl0bGU8L2ZpZWxkbmFtZT4NCiAgIDxmaWVsZG5hbWU+cXVlc3Rpb248L2ZpZWxkbmFtZT4NCiAgIDxmaWVsZG5hbWU+cHJlZzwvZmllbGRuYW1lPg0KICAgPGZpZWxkbmFtZT5oZWxwPC9maWVsZG5hbWU+DQogICA8ZmllbGRuYW1lPm90aGVyPC9maWVsZG5hbWU+DQogICA8ZmllbGRuYW1lPm1hbmRhdG9yeTwvZmllbGRuYW1lPg0KICAgPGZpZWxkbmFtZT5xdWVzdG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bl9hdHRyaWJ1dGVzPg0KPC9kb2N1bWVudD4NCg=='; // The Base64 Encoded lsq file $sImportDataType = 'lsq'; // Data type $sMandatory = 'N'; // Question mandatory? (optional) $sNewQuestionTitle = 'Q66'; // New question code (optional) $sNewqQuestion = 'This is new question text...'; // New text (optional) $sNewQuestionHelp = 'Some new question help...'; // New help text (optional) if(ctype_alnum($iSurveyID) && strlen($iSurveyID) == 6) { // Valid iSurveyID format // Instantiate a new RPC client $myJSONRPCClient = new jsonRPCClient( LS_BASEURL.'/index.php/admin/remotecontrol' ); // Get a session key $sSessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD ); // Add new question $newQuestion = $myJSONRPCClient->import_question($sSessionKey, $iSurveyID, $iGroupID, $sImportData, $sImportDataType, $sMandatory, $sNewQuestionTitle, $sNewqQuestion, $sNewQuestionHelp); // Release the session key $myJSONRPCClient->release_session_key( $sSessionKey ); } else { // Invalid iSurveyID format die( 'Invalid format!' ); } ?>