Welcome to the LimeSurvey Community Forum

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

Adding Welcome Message via the Remote Control API

More
3 years 6 months ago #241795 by SimonPressler
Please help us help you and fill where relevant:
Your LimeSurvey version:  5.6.11
Own server or LimeSurvey hosting: LimeSurvey hosting
Survey theme/template: fruity
==================
Dear Forum,
i have been using the API a lot lately, but i cannot locate the option to add a welcome text / description to the survey via API.
Is this possible, or should i stop searching?
Thanks in advance and best regards
Simon

Please Log in to join the conversation.

More
3 years 6 months ago #241804 by tpartner
You are looking for the set_language_properties() method - api.limesurvey.org/classes/remotecontrol..._language_properties .

Here is a quick PHP example:

Code:
<?php require_once 'jsonRPCClient.php'; define( 'LS_BASEURL', 'https://localhost/limeSurvey5x'); define( 'LS_USER', 'admin' ); define( 'LS_PASSWORD', 'password' ); $iSurveyID = 392446; if(ctype_alnum($iSurveyID) && (strlen($iSurveyID) == 5 || strlen($iSurveyID) == 6)) { // Valid SID 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 ); if(is_array($sSessionKey)) { // Invalid session echo $sSessionKey['status']; } else if($sSessionKey) { // Valid session $newTitle = 'TEST SURVEY 1'; $newDescription = 'Some survey description...'; $newWelcomeMsg = '<p style="font-weight: bold;">Some welcome message.</p><p>And, another paragraph.</p>'; $newEndMsg = 'Some end message...'; $aSurveyLocaleData = array( 'surveyls_title' => $newTitle, 'surveyls_description' => $newDescription, 'surveyls_welcometext' => $newWelcomeMsg, 'surveyls_endtext' => $newEndMsg ); $sLanguage = 'en'; $newLanguageProperties = $myJSONRPCClient->set_language_properties($sSessionKey, $iSurveyID, $aSurveyLocaleData, $sLanguage); print_r($newLanguageProperties); } // Release the session key $myJSONRPCClient->release_session_key( $sSessionKey ); } else { // Invalid SID format die( 'Invalid format!' ); } ?>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
3 years 6 months ago #241807 by SimonPressler
Once again, thank you very much!

Please Log in to join the conversation.

Moderators: tpartner, holch

Lime-years ahead

Online-surveys for every purse and purpose