<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.limesurvey.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jweberhofer</id>
	<title>LimeSurvey Manual - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.limesurvey.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jweberhofer"/>
	<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/Special:Contributions/Jweberhofer"/>
	<updated>2026-08-14T05:34:53Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Optional_settings&amp;diff=174857</id>
		<title>Optional settings</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Optional_settings&amp;diff=174857"/>
		<updated>2022-10-17T09:18:18Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: Documented maxLoginAttemptParticipants and timeOutParticipants&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;languages /&amp;gt; &amp;lt;translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:63--&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:83--&amp;gt;&lt;br /&gt;
The following section is addressed to those of you who would like to edit those configuration settings that could not be modified with the help of the GUI (Graphical User Interface) of the LimeSurvey installation. Please bear in mind that all the changes from the LimeSurvey root directory are done at your own risk. Nevertheless, in the case in which you are experiencing problems/need further guidance, join the [https://www.limesurvey.org/forum discussion forums] or the [irc://irc.freenode.net/limesurvey|IRC IRC channel] for help from the LimeSurvey community.&lt;br /&gt;
&lt;br /&gt;
=Introduction= &amp;lt;!--T:2--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:3--&amp;gt;&lt;br /&gt;
To modify the configuration settings of the installation, you have to edit the optional settings. They can be found in the /application/config/&#039;&#039;&#039;config-defaults.php&#039;&#039;&#039;, which is located in the LimeSurvey root directory. The default settings of the standard installation can be found in config-defaults.php. Some of them can be overridden by using the [[Global settings|global settings]] dialog, while the others will have to be manually edited.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:69--&amp;gt;&lt;br /&gt;
{{Alert|If you want to change these settings, please do not change them in config-defaults.php, but copy the particular setting/line to /application/config/&#039;&#039;&#039;config.php&#039;&#039;&#039; in &amp;lt;nowiki&amp;gt;&#039;config&#039;=&amp;gt;array( )&amp;lt;/nowiki&amp;gt; and change it there. All the newly modified/introduced settings from the config.php file will override the default values from config-defaults.php.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:84--&amp;gt;&lt;br /&gt;
When an upgrade occurs, only the config-defaults.php settings are changed. Therefore, editing the config.php file will save your customized settings. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:70--&amp;gt;&lt;br /&gt;
To update/add the LimeSurvey settings in /application/&#039;&#039;&#039;config/config.php&#039;&#039;&#039;, you have to update the config array:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;pre&amp;quot;&amp;gt;&lt;br /&gt;
    &#039;config&#039;=&amp;gt;array(&lt;br /&gt;
        &#039;debug&#039;=&amp;gt;0,&lt;br /&gt;
        &#039;debugsql&#039;=&amp;gt;0,&lt;br /&gt;
        &#039;LimeSurveySetting&#039;=&amp;gt;&#039;New value&#039;, // Update default LimeSurvey config here&lt;br /&gt;
    )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Yii settings= &amp;lt;!--T:71--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:97--&amp;gt;&lt;br /&gt;
LimeSurvey uses the Yii framework, which has its own configuration parameters in application/config/&#039;&#039;&#039;internal.php&#039;&#039;&#039; and application/config/&#039;&#039;&#039;config.php&#039;&#039;&#039; file. You can also access some specific configuration settings of LimeSurvey via the Yii configuration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:98--&amp;gt;&lt;br /&gt;
Since config.php array is merged to the whole config, you can replace any Yii params in the config.php file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:72--&amp;gt;&lt;br /&gt;
The Yii specific settings are set in the components array:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;pre&amp;quot;&amp;gt;&lt;br /&gt;
    &#039;components&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;db&#039; =&amp;gt; array(&lt;br /&gt;
            ....&lt;br /&gt;
        ),&lt;br /&gt;
        &#039;Specific settings&#039;=&amp;gt;array(&lt;br /&gt;
            ....&lt;br /&gt;
        ),&lt;br /&gt;
    ),&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:85--&amp;gt;&lt;br /&gt;
{{Note|For more information about the Yii framework, please access the [http://www.yiiframework.com/doc-2.0/guide-index.html following link.]}}&lt;br /&gt;
&lt;br /&gt;
==Database settings== &amp;lt;!--T:73--&amp;gt;&lt;br /&gt;
The database settings are written to config.php by the installer file when you install LimeSurvey for the first time. If needed, you can update this part of the config.php file. Please remember that you do this at your own risk!&lt;br /&gt;
See also the [http://www.yiiframework.com/doc/blog/1.1/en/prototype.database#establishing-database-connection Yii documentation] and please remember that LimeSurvey supports only the following types of database: mysql, pgsql, dblib, mssql, and sqlsrv.&lt;br /&gt;
&lt;br /&gt;
==Session settings== &amp;lt;!--T:74--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:99--&amp;gt;&lt;br /&gt;
You can set some session parameters in config.php (check the two examples from below). You can uncomment/add the part needed in config.php. See the [http://www.yiiframework.com/doc/api/1.1/CHttpSession Yii Documentation] for other settings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:100--&amp;gt;&lt;br /&gt;
{{Alert|If you need to update session settings to have multiple LimeSurvey instances running on the same server, check if you don&#039;t have to update [[Optional_settings#Request_settings|request settings]] for crsf cookie.}}&lt;br /&gt;
&lt;br /&gt;
===Use table-based sessions=== &amp;lt;!--T:101--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:102--&amp;gt;&lt;br /&gt;
LimeSurvey can use table-based sessions, you find a commented part on the default config.php generated file. To use table-based session, remove the // before each line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:103--&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;pre&amp;quot;&amp;gt;&lt;br /&gt;
        &#039;session&#039; =&amp;gt; array (&lt;br /&gt;
            &#039;class&#039; =&amp;gt; &#039;application.core.web.DbHttpSession&#039;,&lt;br /&gt;
            &#039;connectionID&#039; =&amp;gt; &#039;db&#039;,&lt;br /&gt;
            &#039;sessionTableName&#039; =&amp;gt; &#039;{{sessions}}&#039;,&lt;br /&gt;
        ),&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:104--&amp;gt;&lt;br /&gt;
{{Alert|Table-based sessions are currently not supported on MSSQL server.}}&lt;br /&gt;
&lt;br /&gt;
===Other sessions update=== &amp;lt;!--T:105--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:75--&amp;gt;&lt;br /&gt;
If you use SSL (&#039;https&#039;) for your LimeSurvey installation, adding the following lines to your config.php will increase the security of the session:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;pre&amp;quot;&amp;gt;        // Set the cookie via SSL&lt;br /&gt;
        &#039;session&#039; =&amp;gt; array (&lt;br /&gt;
            &#039;cookieParams&#039; =&amp;gt; array(&lt;br /&gt;
                    &#039;secure&#039; =&amp;gt; true, // use SSL for cookies&lt;br /&gt;
                    &#039;httponly&#039; =&amp;gt; true // Cookies may not be used by other protocols - experimental&lt;br /&gt;
                ),&lt;br /&gt;
            ),&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:76--&amp;gt;&lt;br /&gt;
If you want to fix the domain for a cookie, use the following syntax in config.php:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;pre&amp;quot;&amp;gt;        // Set the domain for cookie&lt;br /&gt;
        &#039;session&#039; =&amp;gt; array (&lt;br /&gt;
            &#039;cookieParams&#039; =&amp;gt; array(&lt;br /&gt;
                    &#039;domain&#039; =&amp;gt; &#039;.example.org&#039;,&lt;br /&gt;
                ),&lt;br /&gt;
            ),&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:95--&amp;gt;&lt;br /&gt;
If you have mutiples installation on the same server, it can be more quick and easy to set different session name for each LimeSurvey instance. This can be need for IE11 in some condition (see [https://bugs.limesurvey.org/view.php?id=12083#c42892 issue 12083])&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;pre&amp;quot;&amp;gt;        // Set the name of the session&lt;br /&gt;
        &#039;session&#039; =&amp;gt; array (&lt;br /&gt;
            &#039;sessionName&#039; =&amp;gt; &amp;quot;LimeSurveyN1&amp;quot;,&lt;br /&gt;
            ),&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Request settings== &amp;lt;!--T:77--&amp;gt;&lt;br /&gt;
The request settings are important, but the default settings are already optimized for LimeSurvey usage. To read more about them, see the [http://www.yiiframework.com/doc/api/1.1/CHttpRequest Yii Documentation].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:81--&amp;gt;&lt;br /&gt;
For example, the LimeSurvey request settings configuration may be modified in the following way (at your own risk) :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;pre&amp;quot;&amp;gt;        // Disable CSRF protection&lt;br /&gt;
        &#039;request&#039; =&amp;gt; array(&lt;br /&gt;
            &#039;enableCsrfValidation&#039;=&amp;gt;false,    &lt;br /&gt;
            ),&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;pre&amp;quot;&amp;gt;        // Enforce a certain URL base &lt;br /&gt;
        &#039;request&#039; =&amp;gt; array(&lt;br /&gt;
            &#039;hostInfo&#039; =&amp;gt; &#039;http://www.example.org/&#039;  &lt;br /&gt;
            ),&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;pre&amp;quot;&amp;gt;        // Set the cookie domain name and path for CSRF protection, path is used if you have different instance on same domain&lt;br /&gt;
        &#039;request&#039; =&amp;gt; array(&lt;br /&gt;
            &#039;csrfCookie&#039; =&amp;gt; array( &lt;br /&gt;
                &#039;domain&#039; =&amp;gt; &#039;.example.com&#039;,&lt;br /&gt;
                &#039;path&#039; =&amp;gt; &#039;/limesurvey/&#039;,&lt;br /&gt;
            )&lt;br /&gt;
        ),&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:82--&amp;gt;&lt;br /&gt;
If you need to update only the url for token emails, set your [[Optional_settings#Advanced_path_settings|publicurl]] in your config.php file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Allow usage of session and Csrf Validation in iFrame {{NewIn|v=3.24.3}}== &amp;lt;!--T:118--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:119--&amp;gt;&lt;br /&gt;
After allow [[Global_settings#Security|Iframe embedding]] you need to update some configuration part. Attention, even with all settings : allow form in iframe can broke on some browser. This settings was tested with Firefox 81.0.2 and Chromium 85.0.4183.121.&lt;br /&gt;
&lt;br /&gt;
===Allow session start in iframe=== &amp;lt;!--T:120--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:121--&amp;gt;&lt;br /&gt;
The session need to be secure (valid https) , httponly and samesite to None. All settings must be sent all lowercase.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:122--&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;pre&amp;quot;&amp;gt; 		 &#039;session&#039; =&amp;gt; array (&lt;br /&gt;
			&#039;sessionName&#039;=&amp;gt;&#039;LS-VBXZZORFJZCAKGYI&#039;,&lt;br /&gt;
			// Uncomment the following lines if you need table-based sessions.&lt;br /&gt;
			// Note: Table-based sessions are currently not supported on MSSQL server.&lt;br /&gt;
			// &#039;class&#039; =&amp;gt; &#039;application.core.web.DbHttpSession&#039;,&lt;br /&gt;
			// &#039;connectionID&#039; =&amp;gt; &#039;db&#039;,&lt;br /&gt;
			// &#039;sessionTableName&#039; =&amp;gt; &#039;{{sessions}}&#039;,&lt;br /&gt;
			&#039;cookieParams&#039; =&amp;gt; array(&lt;br /&gt;
				&#039;secure&#039; =&amp;gt; true,&lt;br /&gt;
				&#039;httponly&#039; =&amp;gt; true,&lt;br /&gt;
				&#039;samesite&#039; =&amp;gt; &#039;None&#039;,&lt;br /&gt;
			),&lt;br /&gt;
		 ),&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Allow csrf cookie in iframe=== &amp;lt;!--T:123--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:124--&amp;gt;&lt;br /&gt;
Same than session: must be secure and samesite to None. Whole array must be added at same level than session&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:125--&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;pre&amp;quot;&amp;gt;		&#039;request&#039; =&amp;gt; array(&lt;br /&gt;
			&#039;enableCsrfValidation&#039;=&amp;gt;true,&lt;br /&gt;
			&#039;csrfCookie&#039; =&amp;gt; array(&lt;br /&gt;
				&#039;sameSite&#039; =&amp;gt; &#039;None&#039;,&lt;br /&gt;
				&#039;secure&#039; =&amp;gt; true,&lt;br /&gt;
			),&lt;br /&gt;
		),&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==URL settings== &amp;lt;!--T:78--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:127--&amp;gt;&lt;br /&gt;
{{Alert|If you need to update only the url for token and other emails, set your [[Optional_settings#Advanced_url_settings|publicurl]] in your config.php file.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:128--&amp;gt;&lt;br /&gt;
To change the default URL settings, update the urlManager:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;pre&amp;quot;&amp;gt;       // Use short URL&lt;br /&gt;
		&#039;urlManager&#039; =&amp;gt; array(&lt;br /&gt;
			&#039;urlFormat&#039; =&amp;gt; &#039;path&#039;,&lt;br /&gt;
			&#039;showScriptName&#039; =&amp;gt; false,&lt;br /&gt;
		),&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:129--&amp;gt;&lt;br /&gt;
You can also add .html after the survey id in the following way:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;pre&amp;quot;&amp;gt;       // Use short URL&lt;br /&gt;
		&#039;urlManager&#039; =&amp;gt; array(&lt;br /&gt;
			&#039;urlFormat&#039; =&amp;gt; &#039;path&#039;,&lt;br /&gt;
			&#039;rules&#039; =&amp;gt; array (&lt;br /&gt;
			    &#039;&amp;lt;sid:\d+&amp;gt;&#039; =&amp;gt; array(&#039;survey/index&#039;,&#039;urlSuffix&#039;=&amp;gt;&#039;.html&#039;,&#039;matchValue&#039;=&amp;gt;true),&lt;br /&gt;
			 ),&lt;br /&gt;
			&#039;showScriptName&#039; =&amp;gt; false,&lt;br /&gt;
		),&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
For more information, check the [http://www.yiiframework.com/doc/guide/1.1/en/topics.url Yii documentation].&lt;br /&gt;
&lt;br /&gt;
==Logging settings== &amp;lt;!--T:86--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:87--&amp;gt;&lt;br /&gt;
Yii provides different solutions to generate logs. To find out more about them, check the [http://www.yiiframework.com/doc/guide/1.1/en/topics.logging logging special topic]. LimeSurvey uses &#039;1&#039; or &#039;2&#039; by default, which allows every web user to see the logs. You can create your own settings using Yii directly.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:88--&amp;gt;&lt;br /&gt;
For example, a quick solution to log errors and warnings in files is: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;pre&amp;quot;&amp;gt;&lt;br /&gt;
return array(&lt;br /&gt;
	&#039;components&#039; =&amp;gt; array(&lt;br /&gt;
		/* Other component part here &#039;db&#039; for example */&lt;br /&gt;
		&#039;log&#039; =&amp;gt; array(&lt;br /&gt;
			&#039;routes&#039; =&amp;gt; array(&lt;br /&gt;
				&#039;fileError&#039; =&amp;gt; array(&lt;br /&gt;
					&#039;class&#039; =&amp;gt; &#039;CFileLogRoute&#039;,&lt;br /&gt;
					&#039;levels&#039; =&amp;gt; &#039;warning, error&#039;,&lt;br /&gt;
					&#039;except&#039; =&amp;gt; &#039;exception.CHttpException.404&#039;,&lt;br /&gt;
				),&lt;br /&gt;
			),&lt;br /&gt;
		),&lt;br /&gt;
		/* Other component part here &#039;urlManager&#039; for example */&lt;br /&gt;
	),&lt;br /&gt;
	/* Final part (with &#039;runtimePath&#039; &#039;config&#039; for example) */&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:89--&amp;gt;&lt;br /&gt;
{{Hint|Text=The file is saved by default to &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;limesurvey/tmp/runtime/application.log&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, which is located in the LimeSurvey root folder.}}&lt;br /&gt;
{{Alert|Yii uses runtime path. By default, the logs are web accessible. They may contain a lot of information from your server. It is better to use a directory that cannot be accessed via the web. You can set it in routes or by updating  the [[Optional settings#Yii settings#Runtime path|Runtime path]].}}.&lt;br /&gt;
&lt;br /&gt;
==Runtime path== &amp;lt;!--T:90--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:91--&amp;gt;&lt;br /&gt;
[http://www.yiiframework.com/doc/guide/1.1/en/basics.convention#directory The runtime path] must be a readable and writable directory for the “web user”. However, the runtime path contains files with potential security information that are located in the public web access area. LimeSurvey collects these files in the temp directory of the LimeSurvey root directory. In order to eliminate the access to such important data, you can set the runtime path outside the public web access by editing the respective lines in the /application/config/config.php file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:92--&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;pre&amp;quot;&amp;gt; &lt;br /&gt;
return array(&lt;br /&gt;
  &#039;components&#039; =&amp;gt; array(&lt;br /&gt;
    […]&lt;br /&gt;
    &#039;runtimePath&#039;=&amp;gt;&#039;/var/limesurvey/runtime/&#039;,&lt;br /&gt;
    &#039;config&#039;=&amp;gt;array(&lt;br /&gt;
    […]&lt;br /&gt;
    )&lt;br /&gt;
  )&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=General settings= &amp;lt;!--T:4--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:64--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;sitename&#039;&#039;&#039;: Gives your survey site a name. This name will appear in the survey list overview and in the administration header. The default value is &#039;LimeSurvey&#039; and it can be overridden in the [[Global settings|global settings]] dialog or edited in config.php.&lt;br /&gt;
*&#039;&#039;&#039;siteadminemail:&#039;&#039;&#039; This is the default email address of the site administrator and it is used for system messages and contact options. This setting is used only as default value and can be overridden in the [[Global settings|global settings]] dialog.&lt;br /&gt;
*&#039;&#039;&#039;siteadminbounce:&#039;&#039;&#039; This is the email address where bounced emails will be sent to. This setting is used only as default value and can be  overridden by the [[Global settings|global settings]] dialog.&lt;br /&gt;
*&#039;&#039;&#039;siteadminname:&#039;&#039;&#039; The real name of the site administrator. This setting is used only as default value and can be overridden in the [[Global settings|global settings]] dialog).&lt;br /&gt;
*&#039;&#039;&#039;proxy_host_name:&#039;&#039;&#039; This is the host name of your proxy server (it has to be mentioned if you are behind a proxy and you want to update LimeSurvey using [[ComfortUpdate|ComfortUpdate]]).&lt;br /&gt;
*&#039;&#039;&#039;proxy_host_port:&#039;&#039;&#039; This is the port of your proxy server (it has to be mentioned if you are behind a proxy and you want to update LimeSurvey  using [[ComfortUpdate|ComfortUpdate]]).&lt;br /&gt;
&lt;br /&gt;
= Security= &amp;lt;!--T:5--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:65--&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;maxLoginAttempt&#039;&#039;&#039;: This is the number of attempts a user has to enter the correct password before he or she gets her or his IP address blocked/locked out. The default value is 3 and it can be modified from config.php. &lt;br /&gt;
* &#039;&#039;&#039;timeOutTime&#039;&#039;&#039;: If the user enters the password incorrectly for &amp;lt;maxLoginAttempt&amp;gt;, she or he gets locked out for &amp;lt;timeOutTime&amp;gt; seconds. The default value is 10 minutes and it can be modified from config.php.&lt;br /&gt;
* &#039;&#039;&#039;maxLoginAttemptParticipants&#039;&#039;&#039;: This is the number of attempts a participant has to enter a valid token before he or she gets her or his IP address blocked/locked out. The default value is 3 and it can be modified from config.php. &lt;br /&gt;
* &#039;&#039;&#039;timeOutParticipants&#039;&#039;&#039;: If the participant enters the token incorrectly for &amp;lt;maxLoginAttemptParticipants&amp;gt;, she or he gets locked out for &amp;lt;timeOutParticipants&amp;gt; seconds. The default value is 10 minutes and it can be modified from config.php.&lt;br /&gt;
* &#039;&#039;&#039;surveyPreview_require_Auth&#039;&#039;&#039;: Set to true by default. If you set this to &#039;false&#039;, any person can test your survey using the survey URL, without logging in to the administration panel and without having to activate the survey first. This setting is a default value and can be overridden in the [[Global settings|global settings]] dialog or edited in config.php.&lt;br /&gt;
* &#039;&#039;&#039;usercontrolSameGroupPolicy&#039;&#039;&#039;: Set to true by default. By default, non-admin users defined in the LimeSurvey management interface will only be able to see users they create or users that belong to at least one same group. The default value can be overridden in the [[Global settings|global settings]] dialog or edited in config.php.&lt;br /&gt;
*&#039;&#039;&#039;filterxsshtml:&#039;&#039;&#039; This setting enables the filtering of suspicious html tags located within surveys, groups, and questions and answer texts in the administration interface. Leave this to &#039;false&#039; only if you absolutely trust the users you created for the administration of LimeSurvey and if you want to allow these users to be able to use Javascript, Flash Movies, etc.. &amp;lt;span class=&amp;quot;warning&amp;quot;&amp;gt;The super admins never have their HTML filtered&amp;lt;/span&amp;gt;.  The default value can be overridden in the [[Global settings|global settings]] dialog or edited in config.php.&lt;br /&gt;
*&#039;&#039;&#039;demoMode:&#039;&#039;&#039; If this option is set to &#039;true&#039; in config.php, then LimeSurvey will go into demo mode. The demo mode changes the following things:&lt;br /&gt;
** Disables admin user&#039;s details and password changing;&lt;br /&gt;
** Disables the upload of files on the template editor;&lt;br /&gt;
** Disables sending email invitations and reminders;&lt;br /&gt;
** Disables the creation of a database dump;&lt;br /&gt;
** Disables the ability to modify the following global settings: site name, default language, default HTML editor mode, XSS filter.&lt;br /&gt;
*&#039;&#039;&#039;forcedsuperadmin:&#039;&#039;&#039; Array of user id whith all rights on all LimeSurvey. This settings can only be updated in config.php file.  This user&#039;s rights can not be edited in [[Manage_users#Set_global_permissions_for_a_user|global permissions for a user]] even by other forced super administrator. By default : user with this rights is user with id : 1. The first user created just after installation.&lt;br /&gt;
*&#039;&#039;&#039;force_ssl:&#039;&#039;&#039; forces LimeSurvey to run through HTTPS or to block HTTPS. See [https://manual.limesurvey.org/Global_settings#Security Force HTTPS] in global settings admin GUI.&lt;br /&gt;
*&#039;&#039;&#039;ssl_emergency_override:&#039;&#039;&#039; This setting forces SSL off. If You&#039;ve turned HTTPS/SSL on in the global settings but your server doesn&#039;t have HTTPS enabled, the only way to turn it off is by changing a value in the database directly. This allows you to force HTTPS off while you change the global settings for Force Secure. This should always be false except in emergencies where you change it to true until you fix the problem. This setting can be only set via config.php file.&lt;br /&gt;
*&#039;&#039;&#039;ssl_disable_alert:&#039;&#039;&#039; Disable alert for super-admin about unforced SSL, if you really can not or don&#039;t want to force ssl.  This setting can be only set via config.php file.&lt;br /&gt;
&lt;br /&gt;
= Resources= &amp;lt;!--T:6--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;sessionlifetime:&#039;&#039;&#039; Defines the time in seconds after which a survey session expires. It applies only if you are using database sessions. If you do use database sessions, change the parameter in config.php or override the default value from the [[Global settings|global settings]] dialog.&lt;br /&gt;
*&#039;&#039;&#039;memorylimit:&#039;&#039;&#039; This determines how much memory LimeSurvey can access. &#039;128 MB&#039; is the minimum (MB=Megabyte) recommended. If you receive time out errors or have problems generating statistics or exporting files, raise this limit to &#039;256 MB&#039; or higher. If your web server has set a higher limit in config.php, then this setting will be ignored. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:7--&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;warningbox&amp;quot;&amp;gt;&#039;&#039;&#039;Please bear in mind that such local settings can always be overruled by the changes done in the global settings dialog&#039;&#039;&#039;.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:66--&amp;gt;&lt;br /&gt;
To increase the memory limit to 128M you could also try adding:&lt;br /&gt;
*memory_limit = 128M to your server&#039;s main php.ini file (recommended, if you have access)&lt;br /&gt;
*memory_limit = 128M to a php.ini file in the LimeSurvey root&lt;br /&gt;
*php_value memory_limit 128M in a .htaccess file in the LimeSurvey root&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:94--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;max_execution_time:&#039;&#039;&#039; Set the number of seconds a script is allowed to run. If this is reached, the script returns a fatal error. To be allowed to export big survey data and statistics, LimeSurvey try to set it by default to 1200 seconds. You can set a bigger time or a lower time if needed. Only accessible via php config file.&lt;br /&gt;
&lt;br /&gt;
=Appearance= &amp;lt;!--T:8--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;dropdownthreshold&#039;&#039;&#039;{{ObsoleteIn|2.50}}: When &amp;quot;R&amp;quot; is selected for &amp;lt;code&amp;gt;$dropdowns&amp;lt;/code&amp;gt;, the administrator is allowed to set a maximum number of options that will be displayed as radio buttons, before converting back to a dropdown list. If there is a question that has a large number of options, displaying all of them at once as radio buttons can look unwieldy, and can become counter-intuitive to users. Setting this to a maximum of, say 25 (which is the default) means that large lists are easier to be used by the administrators for the survey participant.&lt;br /&gt;
*&#039;&#039;&#039;repeatheadings:&#039;&#039;&#039; With the Array question type, you&#039;ll often have a lot of subquestions, which - when displayed on screen - take up more than one page. This setting lets you decide how many subquestions should be displayed before repeating the header information for the question. A good setting for this is around 15. If you don&#039;t want the headings to repeat at all, set this to 0. This setting is overridden in the [[Global settings|global settings]] dialog {{NewIn|2.05}}.&lt;br /&gt;
*&#039;&#039;&#039;minrepeatheadings:&#039;&#039;&#039; The minimum number of remaining subquestions that are required before repeating the headings in Array questions. The default value is 3 and it can be edited in config.php. &lt;br /&gt;
*&#039;&#039;&#039;defaulttemplate:&#039;&#039;&#039; This setting specifies the default theme used for the &#039;public list&#039; of surveys. This setting can be overridden in the [[Global settings|global settings]] dialog or edited in config.php.&lt;br /&gt;
*&#039;&#039;&#039;defaulthtmleditormode:&#039;&#039;&#039; Sets the default mode for the integrated HTML editor. This setting can be overridden in the [[Global settings|global settings]] dialog or edited in config.php. The valid settings are:&lt;br /&gt;
** &#039;inline&#039; - Inline replacement of fields by an HTML editor. Slow but convenient and user friendly;&lt;br /&gt;
** &#039;popup&#039; - Adds an icon that runs the HTML editor in a popup if needed. Faster, but HTML code is displayed in the form;&lt;br /&gt;
** &#039;none&#039;-  No HTML editor;&lt;br /&gt;
*&#039;&#039;&#039;column_style:&#039;&#039;&#039; Defines how columns are rendered for survey answers when using [[QS:Display_columns|display_columns]]. It can be edited in the config.php file. The valid settings are: &lt;br /&gt;
** &#039;css&#039; - it uses one of the various CSS methods to create columns (see the template style sheet for details);&lt;br /&gt;
** &#039;ul&#039; - the columns are rendered as multiple floated unordered lists (default);&lt;br /&gt;
** &#039;table&#039; - it uses conventional-tables-based layout;&lt;br /&gt;
** NULL - it disables the use of columns.&lt;br /&gt;
&lt;br /&gt;
=Language &amp;amp; time= &amp;lt;!--T:9--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;defaultlang:&#039;&#039;&#039; This should be set to the default language to be used in your administration scripts, and also the default setting for language in the public survey list. This setting can be overridden in the [[Global settings|global settings]] dialog or edited in config.php.&lt;br /&gt;
*&#039;&#039;&#039;timeadjust:&#039;&#039;&#039; If your web server is in a different time zone to the location where your surveys will be based, put the difference between your server and your home time zone here. For example, I live in Australia, but I use a US web server. The web server is 14 hours behind my local time zone. So my setting here is &amp;quot;14&amp;quot;. In other words, it adds 14 hours to the web servers time. This setting is particularly important when surveys timestamp the responses. This setting can be overridden in the [[Global settings|global settings]] dialog or edited in config.php.&lt;br /&gt;
&lt;br /&gt;
=Survey behavior= &amp;lt;!--T:10--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;deletenonvalues:&#039;&#039;&#039; Use this feature with caution. By default (a value of 1), irrelevant questions are NULLed in the database. This ensures that the data in your database is internally consistent. However, there are rare cases where you might want to hold onto irrelevant values, in which case you can set the value to 0. For example, you ask a male person his gender, and he accidentally says &#039;female&#039; and then answers some female-specific questions (questions that are conditioned on being female, so are only relevant for women). Then, he realizes his mistake, backs up, sets the gender to &#039;male&#039;, and continues with the survey.  Now, the female-specific questions are irrelevant. If &amp;lt;code&amp;gt;$deletenonvalues==1&amp;lt;/code&amp;gt;, those irrelevant values will be cleared (NULLed) in the database. If &amp;lt;code&amp;gt;$deletenonvalues==0&amp;lt;/code&amp;gt;, his erroneous answers will not be deleted, so they will still be present in the database when you analyze it. &lt;br /&gt;
*&#039;&#039;&#039;shownoanswer:&#039;&#039;&#039; When a radio button/select type question that contains editable answers (i.e.: List, Array questions) is not mandatory and &#039;shownoanswer&#039; is set to 1, an additional &#039;No answer&#039; entry is shown - so that participants may choose to not answer the question. Some people prefer this not to be available. This setting can be overridden from the [[Global settings|global settings]] dialog or edited in config.php. Valid values are:&lt;br /&gt;
**&#039;0&#039;: No; &lt;br /&gt;
**&#039;1&#039;: Yes;&lt;br /&gt;
**&#039;2&#039;: The Survey admin can choose.  &lt;br /&gt;
*&#039;&#039;&#039;printanswershonorsconditions:&#039;&#039;&#039; This setting determines if the printanswers feature will display entries from questions that were hidden by conditions-branching (Default: 1 = hide answers from questions hidden by conditions).&lt;br /&gt;
*&#039;&#039;&#039;hide_groupdescr_allinone:&#039;&#039;&#039; This setting is relevant for all-in-one surveys using conditions . When this is set to &#039;true&#039;, the group name and description is hidden if all questions in the group are hidden. The default value is &#039;true&#039;  - hides group name and description when all questions in the group are hidden by conditions. It can be edited in config.php.&lt;br /&gt;
*&#039;&#039;&#039;showpopups:&#039;&#039;&#039;  Show popup messages if mandatory or conditional questions have not been answered correctly:&lt;br /&gt;
**   &#039;2&#039; = defined by Theme option (default)&lt;br /&gt;
**   &#039;1&#039;= show popup message;&lt;br /&gt;
**   &#039;0&#039;= show message on page instead;&lt;br /&gt;
** &#039;-1&#039;= do not show the message at all (in this case, users will still see the question-specific tips indicating which questions must be answered).&lt;br /&gt;
&lt;br /&gt;
== Numerical question type behavior  == &amp;lt;!--T:111--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:112--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;bFixNumAuto:&#039;&#039;&#039; Numeric fields can be automatically filtered to remove all non numeric values. By default this is enable, you can disable it globally. This settings is related to &#039;&#039;Fix automatically numeric value&#039;&#039; in core theme options. It was enable for &#039;&#039;Yes&#039;&#039;, disable for &#039;&#039;Only for expression&#039;&#039; and &#039;&#039;No&#039;&#039;.&lt;br /&gt;
*&#039;&#039;&#039;bNumRealValue:&#039;&#039;&#039; Numeric fields used in expression manager can be fixed or not. It&#039;s fixed by default. If NUMERIC is a numerical question : disable or 0 : {NUMERIC} with bad caracters send &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;, enable or 1 : {NUMERIC} send all character entered. This settings is related to &#039;&#039;Fix automatically numeric value&#039;&#039; in core theme options. It was enable for &#039;&#039;Yes&#039;&#039; and &#039;&#039;Only for expression&#039;&#039; and  disable for &#039;&#039;No&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Development and debugging= &amp;lt;!--T:11--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;debug:&#039;&#039;&#039; With this setting, you set the PHP error reporting to E_ALL. This means that every little notice, warning or error related to the script is shown. This setting should be only switched to &#039;1&#039; if you are trying to debug the application for any reason. If you are a developer, switch it to &#039;2&#039;. Don&#039;t switch it to &#039;1&#039; or &#039;2&#039; in production since it might cause path disclosure. The default value is &#039;0&#039; and it can be edited in config.php. &lt;br /&gt;
*&#039;&#039;&#039;debugsql:&#039;&#039;&#039; Activate this setting if you want to display all SQL queries executed for the script on the bottom of each page. Very useful for the optimization of the the number of queries. In order to activate it, change the default value to &#039;1&#039; from the config.php file.&lt;br /&gt;
*&#039;&#039;&#039;use_asset_manager:&#039;&#039;&#039; By default : debug mode disable asset manager, you can allow you to use asse manager with debug mode enable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:79--&amp;gt;&lt;br /&gt;
In the case in which you experience an error in the application, we strongly recommend to activate the debug setting in order to get a more detailed error that you can submit with the bug report:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:80--&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;pre&amp;quot;&amp;gt;&lt;br /&gt;
    &#039;config&#039;=&amp;gt;array(&lt;br /&gt;
        &#039;debug&#039;=&amp;gt;2,&lt;br /&gt;
        &#039;debugsql&#039;=&amp;gt;0,&lt;br /&gt;
    )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:126--&amp;gt;&lt;br /&gt;
If you work on plugin and need a quick way to dump variables on screen : you can use traceVar function. If debug is set : this function use CWebLogRoute to be shown on HTML page. Usage &amp;lt;code&amp;gt;traceVar($MyVariable)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Email settings= &amp;lt;!--T:12--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:13--&amp;gt;&lt;br /&gt;
All the settings from below can be overridden in the [[Global settings|global settings]] dialog.&lt;br /&gt;
*&#039;&#039;&#039;emailmethod:&#039;&#039; This determines how email messages are being sent. The following options are available:&lt;br /&gt;
**&#039;mail:&#039; it uses internal PHP mailer;&lt;br /&gt;
**&#039;sendmail:&#039; it uses sendmail mailer;&lt;br /&gt;
**&#039;smtp:&#039; it uses SMTP relaying. Use this setting when you are running LimeSurvey on a host that is not your mail server.&lt;br /&gt;
*&#039;&#039;&#039;emailsmtphost:&#039;&#039; If you use &#039;smtp&#039; as &amp;lt;code&amp;gt;$emailmethod&amp;lt;/code&amp;gt;, then you have to put your SMTP-server here. If you are using Google mail you might have to add the port number like $emailsmtphost = &#039;smtp.gmail.com:465&#039;.&lt;br /&gt;
*&#039;&#039;emailsmtpuser:&#039;&#039; If your SMTP-server needs authentication then set this to your user name, otherwise it must be blank.&lt;br /&gt;
*&#039;&#039;emailsmtppassword:&#039;&#039; If your SMTP-server needs authentication then set this to your password, otherwise it must be blank.&lt;br /&gt;
*&#039;&#039;emailsmtpssl:&#039;&#039; Set this to &#039;ssl&#039; or &#039;tls&#039; to use SSL/TLS for SMTP connection.&lt;br /&gt;
*&#039;&#039;maxemails:&#039;&#039; When sending invitations or reminders to survey participants, this setting is used to determine how many emails can be sent in one bunch. Different web servers have different email capacities and if your script takes too long to send a bunch of emails, the script could time out and cause errors. Most web servers can send 100 emails at a time within the default 30 second time limit for a PHP script. If you get script timeout errors when sending large numbers of emails, reduce the number in this setting. Clicking the &#039;send email invitation&#039; button from the token control toolbar (not the button situated on the right of each token) sends the &amp;lt;maxemails&amp;gt; number of invitations, then it displays a list of the addresses of the recipients and a warning that &#039;&#039;there are more emails pending than could be sent in one batch. Continue sending emails by clicking below. There are ### emails still to be sent.&#039;&#039; and provides a &amp;quot;continue button&amp;quot; to proceed with the next batch. I.e., the user determines when to send the next batch after each batch gets emailed. It is not necessary to wait with this screen active. The admin could log out and come back at a later time to send the next batch of invites.&lt;br /&gt;
&lt;br /&gt;
= Statistics and response browsing= &amp;lt;!--T:14--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;filterout_incomplete_answers:&#039;&#039;&#039; Control the default behavior of filtering incomplete answers when browsing or analyzing responses. For a discussion on incomplete responses see our [[Responses &amp;amp; statistics#Responses summary|browsing survey results wiki]]. Since these records can corrupt the statistics, an option is given to switch this filter on or off in several GUI forms. The parameter can be edited in the config.php. The following options are available:&lt;br /&gt;
**&#039;show&#039;: Allows you to visualize both complete and incomplete answers;&lt;br /&gt;
**&#039;filter&#039;: It shows only complete answers;&lt;br /&gt;
**&#039;incomplete&#039;: Show only incomplete answers.&lt;br /&gt;
*&#039;&#039;&#039;strip_query_from_referer_url&#039;&#039;&#039;: This setting determines if the referrer URL saves the parameter or not. The default value is &#039;false&#039; (in this case, the referrer URL saves all parameters). Alternatively, this value can be set to &#039;true&#039; and the parameter part of the referrer URL will be removed.&lt;br /&gt;
*&#039;&#039;&#039;showaggregateddata:&#039;&#039;&#039; when activated, additional statistical values such as the arithmetic mean and standard deviation are shown. Furthermore, the data is aggregated to get a faster overview. For example, results of scale 1+2 and 4+5 are added to have a general ranking like &amp;quot;good&amp;quot; (1/2), &amp;quot;average&amp;quot; (3) and &amp;quot;bad&amp;quot; (4/5). This only affects question types  &amp;quot;A&amp;quot; (5 point array) and &amp;quot;5&amp;quot; (5 point choice).&lt;br /&gt;
* &#039;&#039;&#039;PDF Export Settings:&#039;&#039;&#039; This feature activates PDF export for printable surveys and Print Answers. The PDF export function is totally experimental and the output is far from being perfect. Unfortunately, no support can be given at the moment - if you want to help to fix it, please get in touch with us.&lt;br /&gt;
**&#039;usepdfexport&#039;: Set &#039;0&#039; to disable and &#039;1&#039; to enable;&lt;br /&gt;
**&#039;pdfdefaultfont&#039;: It represents the default font that will be used by the pdf export function. The default value is &#039;auto&#039;. To change it, you have to set it to one of the [https://tcpdf.org/docs/fonts/ PDF core fonts]. &lt;br /&gt;
**&#039;alternatepdffontfile&#039;: It&#039;s an array with language keys and their corresponding font. The default font for each language can be replaced in the config.php file;&lt;br /&gt;
**&#039;pdffontsize&#039;: it shows the font size for normal texts; For the title of the survey, it is &amp;lt;pdffontsize&amp;gt;+4, while for the group title is &amp;lt;pdffontsize&amp;gt;+2. It can be edited in the config.php file or from the [Global settings|global settings]] dialog;&lt;br /&gt;
**&#039;notsupportlanguages&#039;: it includes a list with the languages for which no PDF font was found. The list includes Amharic (&#039;am&#039;), Sinhala (&#039;si&#039;), and Thai (&#039;th&#039;), and it can be found in the config-defaults.php file;&lt;br /&gt;
**&#039;pdforientation&#039;: Set &#039;L&#039; for Landscape or &#039;P&#039; for portrait format. It can be edited from the config.php file.&lt;br /&gt;
*&#039;&#039;&#039;Graph setting&#039;&#039;&#039;&lt;br /&gt;
**&#039;chartfontfile&#039;: Sets the font file name that is used to create the statistical charts. The file has to be located in the fonts directory, located in the LimeSurvey root folder. It can be edited in the config.php file;&lt;br /&gt;
**&#039;alternatechartfontfile&#039;: It&#039;s an array with language keys and their corresponding font. It can be edited in the config.php file.&lt;br /&gt;
*&#039;&#039;&#039;showsgqacode:&#039;&#039;&#039; This setting is used at the printable survey feature and defaults to &#039;false&#039;&#039;. If you set showsgqacode = &#039;true&#039;;, the IDs of each question - and answer if applicable - will be shown. These IDs match the column heading at the Lime_survey_12345 table, which holds the answer data for a certain survey. These IDs can be used for a code book for manual database queries.&lt;br /&gt;
&lt;br /&gt;
= [[LDAP settings]]= &amp;lt;!--T:15--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:16--&amp;gt;&lt;br /&gt;
As this is an extensive topic we have moved [[LDAP settings]] to [[LDAP settings|another page.]]&lt;br /&gt;
&lt;br /&gt;
= Authentication= &amp;lt;!--T:17--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:67--&amp;gt;&lt;br /&gt;
Starting with LimeSurvey 2.05, authentication will be handled by plugins. As a result, the information below might be outdated. See [[Plugins|the plugins wiki]] for most up to date information.&lt;br /&gt;
&lt;br /&gt;
== Authentication delegation to the webserver== &amp;lt;!--T:18--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:19--&amp;gt;&lt;br /&gt;
System administrators may want to have their &#039;&#039;&#039;survey administrators&#039;&#039;&#039; authenticated against a central authentication system (Active Directory, openLdap, Radius, ...) rather than using the internal LimeSurvey database. An easy way to do this is to setup your web server software to use this external authentication system, and then ask LimeSurvey to trust the user identity reported by the web server. In order to enable this feature, you have to:&lt;br /&gt;
* set &#039;&#039;&#039;auth_webserver&#039;&#039;&#039; to &#039;true&#039; in config.php;&lt;br /&gt;
* enable authentication from the web server side.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:20--&amp;gt;&lt;br /&gt;
Please note that:&lt;br /&gt;
* LimeSurvey will then bypass its own authentication process (by using the login name reported by the web server without asking for a password);&lt;br /&gt;
* this can only replace the LimeSurvey GUI authentication system, &#039;&#039;&#039;not the survey invitation system&#039;&#039;&#039; (participant interface).&lt;br /&gt;
&lt;br /&gt;
== Authentication delegation with no automatic user import== &amp;lt;!--T:21--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:22--&amp;gt;&lt;br /&gt;
Please note that &amp;lt;u&amp;gt;Authentication Delegation doesn&#039;t bypass the LimeSurvey authorization system by default&amp;lt;/u&amp;gt; - meaning that, even if you don&#039;t have to manage passwords in LimeSurvey, you still need to define the users in the LimeSurvey database and assign them the correct set of rights in order to let them access the administration panel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:23--&amp;gt;&lt;br /&gt;
A user is then granted access to LimeSurvey if and only if:&lt;br /&gt;
* he has been authenticated to the web server;&lt;br /&gt;
* his login name is defined as a user in the LimeSurvey user database (the user is then granted the privileges of the user defined in the LimeSurvey user database).&lt;br /&gt;
&lt;br /&gt;
== Authentication delegation with automatic user import== &amp;lt;!--T:24--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:25--&amp;gt;&lt;br /&gt;
When managing a huge user database, it is sometimes easier to auto-import users in the LimeSurvey database:&lt;br /&gt;
*&#039;&#039;&#039;auth_webserver_autocreate_user&#039;&#039;&#039;: If set to &#039;true&#039;, LimeSurvey will try to auto-import users authenticated by the web server but not already in its users DB.&lt;br /&gt;
*&#039;&#039;&#039;auth_webserver_autocreate_profile&#039;&#039;&#039;: An array describing the default profile that will be assigned to the user, including the full (fake) name, email, and privileges.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:26--&amp;gt;&lt;br /&gt;
If you want to customize the user profile so that it matches the logged-in user, you&#039;ll have to develop a simple function called &#039;&#039;&#039;hook_get_autouserprofile&#039;&#039;&#039; - with this function you can retrieve from a central user account database (for instance, from a LDAP directory) the true full name, names, and email of a particular user. You can even customize his privileges on the system based on the groups he is allocated in the external database.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:27--&amp;gt;&lt;br /&gt;
The &#039;&#039;&#039;hook_get_auth_webserver_profile&#039;&#039;&#039; function takes the user login name as the only argument and can return:&lt;br /&gt;
* False or an empty array - in this case the user is denied access to LimeSurvey;&lt;br /&gt;
* an array containing all common userprofile entries as described in the &amp;lt;code&amp;gt;$WebserverAuth_autouserprofile&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/translate&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;function hook_get_auth_webserver_profile($user_name)&lt;br /&gt;
{&lt;br /&gt;
     // Retrieve user&#039;s data from your database backend (for instance LDAP) here&lt;br /&gt;
     ... get $user_name_from_backend&lt;br /&gt;
     ... get $user_email_from_backend&lt;br /&gt;
     ... get $user_lang_from_backend&lt;br /&gt;
     ... from groups defined in your backend set $user_admin_status_frombackend_0_or_1&lt;br /&gt;
     return Array(&lt;br /&gt;
                     &#039;full_name&#039; =&amp;gt; &amp;quot;$user_name_from_backend&amp;quot;,&lt;br /&gt;
                     &#039;email&#039; =&amp;gt; &amp;quot;$user_email_from_backend&amp;quot;,&lt;br /&gt;
                     &#039;lang&#039; =&amp;gt; &#039;$user_lang_from_backend&#039;,&lt;br /&gt;
                     &#039;htmleditormode&#039; =&amp;gt; &#039;inline&#039;,&lt;br /&gt;
                     &#039;templatelist&#039; =&amp;gt; &#039;default,basic,MyOrgTemplate&#039;,&lt;br /&gt;
                     &#039;create_survey&#039; =&amp;gt; 1,&lt;br /&gt;
                     &#039;create_user&#039; =&amp;gt; 0,&lt;br /&gt;
                     &#039;delete_user&#039; =&amp;gt; 0,&lt;br /&gt;
                     &#039;superadmin&#039; =&amp;gt; $user_admin_status_frombackend_0_or_1,&lt;br /&gt;
                     &#039;configurator&#039; =&amp;gt;0,&lt;br /&gt;
                     &#039;manage_template&#039; =&amp;gt; 0,&lt;br /&gt;
                     &#039;manage_label&#039; =&amp;gt; 0);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
     // If user should be denied access, return an empty array&lt;br /&gt;
&lt;br /&gt;
     // return Array();&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:93--&amp;gt;&lt;br /&gt;
{{Alert|The optionnal &#039;hook_get_auth_webserver_profile&#039; function is for advanced user usage only! For further details, please read the comments from the config-defaults.php file.}}&lt;br /&gt;
&lt;br /&gt;
== User name mapping== &amp;lt;!--T:52--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:53--&amp;gt;&lt;br /&gt;
In the case in which some users have an external user name that is different from their LimeSurvey user name, you may find useful to use a user name mapping. This is done in LimeSurvey by using the &#039;&#039;&#039;auth_webserver_user_map&#039;&#039;&#039; parameter. For instance, imagine you don&#039;t have an &#039;admin&#039; user name defined in your external authentication database. Then, in order to login to LimeSurvey as admin, you&#039;ll have to map your external user name (let&#039;s call it &#039;myname&#039;) to the admin login name in LimeSurvey. The corresponding setup is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&#039;config&#039;=&amp;gt;array(&lt;br /&gt;
...&lt;br /&gt;
&#039;auth_webserver_user_map&#039; =&amp;gt; array (&#039;myname&#039; =&amp;gt; &#039;admin&#039;);&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:55--&amp;gt;&lt;br /&gt;
After a successful authentication with the &#039;myname&#039; login and web server password, you&#039;ll be directly authorized to use LimeSurvey as the &#039;admin&#039; user. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:56--&amp;gt;&lt;br /&gt;
This has serious security implications, so use it with care. Also, protect your config.php from write access by the web server.&lt;br /&gt;
&lt;br /&gt;
== Use one-time passwords== &amp;lt;!--T:57--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:59--&amp;gt;&lt;br /&gt;
A user can open the LimeSurvey login page at default.com/limesurvey/admin and type the username and the one-time password which was previously written into the users table (column one_time_pw) by an external application.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:60--&amp;gt;&lt;br /&gt;
This setting has to be turned on config.php file to enable the usage of one-time passwords (default = false).&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;pre&amp;quot;&amp;gt;&lt;br /&gt;
    &#039;config&#039;=&amp;gt;array(&lt;br /&gt;
        &#039;debug&#039;=&amp;gt;0,&lt;br /&gt;
        &#039;debugsql&#039;=&amp;gt;0,&lt;br /&gt;
        &#039;use_one_time_passwords&#039;=&amp;gt;true,&lt;br /&gt;
    )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:96--&amp;gt;&lt;br /&gt;
More information can be found in the [[Manage users#Use one-time passwords|&amp;quot;Manage Users&amp;quot; section]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Encryption settings {{NewIn|4.0.0}} = &amp;lt;!--T:113--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:114--&amp;gt;&lt;br /&gt;
{{Alert|title=Attention|text=Once set, encryption keys should never be changed, otherwise all encrypted data could be lost !}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:115--&amp;gt;&lt;br /&gt;
{{Note|When update or install, this parameters was generated by LimeSurvey and set in &amp;lt;code&amp;gt;application/config/security.php&amp;lt;/code&amp;gt; file. You can move this settings in config.php if you want or leave in security.php.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:116--&amp;gt;&lt;br /&gt;
See [[data encryption]] for detail on this feature.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:117--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;encryptionkeypair&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;encryptionpublickey&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;encryptionsecretkey&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Advanced url settings= &amp;lt;!--T:130--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:131--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;publicurl:&#039;&#039;&#039; This should be set to the URL location of your &#039;public scripts&#039;. The public scripts are those located in the &amp;quot;limesurvey&amp;quot; folder (or whatever name you gave to the directory that all the other scripts and directories are kept in). &#039;&#039;&#039;This settings is available in config.php and it is used when LimeSurvey need an absolute url (for example when token emails are sent).&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;homeurl:&#039;&#039;&#039; This should be set to the URL location of your administration scripts. These are located in the /limesurvey/admin folder. This should be set to the WEB URL location - for example, &#039;&#039;http://www.example.com/limesurvey/html/admin&#039;&#039;. Don&#039;t add a trailing slash to this entry. The default setting in config.php attempts to detect the name of your server automatically using a php variable setting - &amp;lt;code&amp;gt;{$_SERVER&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;SERVER_NAME&#039;]}&amp;lt;/code&amp;gt;. &#039;&#039;&#039;In most cases, you can leave this and just modify the remainder of this string to match the directory name you have put the LimeSurvey scripts in.&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;tempurl:&#039;&#039;&#039; This should be set to the URL location of your &amp;quot;/limesurvey/tmp&amp;quot; directory - or to a directory in which you would like LimeSurvey to use to serve temporary files. &lt;br /&gt;
*&#039;&#039;&#039;uploadurl:&#039;&#039;&#039; This should be set to the URL location of your &amp;quot;/limesurvey/upload&amp;quot; directory - or to a directory in which you would like LimeSurvey to use to serve uploaded files. This allow you to set uploaded files on another url domain.&lt;br /&gt;
&lt;br /&gt;
= Advanced path settings= &amp;lt;!--T:61--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:132--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;homedir:&#039;&#039;&#039; This should be set to the physical disk location of your administration scripts - for example &amp;quot;/home/usr/htdocs/limesurvey/admin&amp;quot;. Don&#039;t add a trailing slash to this entry. The default setting in config.php attempts to detect the default root path of all your documents using the php variable setting  &amp;lt;code&amp;gt;{$_SERVER&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;DOCUMENT_ROOT&#039;]}&amp;lt;/code&amp;gt;. In most cases you can leave this and just modify the remainder of this string to match the directory name you have put the LimeSurvey scripts in.&lt;br /&gt;
*&#039;&#039;&#039;publicdir:&#039;&#039;&#039; This should be set to the physical disk location of your &#039;public scripts&#039;.&lt;br /&gt;
*&#039;&#039;&#039;tempdir:&#039;&#039;&#039; This should be set to the physical disk location of your /limesurvey/tmp directory so that the script can read and write files.&lt;br /&gt;
*&#039;&#039;&#039;uploaddir:&#039;&#039;&#039; This should be set to the physical disk location of your /limesurvey/upload directory so that the script can read and write files.&lt;br /&gt;
*&#039;&#039;&#039;sCKEditorURL:&#039;&#039;&#039; url of the fckeditor script.&lt;br /&gt;
*&#039;&#039;&#039;fckeditexpandtoolbar:&#039;&#039;&#039; defines if the fckeditor toolbar should be opened by default.&lt;br /&gt;
*&#039;&#039;&#039;pdfexportdir:&#039;&#039;&#039; This is the directory with the tcpdf.php extensiontcpdf.php.&lt;br /&gt;
*&#039;&#039;&#039;pdffonts:&#039;&#039;&#039; This is the directory for the TCPDF fonts.&lt;br /&gt;
&lt;br /&gt;
= Other advanced settings= &amp;lt;!--T:108--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Upload files== &amp;lt;!--T:109--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:110--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;allowedthemeuploads:&#039;&#039;&#039; File types allowed to be uploaded in theme editor&lt;br /&gt;
*&#039;&#039;&#039;allowedresourcesuploads:&#039;&#039;&#039; File types allowed to be uploaded in the resources sections, and with the HTML Editor&lt;br /&gt;
*&#039;&#039;&#039;allowedfileuploads&#039;&#039;&#039; {{NewIn|4.0.0}} Global restriction on file type to be uploaded&lt;br /&gt;
*&#039;&#039;&#039;magic_database:&#039;&#039;&#039; {{NewIn|3.17.17}} Allow to use a different MIME database for [https://www.php.net/manual/en/function.finfo-open.php finfo_open]. Can be updated only in config.php file. Example : &amp;lt;code&amp;gt;/usr/share/misc/magic.mgc&amp;lt;/code&amp;gt; for redhat based linux.&lt;br /&gt;
*&#039;&#039;&#039;magic_file:&#039;&#039;&#039; {{NewIn|3.17.17}} Allow to use a different file to get the array of extension by mime type than the [https://github.com/LimeSurvey/LimeSurvey/blob/master/application/core/utils/fileExtensions.php included one]. Must be a PHP file return an array. Can be updated only in config.php file.&lt;br /&gt;
&lt;br /&gt;
== Update == &amp;lt;!--T:106--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:107--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;updatable:&#039;&#039;&#039; This setting is in version.php. Can be true or false. If you set to true : when an super admin user log in : LimeSurvey checks if an update is available and show you a warning. If set to false : no check is done and you can&#039;t use ComfortUpdate. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=66077</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=66077"/>
		<updated>2015-07-08T05:51:40Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: more flexible jsonrpc integration in php&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
== Sessions ==&lt;br /&gt;
&lt;br /&gt;
=== get_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function get_session_key(string $username, string $password)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) session key.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on error&#039;&#039;&#039;:  for protocol-level errors (invalid format etc), an error message. For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
=== release_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function release_session_key(string $sSessionKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: Always &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
== Site ==&lt;br /&gt;
&lt;br /&gt;
=== get_site_settings ===&lt;br /&gt;
&lt;br /&gt;
Function to query site settings. Can only be used by administrators.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function get_site_settings( string $sSessionKey, string $sSetttingName)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| sSetttingName || Name of the setting to get&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) Setting&#039;s value&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: (string) Error message&lt;br /&gt;
&lt;br /&gt;
== Users ==&lt;br /&gt;
&lt;br /&gt;
=== list_users ===&lt;br /&gt;
&lt;br /&gt;
Function to return the ids and info of users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function list_users(string $sSessionKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Super-admin&#039;s auth credentials.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (array) The list of users&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: (array) Failure status:&lt;br /&gt;
*No users found&lt;br /&gt;
*Invalid session key&lt;br /&gt;
*No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
== Surveys ==&lt;br /&gt;
&lt;br /&gt;
===add_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===import_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
=== get_survey_properties ===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function get_survey_properties( string $sSessionKey, int $iSurveyID, array $aSurveySettings)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || ID of the survey&lt;br /&gt;
|-&lt;br /&gt;
| aSurveySettings || An array of strings containing the properties to return&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) The requested value&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: (array) Failure status : &#039;&#039;&#039;Invalid survey ID&#039;&#039;&#039;, &#039;&#039;&#039;Invalid session key&#039;&#039;&#039;, &#039;&#039;&#039;No permission&#039;&#039;&#039;, &#039;&#039;&#039;No valid Data&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Available properties&lt;br /&gt;
| | active&lt;br /&gt;
| | autonumber_start&lt;br /&gt;
| | emailnotificationto&lt;br /&gt;
| | nokeyboard&lt;br /&gt;
| | showwelcome&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | additional_languages&lt;br /&gt;
| | autoredirect&lt;br /&gt;
| | emailresponseto&lt;br /&gt;
| | owner_id&lt;br /&gt;
| | showxquestions&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | admin&lt;br /&gt;
| | bounce_email&lt;br /&gt;
| | expires&lt;br /&gt;
| | printanswers&lt;br /&gt;
| | sid&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | adminemail&lt;br /&gt;
| | bounceaccountencryption&lt;br /&gt;
| | faxto&lt;br /&gt;
| | publicgraphs&lt;br /&gt;
| | startdate&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | alloweditaftercompletion&lt;br /&gt;
| | bounceaccounthost&lt;br /&gt;
| | format&lt;br /&gt;
| | publicstatistics&lt;br /&gt;
| | template&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowjumps&lt;br /&gt;
| | bounceaccountpass&lt;br /&gt;
| | googleanalyticsapikey&lt;br /&gt;
| | refurl&lt;br /&gt;
| | tokenanswerspersistence&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowprev&lt;br /&gt;
| | bounceaccounttype&lt;br /&gt;
| | googleanalyticsstyle&lt;br /&gt;
| | savetimings&lt;br /&gt;
| | tokenlength&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowregister&lt;br /&gt;
| | bounceaccountuser&lt;br /&gt;
| | htmlemail&lt;br /&gt;
| | sendconfirmation&lt;br /&gt;
| | usecaptcha&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowsave&lt;br /&gt;
| | bounceprocessing&lt;br /&gt;
| | ipaddr&lt;br /&gt;
| | showgroupinfo&lt;br /&gt;
| | usecookie&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | anonymized&lt;br /&gt;
| | bouncetime&lt;br /&gt;
| | language&lt;br /&gt;
| | shownoanswer&lt;br /&gt;
| | usetokens&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | assessments&lt;br /&gt;
| | datecreated&lt;br /&gt;
| | listpublic&lt;br /&gt;
| | showprogress&lt;br /&gt;
| | &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | attributedescriptions&lt;br /&gt;
| | datestamp&lt;br /&gt;
| | navigationdelay&lt;br /&gt;
| | showqnumcode&lt;br /&gt;
| | &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
===list_surveys===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===activate_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===export_statistics===&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===get_summary===&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===add_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===delete_survey_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
===get_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
== Groups of Questions ==&lt;br /&gt;
&lt;br /&gt;
===add_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
===import_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
===get_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_groups===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===delete_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
===import_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
===get_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
** When there are no attributes for the question, the result for the &amp;quot;attributes&amp;quot; key is set to &amp;quot;No available attributes&amp;quot;.&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_questions===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Optional Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
== Tokens and Participants ==&lt;br /&gt;
&lt;br /&gt;
=== Token Properties  ===&lt;br /&gt;
&lt;br /&gt;
The following properties of tokens can be read or set:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Property !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
|tid || int || Token ID; read-only property&lt;br /&gt;
|-&lt;br /&gt;
|completed ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|participant_id || ||&lt;br /&gt;
|-&lt;br /&gt;
|language || string || &lt;br /&gt;
|-&lt;br /&gt;
|usesleft || ||&lt;br /&gt;
|-&lt;br /&gt;
|firstname || String || Participant&#039;s first name&lt;br /&gt;
|-&lt;br /&gt;
|lastname || String || Participant&#039;s last name&lt;br /&gt;
|-&lt;br /&gt;
|email || String || Participant&#039;s e-mail address&lt;br /&gt;
|-&lt;br /&gt;
|blacklisted || ||&lt;br /&gt;
|-&lt;br /&gt;
|validfrom || ||&lt;br /&gt;
|-&lt;br /&gt;
|sent || ||&lt;br /&gt;
|-&lt;br /&gt;
|validuntil || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindersent || ||&lt;br /&gt;
|-&lt;br /&gt;
|mpid || ||&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindercount || ||&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== activate_tokens ===&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function activate_tokens($sSessionKey, $iSurveyID, $additional_attributes)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| additional_attributes || array of integer || Any additional attribute fields to create. Just give the attribute IDs.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (array) Status OK&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: (array) Failure status&lt;br /&gt;
*Invalid session key&lt;br /&gt;
*No permission&lt;br /&gt;
*Invalid survey ID&lt;br /&gt;
*Token table could not be created&lt;br /&gt;
&lt;br /&gt;
===add_participants===&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a unique token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public add_participants($sSessionKey, $iSurveyID, $participantData, $createTokenKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $participantData || (array) || 2-dimensional array/structure containing your participants data. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;} ]&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| $createTokenKey || boolean || Set this to true if you want a token key created automatically for each entry - if your participant data already included a [token] field it will be overwritten&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array(struct) On success: Structure containing your participants data plus the token ID and (if applicable) the new token. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;} ]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: string Failure Status: &amp;quot;Invalid session key&amp;quot;, &amp;quot;No permission&amp;quot;, &amp;quot;Invalid survey ID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===delete_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
===get_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get. All properties defined in [[#Token Properties]] can be read.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
===set_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set. All writeable properties defined in [[#Token Properties]] can be written.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===list_participants===&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
===invite_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
===remind_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
== Responses ==&lt;br /&gt;
&lt;br /&gt;
===add_response===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses===&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses_by_token===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= PHP Example =&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository]. The library can also get included by composer calling&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
composer require weberhofer/jsonrpcphp&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or by inclusion of the following lines in your composer.json file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=javascript&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;require&amp;quot;: {&lt;br /&gt;
        &amp;quot;weberhofer/jsonrpcphp&amp;quot;: &amp;quot;~2&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a example how to connect to limesurvey:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// without composer this line can be used&lt;br /&gt;
// require_once &#039;path/to/your/rpcclient/jsonRPCClient.php&#039;;&lt;br /&gt;
// with composer support just add the autoloader&lt;br /&gt;
include_once &#039;vendor/autoload.php&#039;;&lt;br /&gt;
&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\JsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64514</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64514"/>
		<updated>2015-03-18T10:55:02Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: Formatted and improved list_users documentation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
== Sessions ==&lt;br /&gt;
&lt;br /&gt;
=== get_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function get_session_key(string $username, string $password)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) session key.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on error&#039;&#039;&#039;:  for protocol-level errors (invalid format etc), an error message. For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
=== release_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function release_session_key(string $sSessionKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: Always &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
== Site ==&lt;br /&gt;
&lt;br /&gt;
=== get_site_settings ===&lt;br /&gt;
&lt;br /&gt;
Function to query site settings. Can only be used by administrators.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function get_site_settings( string $sSessionKey, string $sSetttingName)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| sSetttingName || Name of the setting to get&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) Setting&#039;s value&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: (string) Error message&lt;br /&gt;
&lt;br /&gt;
== Users ==&lt;br /&gt;
&lt;br /&gt;
=== list_users ===&lt;br /&gt;
&lt;br /&gt;
Function to return the ids and info of users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function list_users(string $sSessionKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Super-admin&#039;s auth credentials.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (array) The list of users&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: (array) Failure status:&lt;br /&gt;
*No users found&lt;br /&gt;
*Invalid session key&lt;br /&gt;
*No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
== Surveys ==&lt;br /&gt;
&lt;br /&gt;
===add_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===import_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
=== get_survey_properties ===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function get_survey_properties( string $sSessionKey, int $iSurveyID, array $aSurveySettings)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || ID of the survey&lt;br /&gt;
|-&lt;br /&gt;
| aSurveySettings || An array of strings containing the properties to return&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) The requested value&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: (array) Failure status : &#039;&#039;&#039;Invalid survey ID&#039;&#039;&#039;, &#039;&#039;&#039;Invalid session key&#039;&#039;&#039;, &#039;&#039;&#039;No permission&#039;&#039;&#039;, &#039;&#039;&#039;No valid Data&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Available properties&lt;br /&gt;
| | active&lt;br /&gt;
| | autonumber_start&lt;br /&gt;
| | emailnotificationto&lt;br /&gt;
| | nokeyboard&lt;br /&gt;
| | showwelcome&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | additional_languages&lt;br /&gt;
| | autoredirect&lt;br /&gt;
| | emailresponseto&lt;br /&gt;
| | owner_id&lt;br /&gt;
| | showxquestions&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | admin&lt;br /&gt;
| | bounce_email&lt;br /&gt;
| | expires&lt;br /&gt;
| | printanswers&lt;br /&gt;
| | sid&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | adminemail&lt;br /&gt;
| | bounceaccountencryption&lt;br /&gt;
| | faxto&lt;br /&gt;
| | publicgraphs&lt;br /&gt;
| | startdate&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | alloweditaftercompletion&lt;br /&gt;
| | bounceaccounthost&lt;br /&gt;
| | format&lt;br /&gt;
| | publicstatistics&lt;br /&gt;
| | template&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowjumps&lt;br /&gt;
| | bounceaccountpass&lt;br /&gt;
| | googleanalyticsapikey&lt;br /&gt;
| | refurl&lt;br /&gt;
| | tokenanswerspersistence&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowprev&lt;br /&gt;
| | bounceaccounttype&lt;br /&gt;
| | googleanalyticsstyle&lt;br /&gt;
| | savetimings&lt;br /&gt;
| | tokenlength&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowregister&lt;br /&gt;
| | bounceaccountuser&lt;br /&gt;
| | htmlemail&lt;br /&gt;
| | sendconfirmation&lt;br /&gt;
| | usecaptcha&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowsave&lt;br /&gt;
| | bounceprocessing&lt;br /&gt;
| | ipaddr&lt;br /&gt;
| | showgroupinfo&lt;br /&gt;
| | usecookie&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | anonymized&lt;br /&gt;
| | bouncetime&lt;br /&gt;
| | language&lt;br /&gt;
| | shownoanswer&lt;br /&gt;
| | usetokens&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | assessments&lt;br /&gt;
| | datecreated&lt;br /&gt;
| | listpublic&lt;br /&gt;
| | showprogress&lt;br /&gt;
| | &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | attributedescriptions&lt;br /&gt;
| | datestamp&lt;br /&gt;
| | navigationdelay&lt;br /&gt;
| | showqnumcode&lt;br /&gt;
| | &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
===list_surveys===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===activate_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===export_statistics===&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===get_summary===&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===add_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===delete_survey_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
===get_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
== Groups of Questions ==&lt;br /&gt;
&lt;br /&gt;
===add_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
===import_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
===get_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_groups===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===delete_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
===import_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
===get_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_questions===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Optional Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
== Tokens and Participants ==&lt;br /&gt;
&lt;br /&gt;
=== Token Properties  ===&lt;br /&gt;
&lt;br /&gt;
The following properties of tokens can be read or set:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Property !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
|tid || int || Token ID; read-only property&lt;br /&gt;
|-&lt;br /&gt;
|completed ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|participant_id || ||&lt;br /&gt;
|-&lt;br /&gt;
|language || string || &lt;br /&gt;
|-&lt;br /&gt;
|usesleft || ||&lt;br /&gt;
|-&lt;br /&gt;
|firstname || String || Participant&#039;s first name&lt;br /&gt;
|-&lt;br /&gt;
|lastname || String || Participant&#039;s last name&lt;br /&gt;
|-&lt;br /&gt;
|email || String || Participant&#039;s e-mail address&lt;br /&gt;
|-&lt;br /&gt;
|blacklisted || ||&lt;br /&gt;
|-&lt;br /&gt;
|validfrom || ||&lt;br /&gt;
|-&lt;br /&gt;
|sent || ||&lt;br /&gt;
|-&lt;br /&gt;
|validuntil || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindersent || ||&lt;br /&gt;
|-&lt;br /&gt;
|mpid || ||&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindercount || ||&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== activate_tokens ===&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function activate_tokens($sSessionKey, $iSurveyID, $additional_attributes)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| additional_attributes || array of integer || Any additional attribute fields to create. Just give the attribute IDs.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (array) Status OK&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: (array) Failure status&lt;br /&gt;
*Invalid session key&lt;br /&gt;
*No permission&lt;br /&gt;
*Invalid survey ID&lt;br /&gt;
*Token table could not be created&lt;br /&gt;
&lt;br /&gt;
===add_participants===&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a unique token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public add_participants($sSessionKey, $iSurveyID, $participantData, $createTokenKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $participantData || (array) || 2-dimensional array/structure containing your participants data. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;} ]&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| $createTokenKey || boolean || Set this to true if you want a token key created automatically for each entry - if your participant data already included a [token] field it will be overwritten&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array(struct) On success: Structure containing your participants data plus the token ID and (if applicable) the new token. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;} ]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: string Failure Status: &amp;quot;Invalid session key&amp;quot;, &amp;quot;No permission&amp;quot;, &amp;quot;Invalid survey ID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===delete_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
===get_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get. All properties defined in [[#Token Properties]] can be read.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
===set_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set. All writeable properties defined in [[#Token Properties]] can be written.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===list_participants===&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
===invite_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
===remind_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
== Responses ==&lt;br /&gt;
&lt;br /&gt;
===add_response===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses===&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses_by_token===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= PHP Example =&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository]. The library can also get included by composer calling&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
composer require weberhofer/jsonrpcphp&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or by inclusion of the following lines in your composer.json file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=javascript&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;require&amp;quot;: {&lt;br /&gt;
        &amp;quot;weberhofer/jsonrpcphp&amp;quot;: &amp;quot;2.1.0&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a example how to connect to limesurvey:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// without composer this line can be used&lt;br /&gt;
// require_once &#039;path/to/your/rpcclient/jsonRPCClient.php&#039;;&lt;br /&gt;
// with composer support just add the autoloader&lt;br /&gt;
include_once &#039;vendor/autoload.php&#039;;&lt;br /&gt;
&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64114</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64114"/>
		<updated>2015-01-30T15:47:00Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: included jsonrpcphp composer support&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
== Sessions ==&lt;br /&gt;
&lt;br /&gt;
=== get_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function get_session_key(string $username, string $password)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) session key.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on error&#039;&#039;&#039;:  for protocol-level errors (invalid format etc), an error message. For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
=== release_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function release_session_key(string $sSessionKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: Always &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
== Site ==&lt;br /&gt;
&lt;br /&gt;
=== get_site_settings ===&lt;br /&gt;
&lt;br /&gt;
Function to query site settings. Can only be used by administrators.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function get_site_settings( string $sSessionKey, string $sSetttingName)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| sSetttingName || Name of the setting to get&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) Setting&#039;s value&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: (string) Error message&lt;br /&gt;
&lt;br /&gt;
== Surveys ==&lt;br /&gt;
&lt;br /&gt;
===add_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===import_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
=== get_survey_properties ===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function get_survey_properties( string $sSessionKey, int $iSurveyID, array $aSurveySettings)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || ID of the survey&lt;br /&gt;
|-&lt;br /&gt;
| aSurveySettings || An array of strings containing the properties to return&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) The requested value&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: (array) Failure status : &#039;&#039;&#039;Invalid survey ID&#039;&#039;&#039;, &#039;&#039;&#039;Invalid session key&#039;&#039;&#039;, &#039;&#039;&#039;No permission&#039;&#039;&#039;, &#039;&#039;&#039;No valid Data&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Available properties&lt;br /&gt;
| | active&lt;br /&gt;
| | autonumber_start&lt;br /&gt;
| | emailnotificationto&lt;br /&gt;
| | nokeyboard&lt;br /&gt;
| | showwelcome&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | additional_languages&lt;br /&gt;
| | autoredirect&lt;br /&gt;
| | emailresponseto&lt;br /&gt;
| | owner_id&lt;br /&gt;
| | showxquestions&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | admin&lt;br /&gt;
| | bounce_email&lt;br /&gt;
| | expires&lt;br /&gt;
| | printanswers&lt;br /&gt;
| | sid&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | adminemail&lt;br /&gt;
| | bounceaccountencryption&lt;br /&gt;
| | faxto&lt;br /&gt;
| | publicgraphs&lt;br /&gt;
| | startdate&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | alloweditaftercompletion&lt;br /&gt;
| | bounceaccounthost&lt;br /&gt;
| | format&lt;br /&gt;
| | publicstatistics&lt;br /&gt;
| | template&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowjumps&lt;br /&gt;
| | bounceaccountpass&lt;br /&gt;
| | googleanalyticsapikey&lt;br /&gt;
| | refurl&lt;br /&gt;
| | tokenanswerspersistence&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowprev&lt;br /&gt;
| | bounceaccounttype&lt;br /&gt;
| | googleanalyticsstyle&lt;br /&gt;
| | savetimings&lt;br /&gt;
| | tokenlength&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowregister&lt;br /&gt;
| | bounceaccountuser&lt;br /&gt;
| | htmlemail&lt;br /&gt;
| | sendconfirmation&lt;br /&gt;
| | usecaptcha&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowsave&lt;br /&gt;
| | bounceprocessing&lt;br /&gt;
| | ipaddr&lt;br /&gt;
| | showgroupinfo&lt;br /&gt;
| | usecookie&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | anonymized&lt;br /&gt;
| | bouncetime&lt;br /&gt;
| | language&lt;br /&gt;
| | shownoanswer&lt;br /&gt;
| | usetokens&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | assessments&lt;br /&gt;
| | datecreated&lt;br /&gt;
| | listpublic&lt;br /&gt;
| | showprogress&lt;br /&gt;
| | &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | attributedescriptions&lt;br /&gt;
| | datestamp&lt;br /&gt;
| | navigationdelay&lt;br /&gt;
| | showqnumcode&lt;br /&gt;
| | &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
===list_surveys===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===activate_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===export_statistics===&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===get_summary===&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===add_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===delete_survey_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
===get_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
== Groups and Users ==&lt;br /&gt;
&lt;br /&gt;
===add_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
===import_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
===get_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_groups===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===list_users===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===delete_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
===import_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
===get_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_questions===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
== Tokens and Participants ==&lt;br /&gt;
&lt;br /&gt;
=== Token Properties  ===&lt;br /&gt;
&lt;br /&gt;
The following properties of tokens can be read or set:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Property !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
|tid || int || Token ID; read-only property&lt;br /&gt;
|-&lt;br /&gt;
|completed ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|participant_id || ||&lt;br /&gt;
|-&lt;br /&gt;
|language || string || &lt;br /&gt;
|-&lt;br /&gt;
|usesleft || ||&lt;br /&gt;
|-&lt;br /&gt;
|firstname || String || Participant&#039;s first name&lt;br /&gt;
|-&lt;br /&gt;
|lastname || String || Participant&#039;s last name&lt;br /&gt;
|-&lt;br /&gt;
|email || String || Participant&#039;s e-mail address&lt;br /&gt;
|-&lt;br /&gt;
|blacklisted || ||&lt;br /&gt;
|-&lt;br /&gt;
|validfrom || ||&lt;br /&gt;
|-&lt;br /&gt;
|sent || ||&lt;br /&gt;
|-&lt;br /&gt;
|validuntil || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindersent || ||&lt;br /&gt;
|-&lt;br /&gt;
|mpid || ||&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindercount || ||&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== activate_tokens ===&lt;br /&gt;
&lt;br /&gt;
Activate tokens.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function activate_tokens($sSessionKey, $iSurveyID, $additional_attributes)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| additional_attributes || array of integer || Any additional attribute fields to create. Just give the attribute IDs.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (array) status OK&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: Any other status&lt;br /&gt;
&lt;br /&gt;
===add_participants===&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a unique token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public add_participants($sSessionKey, $iSurveyID, $participantData, $createTokenKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $participantData || (array) || 2-dimensional array/structure containing your participants data. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;} ]&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| $createTokenKey || boolean || Set this to true if you want a token key created automatically for each entry - if your participant data already included a [token] field it will be overwritten&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array(struct) On success: Structure containing your participants data plus the token ID and (if applicable) the new token. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;} ]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: string Failure Status: &amp;quot;Invalid session key&amp;quot;, &amp;quot;No permission&amp;quot;, &amp;quot;Invalid survey ID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===delete_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
===get_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get. All properties defined in [[#Token Properties]] can be read.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
===set_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set. All writeable properties defined in [[#Token Properties]] can be written.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===list_participants===&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
===activate_tokens===&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
===invite_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
===remind_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
== Responses ==&lt;br /&gt;
&lt;br /&gt;
===add_response===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses===&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses_by_token===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= PHP Example =&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository]. The library can also get included by composer calling&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
composer require weberhofer/jsonrpcphp&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or by inclusion of the following lines in your composer.json file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=javascript&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;require&amp;quot;: {&lt;br /&gt;
        &amp;quot;weberhofer/jsonrpcphp&amp;quot;: &amp;quot;2.1.0&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a example how to connect to limesurvey:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// without composer this line can be used&lt;br /&gt;
// require_once &#039;path/to/your/rpcclient/jsonRPCClient.php&#039;;&lt;br /&gt;
// with composer support just add the autoloader&lt;br /&gt;
include_once &#039;vendor/autoload.php&#039;;&lt;br /&gt;
&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64106</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64106"/>
		<updated>2015-01-27T17:39:33Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: fixed typo get_survey_properties&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
== Sessions ==&lt;br /&gt;
&lt;br /&gt;
=== get_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function get_session_key(string $username, string $password)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) session key.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on error&#039;&#039;&#039;:  for protocol-level errors (invalid format etc), an error message. For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
=== release_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function release_session_key(string $sSessionKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: Always &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
== Site ==&lt;br /&gt;
&lt;br /&gt;
=== get_site_settings ===&lt;br /&gt;
&lt;br /&gt;
Function to query site settings. Can only be used by administrators.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function get_site_settings( string $sSessionKey, string $sSetttingName)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| sSetttingName || Name of the setting to get&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) Setting&#039;s value&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: (string) Error message&lt;br /&gt;
&lt;br /&gt;
== Surveys ==&lt;br /&gt;
&lt;br /&gt;
===add_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===import_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
=== get_survey_properties ===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function get_survey_properties( string $sSessionKey, int $iSurveyID, array $aSurveySettings)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || ID of the survey&lt;br /&gt;
|-&lt;br /&gt;
| aSurveySettings || An array of strings containing the properties to return&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) The requested value&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: (array) Failure status : &#039;&#039;&#039;Invalid survey ID&#039;&#039;&#039;, &#039;&#039;&#039;Invalid session key&#039;&#039;&#039;, &#039;&#039;&#039;No permission&#039;&#039;&#039;, &#039;&#039;&#039;No valid Data&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Available properties&lt;br /&gt;
| | active&lt;br /&gt;
| | autonumber_start&lt;br /&gt;
| | emailnotificationto&lt;br /&gt;
| | nokeyboard&lt;br /&gt;
| | showwelcome&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | additional_languages&lt;br /&gt;
| | autoredirect&lt;br /&gt;
| | emailresponseto&lt;br /&gt;
| | owner_id&lt;br /&gt;
| | showxquestions&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | admin&lt;br /&gt;
| | bounce_email&lt;br /&gt;
| | expires&lt;br /&gt;
| | printanswers&lt;br /&gt;
| | sid&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | adminemail&lt;br /&gt;
| | bounceaccountencryption&lt;br /&gt;
| | faxto&lt;br /&gt;
| | publicgraphs&lt;br /&gt;
| | startdate&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | alloweditaftercompletion&lt;br /&gt;
| | bounceaccounthost&lt;br /&gt;
| | format&lt;br /&gt;
| | publicstatistics&lt;br /&gt;
| | template&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowjumps&lt;br /&gt;
| | bounceaccountpass&lt;br /&gt;
| | googleanalyticsapikey&lt;br /&gt;
| | refurl&lt;br /&gt;
| | tokenanswerspersistence&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowprev&lt;br /&gt;
| | bounceaccounttype&lt;br /&gt;
| | googleanalyticsstyle&lt;br /&gt;
| | savetimings&lt;br /&gt;
| | tokenlength&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowregister&lt;br /&gt;
| | bounceaccountuser&lt;br /&gt;
| | htmlemail&lt;br /&gt;
| | sendconfirmation&lt;br /&gt;
| | usecaptcha&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowsave&lt;br /&gt;
| | bounceprocessing&lt;br /&gt;
| | ipaddr&lt;br /&gt;
| | showgroupinfo&lt;br /&gt;
| | usecookie&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | anonymized&lt;br /&gt;
| | bouncetime&lt;br /&gt;
| | language&lt;br /&gt;
| | shownoanswer&lt;br /&gt;
| | usetokens&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | assessments&lt;br /&gt;
| | datecreated&lt;br /&gt;
| | listpublic&lt;br /&gt;
| | showprogress&lt;br /&gt;
| | &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | attributedescriptions&lt;br /&gt;
| | datestamp&lt;br /&gt;
| | navigationdelay&lt;br /&gt;
| | showqnumcode&lt;br /&gt;
| | &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
===list_surveys===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===activate_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===export_statistics===&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===get_summary===&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===add_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===delete_survey_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
===get_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
== Groups and Users ==&lt;br /&gt;
&lt;br /&gt;
===add_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
===import_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
===get_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_groups===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===list_users===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===delete_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
===import_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
===get_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_questions===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
== Tokens and Participants ==&lt;br /&gt;
&lt;br /&gt;
=== Token Properties  ===&lt;br /&gt;
&lt;br /&gt;
The following properties of tokens can be read or set:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Property !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
|tid || int || Token ID; read-only property&lt;br /&gt;
|-&lt;br /&gt;
|completed ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|participant_id || ||&lt;br /&gt;
|-&lt;br /&gt;
|language || string || &lt;br /&gt;
|-&lt;br /&gt;
|usesleft || ||&lt;br /&gt;
|-&lt;br /&gt;
|firstname || String || Participant&#039;s first name&lt;br /&gt;
|-&lt;br /&gt;
|lastname || String || Participant&#039;s last name&lt;br /&gt;
|-&lt;br /&gt;
|email || String || Participant&#039;s e-mail address&lt;br /&gt;
|-&lt;br /&gt;
|blacklisted || ||&lt;br /&gt;
|-&lt;br /&gt;
|validfrom || ||&lt;br /&gt;
|-&lt;br /&gt;
|sent || ||&lt;br /&gt;
|-&lt;br /&gt;
|validuntil || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindersent || ||&lt;br /&gt;
|-&lt;br /&gt;
|mpid || ||&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindercount || ||&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== activate_tokens ===&lt;br /&gt;
&lt;br /&gt;
Activate tokens.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function activate_tokens($sSessionKey, $iSurveyID, $additional_attributes)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| additional_attributes || array of integer || Any additional attribute fields to create. Just give the attribute IDs.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (array) status OK&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: Any other status&lt;br /&gt;
&lt;br /&gt;
===add_participants===&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a unique token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public add_participants($sSessionKey, $iSurveyID, $participantData, $createTokenKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $participantData || (array) || 2-dimensional array/structure containing your participants data. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;} ]&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| $createTokenKey || boolean || Set this to true if you want a token key created automatically for each entry - if your participant data already included a [token] field it will be overwritten&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array(struct) On success: Structure containing your participants data plus the token ID and (if applicable) the new token. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;} ]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: string Failure Status: &amp;quot;Invalid session key&amp;quot;, &amp;quot;No permission&amp;quot;, &amp;quot;Invalid survey ID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===delete_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
===get_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get. All properties defined in [[#Token Properties]] can be read.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
===set_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set. All writeable properties defined in [[#Token Properties]] can be written.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===list_participants===&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
===activate_tokens===&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
===invite_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
===remind_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
== Responses ==&lt;br /&gt;
&lt;br /&gt;
===add_response===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses===&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses_by_token===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64105</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64105"/>
		<updated>2015-01-27T17:38:39Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: reformatted get_survey_properties&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
== Sessions ==&lt;br /&gt;
&lt;br /&gt;
=== get_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function get_session_key(string $username, string $password)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) session key.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on error&#039;&#039;&#039;:  for protocol-level errors (invalid format etc), an error message. For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
=== release_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function release_session_key(string $sSessionKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: Always &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
== Site ==&lt;br /&gt;
&lt;br /&gt;
=== get_site_settings ===&lt;br /&gt;
&lt;br /&gt;
Function to query site settings. Can only be used by administrators.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function get_site_settings( string $sSessionKey, string $sSetttingName)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| sSetttingName || Name of the setting to get&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) Setting&#039;s value&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: (string) Error message&lt;br /&gt;
&lt;br /&gt;
== Surveys ==&lt;br /&gt;
&lt;br /&gt;
===add_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===import_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
=== get_survey_properties ===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function get_survey_properties string $sSessionKey, int $iSurveyID, array $aSurveySettings&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || ID of the survey&lt;br /&gt;
|-&lt;br /&gt;
| aSurveySettings || An array of strings containing the properties to return&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) The requested value&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: (array) Failure status : &#039;&#039;&#039;Invalid survey ID&#039;&#039;&#039;, &#039;&#039;&#039;Invalid session key&#039;&#039;&#039;, &#039;&#039;&#039;No permission&#039;&#039;&#039;, &#039;&#039;&#039;No valid Data&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Available properties&lt;br /&gt;
| | active&lt;br /&gt;
| | autonumber_start&lt;br /&gt;
| | emailnotificationto&lt;br /&gt;
| | nokeyboard&lt;br /&gt;
| | showwelcome&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | additional_languages&lt;br /&gt;
| | autoredirect&lt;br /&gt;
| | emailresponseto&lt;br /&gt;
| | owner_id&lt;br /&gt;
| | showxquestions&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | admin&lt;br /&gt;
| | bounce_email&lt;br /&gt;
| | expires&lt;br /&gt;
| | printanswers&lt;br /&gt;
| | sid&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | adminemail&lt;br /&gt;
| | bounceaccountencryption&lt;br /&gt;
| | faxto&lt;br /&gt;
| | publicgraphs&lt;br /&gt;
| | startdate&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | alloweditaftercompletion&lt;br /&gt;
| | bounceaccounthost&lt;br /&gt;
| | format&lt;br /&gt;
| | publicstatistics&lt;br /&gt;
| | template&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowjumps&lt;br /&gt;
| | bounceaccountpass&lt;br /&gt;
| | googleanalyticsapikey&lt;br /&gt;
| | refurl&lt;br /&gt;
| | tokenanswerspersistence&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowprev&lt;br /&gt;
| | bounceaccounttype&lt;br /&gt;
| | googleanalyticsstyle&lt;br /&gt;
| | savetimings&lt;br /&gt;
| | tokenlength&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowregister&lt;br /&gt;
| | bounceaccountuser&lt;br /&gt;
| | htmlemail&lt;br /&gt;
| | sendconfirmation&lt;br /&gt;
| | usecaptcha&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | allowsave&lt;br /&gt;
| | bounceprocessing&lt;br /&gt;
| | ipaddr&lt;br /&gt;
| | showgroupinfo&lt;br /&gt;
| | usecookie&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | anonymized&lt;br /&gt;
| | bouncetime&lt;br /&gt;
| | language&lt;br /&gt;
| | shownoanswer&lt;br /&gt;
| | usetokens&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | assessments&lt;br /&gt;
| | datecreated&lt;br /&gt;
| | listpublic&lt;br /&gt;
| | showprogress&lt;br /&gt;
| | &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| | attributedescriptions&lt;br /&gt;
| | datestamp&lt;br /&gt;
| | navigationdelay&lt;br /&gt;
| | showqnumcode&lt;br /&gt;
| | &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
===list_surveys===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===activate_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===export_statistics===&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===get_summary===&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===add_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===delete_survey_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
===get_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
== Groups and Users ==&lt;br /&gt;
&lt;br /&gt;
===add_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
===import_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
===get_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_groups===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===list_users===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===delete_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
===import_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
===get_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_questions===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
== Tokens and Participants ==&lt;br /&gt;
&lt;br /&gt;
=== Token Properties  ===&lt;br /&gt;
&lt;br /&gt;
The following properties of tokens can be read or set:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Property !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
|tid || int || Token ID; read-only property&lt;br /&gt;
|-&lt;br /&gt;
|completed ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|participant_id || ||&lt;br /&gt;
|-&lt;br /&gt;
|language || string || &lt;br /&gt;
|-&lt;br /&gt;
|usesleft || ||&lt;br /&gt;
|-&lt;br /&gt;
|firstname || String || Participant&#039;s first name&lt;br /&gt;
|-&lt;br /&gt;
|lastname || String || Participant&#039;s last name&lt;br /&gt;
|-&lt;br /&gt;
|email || String || Participant&#039;s e-mail address&lt;br /&gt;
|-&lt;br /&gt;
|blacklisted || ||&lt;br /&gt;
|-&lt;br /&gt;
|validfrom || ||&lt;br /&gt;
|-&lt;br /&gt;
|sent || ||&lt;br /&gt;
|-&lt;br /&gt;
|validuntil || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindersent || ||&lt;br /&gt;
|-&lt;br /&gt;
|mpid || ||&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindercount || ||&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== activate_tokens ===&lt;br /&gt;
&lt;br /&gt;
Activate tokens.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function activate_tokens($sSessionKey, $iSurveyID, $additional_attributes)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| additional_attributes || array of integer || Any additional attribute fields to create. Just give the attribute IDs.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (array) status OK&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: Any other status&lt;br /&gt;
&lt;br /&gt;
===add_participants===&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a unique token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public add_participants($sSessionKey, $iSurveyID, $participantData, $createTokenKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $participantData || (array) || 2-dimensional array/structure containing your participants data. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;} ]&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| $createTokenKey || boolean || Set this to true if you want a token key created automatically for each entry - if your participant data already included a [token] field it will be overwritten&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array(struct) On success: Structure containing your participants data plus the token ID and (if applicable) the new token. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;} ]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: string Failure Status: &amp;quot;Invalid session key&amp;quot;, &amp;quot;No permission&amp;quot;, &amp;quot;Invalid survey ID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===delete_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
===get_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get. All properties defined in [[#Token Properties]] can be read.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
===set_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set. All writeable properties defined in [[#Token Properties]] can be written.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===list_participants===&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
===activate_tokens===&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
===invite_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
===remind_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
== Responses ==&lt;br /&gt;
&lt;br /&gt;
===add_response===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses===&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses_by_token===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64104</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64104"/>
		<updated>2015-01-27T17:12:31Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: simplified get_site_settings&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
== Sessions ==&lt;br /&gt;
&lt;br /&gt;
=== get_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function get_session_key(string $username, string $password)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) session key.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on error&#039;&#039;&#039;:  for protocol-level errors (invalid format etc), an error message. For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
=== release_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function release_session_key(string $sSessionKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: Always &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
== Site ==&lt;br /&gt;
&lt;br /&gt;
=== get_site_settings ===&lt;br /&gt;
&lt;br /&gt;
Function to query site settings. Can only be used by administrators.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function get_site_settings( string $sSessionKey, string $sSetttingName)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| sSetttingName || Name of the setting to get&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) Setting&#039;s value&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: (string) Error message&lt;br /&gt;
&lt;br /&gt;
== Surveys ==&lt;br /&gt;
&lt;br /&gt;
===add_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===import_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
===get_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
===list_surveys===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===activate_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===export_statistics===&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===get_summary===&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===add_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===delete_survey_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
===get_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
== Groups and Users ==&lt;br /&gt;
&lt;br /&gt;
===add_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
===import_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
===get_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_groups===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===list_users===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===delete_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
===import_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
===get_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_questions===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
== Tokens and Participants ==&lt;br /&gt;
&lt;br /&gt;
=== Token Properties  ===&lt;br /&gt;
&lt;br /&gt;
The following properties of tokens can be read or set:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Property !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
|tid || int || Token ID; read-only property&lt;br /&gt;
|-&lt;br /&gt;
|completed ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|participant_id || ||&lt;br /&gt;
|-&lt;br /&gt;
|language || string || &lt;br /&gt;
|-&lt;br /&gt;
|usesleft || ||&lt;br /&gt;
|-&lt;br /&gt;
|firstname || String || Participant&#039;s first name&lt;br /&gt;
|-&lt;br /&gt;
|lastname || String || Participant&#039;s last name&lt;br /&gt;
|-&lt;br /&gt;
|email || String || Participant&#039;s e-mail address&lt;br /&gt;
|-&lt;br /&gt;
|blacklisted || ||&lt;br /&gt;
|-&lt;br /&gt;
|validfrom || ||&lt;br /&gt;
|-&lt;br /&gt;
|sent || ||&lt;br /&gt;
|-&lt;br /&gt;
|validuntil || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindersent || ||&lt;br /&gt;
|-&lt;br /&gt;
|mpid || ||&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindercount || ||&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== activate_tokens ===&lt;br /&gt;
&lt;br /&gt;
Activate tokens.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function activate_tokens($sSessionKey, $iSurveyID, $additional_attributes)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| additional_attributes || array of integer || Any additional attribute fields to create. Just give the attribute IDs.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (array) status OK&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: Any other status&lt;br /&gt;
&lt;br /&gt;
===add_participants===&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a unique token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public add_participants($sSessionKey, $iSurveyID, $participantData, $createTokenKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $participantData || (array) || 2-dimensional array/structure containing your participants data. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;} ]&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| $createTokenKey || boolean || Set this to true if you want a token key created automatically for each entry - if your participant data already included a [token] field it will be overwritten&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array(struct) On success: Structure containing your participants data plus the token ID and (if applicable) the new token. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;} ]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: string Failure Status: &amp;quot;Invalid session key&amp;quot;, &amp;quot;No permission&amp;quot;, &amp;quot;Invalid survey ID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===delete_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
===get_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get. All properties defined in [[#Token Properties]] can be read.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
===set_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set. All writeable properties defined in [[#Token Properties]] can be written.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===list_participants===&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
===activate_tokens===&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
===invite_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
===remind_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
== Responses ==&lt;br /&gt;
&lt;br /&gt;
===add_response===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses===&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses_by_token===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64103</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64103"/>
		<updated>2015-01-27T17:11:26Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: simplified release_session_key&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
== Sessions ==&lt;br /&gt;
&lt;br /&gt;
=== get_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function get_session_key(string $username, string $password)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) session key.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on error&#039;&#039;&#039;:  for protocol-level errors (invalid format etc), an error message. For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
=== release_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function release_session_key(string $sSessionKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: Always &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
== Site ==&lt;br /&gt;
&lt;br /&gt;
=== get_site_settings ===&lt;br /&gt;
&lt;br /&gt;
Function to query site settings. Can only be used by administrators.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function get_site_settings( $sSessionKey, $sSetttingName)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| sSetttingName || string || Name of the setting to get&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) Setting&#039;s value&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: (string) Error message&lt;br /&gt;
&lt;br /&gt;
== Surveys ==&lt;br /&gt;
&lt;br /&gt;
===add_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===import_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
===get_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
===list_surveys===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===activate_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===export_statistics===&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===get_summary===&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===add_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===delete_survey_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
===get_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
== Groups and Users ==&lt;br /&gt;
&lt;br /&gt;
===add_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
===import_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
===get_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_groups===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===list_users===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===delete_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
===import_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
===get_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_questions===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
== Tokens and Participants ==&lt;br /&gt;
&lt;br /&gt;
=== Token Properties  ===&lt;br /&gt;
&lt;br /&gt;
The following properties of tokens can be read or set:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Property !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
|tid || int || Token ID; read-only property&lt;br /&gt;
|-&lt;br /&gt;
|completed ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|participant_id || ||&lt;br /&gt;
|-&lt;br /&gt;
|language || string || &lt;br /&gt;
|-&lt;br /&gt;
|usesleft || ||&lt;br /&gt;
|-&lt;br /&gt;
|firstname || String || Participant&#039;s first name&lt;br /&gt;
|-&lt;br /&gt;
|lastname || String || Participant&#039;s last name&lt;br /&gt;
|-&lt;br /&gt;
|email || String || Participant&#039;s e-mail address&lt;br /&gt;
|-&lt;br /&gt;
|blacklisted || ||&lt;br /&gt;
|-&lt;br /&gt;
|validfrom || ||&lt;br /&gt;
|-&lt;br /&gt;
|sent || ||&lt;br /&gt;
|-&lt;br /&gt;
|validuntil || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindersent || ||&lt;br /&gt;
|-&lt;br /&gt;
|mpid || ||&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindercount || ||&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== activate_tokens ===&lt;br /&gt;
&lt;br /&gt;
Activate tokens.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function activate_tokens($sSessionKey, $iSurveyID, $additional_attributes)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| additional_attributes || array of integer || Any additional attribute fields to create. Just give the attribute IDs.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (array) status OK&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: Any other status&lt;br /&gt;
&lt;br /&gt;
===add_participants===&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a unique token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public add_participants($sSessionKey, $iSurveyID, $participantData, $createTokenKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $participantData || (array) || 2-dimensional array/structure containing your participants data. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;} ]&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| $createTokenKey || boolean || Set this to true if you want a token key created automatically for each entry - if your participant data already included a [token] field it will be overwritten&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array(struct) On success: Structure containing your participants data plus the token ID and (if applicable) the new token. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;} ]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: string Failure Status: &amp;quot;Invalid session key&amp;quot;, &amp;quot;No permission&amp;quot;, &amp;quot;Invalid survey ID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===delete_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
===get_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get. All properties defined in [[#Token Properties]] can be read.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
===set_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set. All writeable properties defined in [[#Token Properties]] can be written.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===list_participants===&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
===activate_tokens===&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
===invite_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
===remind_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
== Responses ==&lt;br /&gt;
&lt;br /&gt;
===add_response===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses===&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses_by_token===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64102</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64102"/>
		<updated>2015-01-27T17:08:02Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: simplified get_session_key&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
== Sessions ==&lt;br /&gt;
&lt;br /&gt;
=== get_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
function get_session_key(string $username, string $password)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) session key.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on error&#039;&#039;&#039;:  for protocol-level errors (invalid format etc), an error message. For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
=== release_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function release_session_key($sSessionKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: Always &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
== Site ==&lt;br /&gt;
&lt;br /&gt;
=== get_site_settings ===&lt;br /&gt;
&lt;br /&gt;
Function to query site settings. Can only be used by administrators.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function get_site_settings( $sSessionKey, $sSetttingName)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| sSetttingName || string || Name of the setting to get&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) Setting&#039;s value&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: (string) Error message&lt;br /&gt;
&lt;br /&gt;
== Surveys ==&lt;br /&gt;
&lt;br /&gt;
===add_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===import_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
===get_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
===list_surveys===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===activate_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===export_statistics===&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===get_summary===&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===add_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===delete_survey_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
===get_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
== Groups and Users ==&lt;br /&gt;
&lt;br /&gt;
===add_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
===import_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
===get_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_groups===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===list_users===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===delete_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
===import_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
===get_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_questions===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
== Tokens and Participants ==&lt;br /&gt;
&lt;br /&gt;
=== Token Properties  ===&lt;br /&gt;
&lt;br /&gt;
The following properties of tokens can be read or set:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Property !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
|tid || int || Token ID; read-only property&lt;br /&gt;
|-&lt;br /&gt;
|completed ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|participant_id || ||&lt;br /&gt;
|-&lt;br /&gt;
|language || string || &lt;br /&gt;
|-&lt;br /&gt;
|usesleft || ||&lt;br /&gt;
|-&lt;br /&gt;
|firstname || String || Participant&#039;s first name&lt;br /&gt;
|-&lt;br /&gt;
|lastname || String || Participant&#039;s last name&lt;br /&gt;
|-&lt;br /&gt;
|email || String || Participant&#039;s e-mail address&lt;br /&gt;
|-&lt;br /&gt;
|blacklisted || ||&lt;br /&gt;
|-&lt;br /&gt;
|validfrom || ||&lt;br /&gt;
|-&lt;br /&gt;
|sent || ||&lt;br /&gt;
|-&lt;br /&gt;
|validuntil || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindersent || ||&lt;br /&gt;
|-&lt;br /&gt;
|mpid || ||&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindercount || ||&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== activate_tokens ===&lt;br /&gt;
&lt;br /&gt;
Activate tokens.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function activate_tokens($sSessionKey, $iSurveyID, $additional_attributes)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| additional_attributes || array of integer || Any additional attribute fields to create. Just give the attribute IDs.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (array) status OK&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: Any other status&lt;br /&gt;
&lt;br /&gt;
===add_participants===&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a unique token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public add_participants($sSessionKey, $iSurveyID, $participantData, $createTokenKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $participantData || (array) || 2-dimensional array/structure containing your participants data. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;} ]&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| $createTokenKey || boolean || Set this to true if you want a token key created automatically for each entry - if your participant data already included a [token] field it will be overwritten&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array(struct) On success: Structure containing your participants data plus the token ID and (if applicable) the new token. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;} ]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: string Failure Status: &amp;quot;Invalid session key&amp;quot;, &amp;quot;No permission&amp;quot;, &amp;quot;Invalid survey ID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===delete_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
===get_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get. All properties defined in [[#Token Properties]] can be read.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
===set_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set. All writeable properties defined in [[#Token Properties]] can be written.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===list_participants===&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
===activate_tokens===&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
===invite_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
===remind_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
== Responses ==&lt;br /&gt;
&lt;br /&gt;
===add_response===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses===&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses_by_token===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64101</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64101"/>
		<updated>2015-01-27T17:05:24Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: unified return value description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
== Sessions ==&lt;br /&gt;
&lt;br /&gt;
=== get_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function get_session_key($username, $password)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| username || string || User name&lt;br /&gt;
|-&lt;br /&gt;
| password || string || Password&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) session key.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on error&#039;&#039;&#039;:  for protocol-level errors (invalid format etc), an error message. For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
=== release_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function release_session_key($sSessionKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: Always &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
== Site ==&lt;br /&gt;
&lt;br /&gt;
=== get_site_settings ===&lt;br /&gt;
&lt;br /&gt;
Function to query site settings. Can only be used by administrators.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function get_site_settings( $sSessionKey, $sSetttingName)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| sSetttingName || string || Name of the setting to get&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) Setting&#039;s value&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: (string) Error message&lt;br /&gt;
&lt;br /&gt;
== Surveys ==&lt;br /&gt;
&lt;br /&gt;
===add_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===import_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
===get_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
===list_surveys===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===activate_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===export_statistics===&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===get_summary===&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===add_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===delete_survey_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
===get_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
== Groups and Users ==&lt;br /&gt;
&lt;br /&gt;
===add_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
===import_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
===get_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_groups===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===list_users===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===delete_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
===import_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
===get_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_questions===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
== Tokens and Participants ==&lt;br /&gt;
&lt;br /&gt;
=== Token Properties  ===&lt;br /&gt;
&lt;br /&gt;
The following properties of tokens can be read or set:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Property !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
|tid || int || Token ID; read-only property&lt;br /&gt;
|-&lt;br /&gt;
|completed ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|participant_id || ||&lt;br /&gt;
|-&lt;br /&gt;
|language || string || &lt;br /&gt;
|-&lt;br /&gt;
|usesleft || ||&lt;br /&gt;
|-&lt;br /&gt;
|firstname || String || Participant&#039;s first name&lt;br /&gt;
|-&lt;br /&gt;
|lastname || String || Participant&#039;s last name&lt;br /&gt;
|-&lt;br /&gt;
|email || String || Participant&#039;s e-mail address&lt;br /&gt;
|-&lt;br /&gt;
|blacklisted || ||&lt;br /&gt;
|-&lt;br /&gt;
|validfrom || ||&lt;br /&gt;
|-&lt;br /&gt;
|sent || ||&lt;br /&gt;
|-&lt;br /&gt;
|validuntil || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindersent || ||&lt;br /&gt;
|-&lt;br /&gt;
|mpid || ||&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindercount || ||&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== activate_tokens ===&lt;br /&gt;
&lt;br /&gt;
Activate tokens.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function activate_tokens($sSessionKey, $iSurveyID, $additional_attributes)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| additional_attributes || array of integer || Any additional attribute fields to create. Just give the attribute IDs.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (array) status OK&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: Any other status&lt;br /&gt;
&lt;br /&gt;
===add_participants===&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a unique token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public add_participants($sSessionKey, $iSurveyID, $participantData, $createTokenKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $participantData || (array) || 2-dimensional array/structure containing your participants data. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;} ]&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| $createTokenKey || boolean || Set this to true if you want a token key created automatically for each entry - if your participant data already included a [token] field it will be overwritten&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array(struct) On success: Structure containing your participants data plus the token ID and (if applicable) the new token. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;} ]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: string Failure Status: &amp;quot;Invalid session key&amp;quot;, &amp;quot;No permission&amp;quot;, &amp;quot;Invalid survey ID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===delete_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
===get_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get. All properties defined in [[#Token Properties]] can be read.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
===set_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set. All writeable properties defined in [[#Token Properties]] can be written.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===list_participants===&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
===activate_tokens===&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
===invite_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
===remind_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
== Responses ==&lt;br /&gt;
&lt;br /&gt;
===add_response===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses===&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses_by_token===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64100</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64100"/>
		<updated>2015-01-27T17:01:30Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: reformatted get_site_settings&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
== Sessions ==&lt;br /&gt;
&lt;br /&gt;
=== get_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function get_session_key($username, $password)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| username || string || User name&lt;br /&gt;
|-&lt;br /&gt;
| password || string || Password&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Return Status !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| success || string || session key&lt;br /&gt;
|-&lt;br /&gt;
| failure ||  || for protocol-level errors (invalid format etc), an error message. For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== release_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function release_session_key($sSessionKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: Always &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
== Site ==&lt;br /&gt;
&lt;br /&gt;
=== get_site_settings ===&lt;br /&gt;
&lt;br /&gt;
Function to query site settings. Can only be used by administrators.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function get_site_settings( $sSessionKey, $sSetttingName)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| sSetttingName || string || Name of the setting to get&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (string) Setting&#039;s value&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: (string) Error message&lt;br /&gt;
&lt;br /&gt;
== Surveys ==&lt;br /&gt;
&lt;br /&gt;
===add_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===import_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
===get_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
===list_surveys===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===activate_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===export_statistics===&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===get_summary===&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===add_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===delete_survey_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
===get_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
== Groups and Users ==&lt;br /&gt;
&lt;br /&gt;
===add_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
===import_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
===get_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_groups===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===list_users===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===delete_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
===import_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
===get_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_questions===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
== Tokens and Participants ==&lt;br /&gt;
&lt;br /&gt;
=== Token Properties  ===&lt;br /&gt;
&lt;br /&gt;
The following properties of tokens can be read or set:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Property !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
|tid || int || Token ID; read-only property&lt;br /&gt;
|-&lt;br /&gt;
|completed ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|participant_id || ||&lt;br /&gt;
|-&lt;br /&gt;
|language || string || &lt;br /&gt;
|-&lt;br /&gt;
|usesleft || ||&lt;br /&gt;
|-&lt;br /&gt;
|firstname || String || Participant&#039;s first name&lt;br /&gt;
|-&lt;br /&gt;
|lastname || String || Participant&#039;s last name&lt;br /&gt;
|-&lt;br /&gt;
|email || String || Participant&#039;s e-mail address&lt;br /&gt;
|-&lt;br /&gt;
|blacklisted || ||&lt;br /&gt;
|-&lt;br /&gt;
|validfrom || ||&lt;br /&gt;
|-&lt;br /&gt;
|sent || ||&lt;br /&gt;
|-&lt;br /&gt;
|validuntil || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindersent || ||&lt;br /&gt;
|-&lt;br /&gt;
|mpid || ||&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindercount || ||&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== activate_tokens ===&lt;br /&gt;
&lt;br /&gt;
Activate tokens.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function activate_tokens($sSessionKey, $iSurveyID, $additional_attributes)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| additional_attributes || array of integer || Any additional attribute fields to create. Just give the attribute IDs.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (array) status OK&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: Any other status&lt;br /&gt;
&lt;br /&gt;
===add_participants===&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a unique token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public add_participants($sSessionKey, $iSurveyID, $participantData, $createTokenKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $participantData || (array) || 2-dimensional array/structure containing your participants data. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;} ]&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| $createTokenKey || boolean || Set this to true if you want a token key created automatically for each entry - if your participant data already included a [token] field it will be overwritten&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array(struct) On success: Structure containing your participants data plus the token ID and (if applicable) the new token. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;} ]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: string Failure Status: &amp;quot;Invalid session key&amp;quot;, &amp;quot;No permission&amp;quot;, &amp;quot;Invalid survey ID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===delete_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
===get_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get. All properties defined in [[#Token Properties]] can be read.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
===set_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set. All writeable properties defined in [[#Token Properties]] can be written.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===list_participants===&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
===activate_tokens===&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
===invite_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
===remind_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
== Responses ==&lt;br /&gt;
&lt;br /&gt;
===add_response===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses===&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses_by_token===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64087</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64087"/>
		<updated>2015-01-27T14:41:55Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: checked and re-formatted; named session key $sSessionKey&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
== Sessions ==&lt;br /&gt;
&lt;br /&gt;
=== get_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function get_session_key($username, $password)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| username || string || User name&lt;br /&gt;
|-&lt;br /&gt;
| password || string || Password&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Return Status !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| success || string || session key&lt;br /&gt;
|-&lt;br /&gt;
| failure ||  || for protocol-level errors (invalid format etc), an error message. For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== release_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function release_session_key($sSessionKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: Always &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
== Site ==&lt;br /&gt;
&lt;br /&gt;
===get_site_settings===&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
== Surveys ==&lt;br /&gt;
&lt;br /&gt;
===add_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===import_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
===get_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
===list_surveys===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===activate_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===export_statistics===&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===get_summary===&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===add_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===delete_survey_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
===get_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
== Groups and Users ==&lt;br /&gt;
&lt;br /&gt;
===add_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
===import_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
===get_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_groups===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===list_users===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===delete_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
===import_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
===get_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_questions===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
== Tokens and Participants ==&lt;br /&gt;
&lt;br /&gt;
=== Token Properties  ===&lt;br /&gt;
&lt;br /&gt;
The following properties of tokens can be read or set:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Property !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
|tid || int || Token ID; read-only property&lt;br /&gt;
|-&lt;br /&gt;
|completed ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|participant_id || ||&lt;br /&gt;
|-&lt;br /&gt;
|language || string || &lt;br /&gt;
|-&lt;br /&gt;
|usesleft || ||&lt;br /&gt;
|-&lt;br /&gt;
|firstname || String || Participant&#039;s first name&lt;br /&gt;
|-&lt;br /&gt;
|lastname || String || Participant&#039;s last name&lt;br /&gt;
|-&lt;br /&gt;
|email || String || Participant&#039;s e-mail address&lt;br /&gt;
|-&lt;br /&gt;
|blacklisted || ||&lt;br /&gt;
|-&lt;br /&gt;
|validfrom || ||&lt;br /&gt;
|-&lt;br /&gt;
|sent || ||&lt;br /&gt;
|-&lt;br /&gt;
|validuntil || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindersent || ||&lt;br /&gt;
|-&lt;br /&gt;
|mpid || ||&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindercount || ||&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== activate_tokens ===&lt;br /&gt;
&lt;br /&gt;
Activate tokens.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function activate_tokens($sSessionKey, $iSurveyID, $additional_attributes)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| additional_attributes || array of integer || Any additional attribute fields to create. Just give the attribute IDs.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (array) status OK&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: Any other status&lt;br /&gt;
&lt;br /&gt;
===add_participants===&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a unique token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public add_participants($sSessionKey, $iSurveyID, $participantData, $createTokenKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $participantData || (array) || 2-dimensional array/structure containing your participants data. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;} ]&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| $createTokenKey || boolean || Set this to true if you want a token key created automatically for each entry - if your participant data already included a [token] field it will be overwritten&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array(struct) On success: Structure containing your participants data plus the token ID and (if applicable) the new token. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;} ]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: string Failure Status: &amp;quot;Invalid session key&amp;quot;, &amp;quot;No permission&amp;quot;, &amp;quot;Invalid survey ID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===delete_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
===get_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get. All properties defined in [[#Token Properties]] can be read.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
===set_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set. All writeable properties defined in [[#Token Properties]] can be written.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===list_participants===&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
===activate_tokens===&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
===invite_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
===remind_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
== Responses ==&lt;br /&gt;
&lt;br /&gt;
===add_response===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses===&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses_by_token===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64086</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64086"/>
		<updated>2015-01-27T14:38:00Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: modified tables&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
== Sessions ==&lt;br /&gt;
&lt;br /&gt;
=== get_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function get_session_key($username, $password)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| username || string || User name&lt;br /&gt;
|-&lt;br /&gt;
| password || string || Password&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Return Status !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| success || string || session key&lt;br /&gt;
|-&lt;br /&gt;
| failure ||  || for protocol-level errors (invalid format etc), an error message. For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===release_session_key===&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
== Site ==&lt;br /&gt;
&lt;br /&gt;
===get_site_settings===&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
== Surveys ==&lt;br /&gt;
&lt;br /&gt;
===add_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===import_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
===get_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
===list_surveys===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===activate_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===export_statistics===&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===get_summary===&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===add_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===delete_survey_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
===get_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
== Groups and Users ==&lt;br /&gt;
&lt;br /&gt;
===add_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
===import_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
===get_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_groups===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===list_users===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===delete_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
===import_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
===get_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_questions===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
== Tokens and Participants ==&lt;br /&gt;
&lt;br /&gt;
=== Token Properties  ===&lt;br /&gt;
&lt;br /&gt;
The following properties of tokens can be read or set:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Property !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
|tid || int || Token ID; read-only property&lt;br /&gt;
|-&lt;br /&gt;
|completed ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|participant_id || ||&lt;br /&gt;
|-&lt;br /&gt;
|language || string || &lt;br /&gt;
|-&lt;br /&gt;
|usesleft || ||&lt;br /&gt;
|-&lt;br /&gt;
|firstname || String || Participant&#039;s first name&lt;br /&gt;
|-&lt;br /&gt;
|lastname || String || Participant&#039;s last name&lt;br /&gt;
|-&lt;br /&gt;
|email || String || Participant&#039;s e-mail address&lt;br /&gt;
|-&lt;br /&gt;
|blacklisted || ||&lt;br /&gt;
|-&lt;br /&gt;
|validfrom || ||&lt;br /&gt;
|-&lt;br /&gt;
|sent || ||&lt;br /&gt;
|-&lt;br /&gt;
|validuntil || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindersent || ||&lt;br /&gt;
|-&lt;br /&gt;
|mpid || ||&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindercount || ||&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== activate_tokens ===&lt;br /&gt;
&lt;br /&gt;
Activate tokens.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function activate_tokens($sSessionKey, $iSurveyID, $additional_attributes)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| additional_attributes || array of integer || Any additional attribute fields to create. Just give the attribute IDs.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (array) status OK&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: Any other status&lt;br /&gt;
&lt;br /&gt;
===add_participants===&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a unique token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public add_participants($sSessionKey, $iSurveyID, $participantData, $createTokenKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $participantData || (array) || 2-dimensional array/structure containing your participants data. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;} ]&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| $createTokenKey || boolean || Set this to true if you want a token key created automatically for each entry - if your participant data already included a [token] field it will be overwritten&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array(struct) On success: Structure containing your participants data plus the token ID and (if applicable) the new token. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;} ]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: string Failure Status: &amp;quot;Invalid session key&amp;quot;, &amp;quot;No permission&amp;quot;, &amp;quot;Invalid survey ID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===delete_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
===get_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get. All properties defined in [[#Token Properties]] can be read.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
===set_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set. All writeable properties defined in [[#Token Properties]] can be written.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===list_participants===&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
===activate_tokens===&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
===invite_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
===remind_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
== Responses ==&lt;br /&gt;
&lt;br /&gt;
===add_response===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses===&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses_by_token===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64085</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64085"/>
		<updated>2015-01-27T14:35:45Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: checked an re-formatted get_session_key()&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
== Sessions ==&lt;br /&gt;
&lt;br /&gt;
=== get_session_key ===&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function get_session_key($username, $password)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Parameters&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| username || string || User name&lt;br /&gt;
|-&lt;br /&gt;
| password || string || Password&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Return values&lt;br /&gt;
! Status !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| success || string || session key&lt;br /&gt;
|-&lt;br /&gt;
| failure ||  || for protocol-level errors (invalid format etc), an error message. For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===release_session_key===&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
== Site ==&lt;br /&gt;
&lt;br /&gt;
===get_site_settings===&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
== Surveys ==&lt;br /&gt;
&lt;br /&gt;
===add_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===import_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
===get_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
===list_surveys===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===activate_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===export_statistics===&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===get_summary===&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===add_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===delete_survey_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
===get_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
== Groups and Users ==&lt;br /&gt;
&lt;br /&gt;
===add_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
===import_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
===get_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_groups===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===list_users===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===delete_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
===import_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
===get_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_questions===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
== Tokens and Participants ==&lt;br /&gt;
&lt;br /&gt;
=== Token Properties  ===&lt;br /&gt;
&lt;br /&gt;
The following properties of tokens can be read or set:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Property !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
|tid || int || Token ID; read-only property&lt;br /&gt;
|-&lt;br /&gt;
|completed ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|participant_id || ||&lt;br /&gt;
|-&lt;br /&gt;
|language || string || &lt;br /&gt;
|-&lt;br /&gt;
|usesleft || ||&lt;br /&gt;
|-&lt;br /&gt;
|firstname || String || Participant&#039;s first name&lt;br /&gt;
|-&lt;br /&gt;
|lastname || String || Participant&#039;s last name&lt;br /&gt;
|-&lt;br /&gt;
|email || String || Participant&#039;s e-mail address&lt;br /&gt;
|-&lt;br /&gt;
|blacklisted || ||&lt;br /&gt;
|-&lt;br /&gt;
|validfrom || ||&lt;br /&gt;
|-&lt;br /&gt;
|sent || ||&lt;br /&gt;
|-&lt;br /&gt;
|validuntil || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindersent || ||&lt;br /&gt;
|-&lt;br /&gt;
|mpid || ||&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindercount || ||&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== activate_tokens ===&lt;br /&gt;
&lt;br /&gt;
Activate tokens.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function activate_tokens($sSessionKey, $iSurveyID, $additional_attributes)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| additional_attributes || array of integer || Any additional attribute fields to create. Just give the attribute IDs.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (array) status OK&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: Any other status&lt;br /&gt;
&lt;br /&gt;
===add_participants===&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a unique token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public add_participants($sSessionKey, $iSurveyID, $participantData, $createTokenKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $participantData || (array) || 2-dimensional array/structure containing your participants data. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;} ]&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| $createTokenKey || boolean || Set this to true if you want a token key created automatically for each entry - if your participant data already included a [token] field it will be overwritten&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array(struct) On success: Structure containing your participants data plus the token ID and (if applicable) the new token. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;} ]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: string Failure Status: &amp;quot;Invalid session key&amp;quot;, &amp;quot;No permission&amp;quot;, &amp;quot;Invalid survey ID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===delete_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
===get_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get. All properties defined in [[#Token Properties]] can be read.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
===set_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set. All writeable properties defined in [[#Token Properties]] can be written.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===list_participants===&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
===activate_tokens===&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
===invite_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
===remind_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
== Responses ==&lt;br /&gt;
&lt;br /&gt;
===add_response===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses===&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses_by_token===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64084</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64084"/>
		<updated>2015-01-27T14:05:14Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: New section Token Properties for reference&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
== Sessions ==&lt;br /&gt;
&lt;br /&gt;
===get_session_key===&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure:  for protocol-level errors (invalid format etc), an error message.  For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
===release_session_key===&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
== Site ==&lt;br /&gt;
&lt;br /&gt;
===get_site_settings===&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
== Surveys ==&lt;br /&gt;
&lt;br /&gt;
===add_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===import_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
===get_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
===list_surveys===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===activate_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===export_statistics===&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===get_summary===&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===add_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===delete_survey_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
===get_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
== Groups and Users ==&lt;br /&gt;
&lt;br /&gt;
===add_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
===import_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
===get_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_groups===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===list_users===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===delete_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
===import_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
===get_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_questions===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
== Tokens and Participants ==&lt;br /&gt;
&lt;br /&gt;
=== Token Properties  ===&lt;br /&gt;
&lt;br /&gt;
The following properties of tokens can be read or set:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Property !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
|tid || int || Token ID; read-only property&lt;br /&gt;
|-&lt;br /&gt;
|completed ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|participant_id || ||&lt;br /&gt;
|-&lt;br /&gt;
|language || string || &lt;br /&gt;
|-&lt;br /&gt;
|usesleft || ||&lt;br /&gt;
|-&lt;br /&gt;
|firstname || String || Participant&#039;s first name&lt;br /&gt;
|-&lt;br /&gt;
|lastname || String || Participant&#039;s last name&lt;br /&gt;
|-&lt;br /&gt;
|email || String || Participant&#039;s e-mail address&lt;br /&gt;
|-&lt;br /&gt;
|blacklisted || ||&lt;br /&gt;
|-&lt;br /&gt;
|validfrom || ||&lt;br /&gt;
|-&lt;br /&gt;
|sent || ||&lt;br /&gt;
|-&lt;br /&gt;
|validuntil || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindersent || ||&lt;br /&gt;
|-&lt;br /&gt;
|mpid || ||&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus || ||&lt;br /&gt;
|-&lt;br /&gt;
|remindercount || ||&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== activate_tokens ===&lt;br /&gt;
&lt;br /&gt;
Activate tokens.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function activate_tokens($sSessionKey, $iSurveyID, $additional_attributes)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| additional_attributes || array of integer || Any additional attribute fields to create. Just give the attribute IDs.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (array) status OK&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: Any other status&lt;br /&gt;
&lt;br /&gt;
===add_participants===&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a unique token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public add_participants($sSessionKey, $iSurveyID, $participantData, $createTokenKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $participantData || (array) || 2-dimensional array/structure containing your participants data. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;} ]&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| $createTokenKey || boolean || Set this to true if you want a token key created automatically for each entry - if your participant data already included a [token] field it will be overwritten&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array(struct) On success: Structure containing your participants data plus the token ID and (if applicable) the new token. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;} ]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: string Failure Status: &amp;quot;Invalid session key&amp;quot;, &amp;quot;No permission&amp;quot;, &amp;quot;Invalid survey ID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===delete_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
===get_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get. All properties defined in [[#Token Properties]] can be read.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
===set_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set. All writeable properties defined in [[#Token Properties]] can be written.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===list_participants===&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
===activate_tokens===&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
===invite_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
===remind_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
== Responses ==&lt;br /&gt;
&lt;br /&gt;
===add_response===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses===&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses_by_token===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64083</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64083"/>
		<updated>2015-01-27T13:57:48Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: removed some noise&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
== Sessions ==&lt;br /&gt;
&lt;br /&gt;
===get_session_key===&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure:  for protocol-level errors (invalid format etc), an error message.  For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
===release_session_key===&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
== Site ==&lt;br /&gt;
&lt;br /&gt;
===get_site_settings===&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
== Surveys ==&lt;br /&gt;
&lt;br /&gt;
===add_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===import_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
===get_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
===list_surveys===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===activate_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===export_statistics===&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===get_summary===&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===add_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===delete_survey_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
===get_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
== Groups and Users ==&lt;br /&gt;
&lt;br /&gt;
===add_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
===import_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
===get_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_groups===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===list_users===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===delete_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
===import_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
===get_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_questions===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
== Tokens and Participants ==&lt;br /&gt;
&lt;br /&gt;
=== activate_tokens ===&lt;br /&gt;
&lt;br /&gt;
Activate tokens.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function activate_tokens($sSessionKey, $iSurveyID, $additional_attributes)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| additional_attributes || array of integer || Any additional attribute fields to create. Just give the attribute IDs.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (array) status OK&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: Any other status&lt;br /&gt;
&lt;br /&gt;
===add_participants===&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a unique token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public add_participants($sSessionKey, $iSurveyID, $participantData, $createTokenKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $participantData || (array) || 2-dimensional array/structure containing your participants data. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;} ]&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| $createTokenKey || boolean || Set this to true if you want a token key created automatically for each entry - if your participant data already included a [token] field it will be overwritten&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array(struct) On success: Structure containing your participants data plus the token ID and (if applicable) the new token. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;} ]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: string Failure Status: &amp;quot;Invalid session key&amp;quot;, &amp;quot;No permission&amp;quot;, &amp;quot;Invalid survey ID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===delete_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
===get_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|tid||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_participants===&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
===activate_tokens===&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
===invite_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
===remind_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
== Responses ==&lt;br /&gt;
&lt;br /&gt;
===add_response===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses===&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses_by_token===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64082</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64082"/>
		<updated>2015-01-27T13:56:07Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: reformatted activate_tokens&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
== Sessions ==&lt;br /&gt;
&lt;br /&gt;
===get_session_key===&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure:  for protocol-level errors (invalid format etc), an error message.  For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
===release_session_key===&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
== Site ==&lt;br /&gt;
&lt;br /&gt;
===get_site_settings===&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
== Surveys ==&lt;br /&gt;
&lt;br /&gt;
===add_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===import_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
===get_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
===list_surveys===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===activate_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===export_statistics===&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===get_summary===&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===add_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===delete_survey_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
===get_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
== Groups and Users ==&lt;br /&gt;
&lt;br /&gt;
===add_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
===import_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
===get_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_groups===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===list_users===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===delete_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
===import_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
===get_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_questions===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
== Tokens and Participants ==&lt;br /&gt;
&lt;br /&gt;
=== activate_tokens ===&lt;br /&gt;
&lt;br /&gt;
Activate tokens.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function activate_tokens($sSessionKey, $iSurveyID, $additional_attributes)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| additional_attributes) || array of integer || Any additional attribute fields to create. Just give the attribute IDs.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on success&#039;&#039;&#039;: (array) status OK&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return on failure&#039;&#039;&#039;: Any other status&lt;br /&gt;
&lt;br /&gt;
===add_participants===&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a unique token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public add_participants($sSessionKey, $iSurveyID, $participantData, $createTokenKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $participantData || (array) || 2-dimensional array/structure containing your participants data. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;} ]&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| $createTokenKey || boolean || Set this to true if you want a token key created automatically for each entry - if your participant data already included a [token] field it will be overwritten&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array(struct) On success: Structure containing your participants data plus the token ID and (if applicable) the new token. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;} ]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: string Failure Status: &amp;quot;Invalid session key&amp;quot;, &amp;quot;No permission&amp;quot;, &amp;quot;Invalid survey ID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===delete_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
===get_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|tid||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_participants===&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
===activate_tokens===&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
===invite_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
===remind_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
== Responses ==&lt;br /&gt;
&lt;br /&gt;
===add_response===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses===&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses_by_token===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64081</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64081"/>
		<updated>2015-01-27T13:45:14Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: simplified add_participants example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
== Sessions ==&lt;br /&gt;
&lt;br /&gt;
===get_session_key===&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure:  for protocol-level errors (invalid format etc), an error message.  For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
===release_session_key===&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
== Site ==&lt;br /&gt;
&lt;br /&gt;
===get_site_settings===&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
== Surveys ==&lt;br /&gt;
&lt;br /&gt;
===add_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===import_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
===get_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
===list_surveys===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===activate_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===export_statistics===&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===get_summary===&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===add_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===delete_survey_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
===get_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
== Groups and Users ==&lt;br /&gt;
&lt;br /&gt;
===add_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
===import_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
===get_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_groups===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===list_users===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===delete_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
===import_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
===get_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_questions===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
== Tokens and Participants ==&lt;br /&gt;
&lt;br /&gt;
===activate_tokens===&lt;br /&gt;
&lt;br /&gt;
Activate tokens&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
surveyid (string) The survey ID&lt;br /&gt;
&lt;br /&gt;
additional_attributes (array of integers) Any additional attribute fields to create. Just give the attribute IDs&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) status OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
&lt;br /&gt;
===add_participants===&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a unique token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public add_participants($sSessionKey, $iSurveyID, $participantData, $createTokenKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $participantData || (array) || 2-dimensional array/structure containing your participants data. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;} ]&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| $createTokenKey || boolean || Set this to true if you want a token key created automatically for each entry - if your participant data already included a [token] field it will be overwritten&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array(struct) On success: Structure containing your participants data plus the token ID and (if applicable) the new token. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;} ]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: string Failure Status: &amp;quot;Invalid session key&amp;quot;, &amp;quot;No permission&amp;quot;, &amp;quot;Invalid survey ID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===delete_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
===get_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|tid||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_participants===&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
===activate_tokens===&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
===invite_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
===remind_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
== Responses ==&lt;br /&gt;
&lt;br /&gt;
===add_response===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses===&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses_by_token===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64080</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64080"/>
		<updated>2015-01-27T13:27:48Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: Structured thematically&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
== Sessions ==&lt;br /&gt;
&lt;br /&gt;
===get_session_key===&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure:  for protocol-level errors (invalid format etc), an error message.  For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
===release_session_key===&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
== Site ==&lt;br /&gt;
&lt;br /&gt;
===get_site_settings===&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
== Surveys ==&lt;br /&gt;
&lt;br /&gt;
===add_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===import_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
===get_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_survey_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
===list_surveys===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===activate_survey===&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===export_statistics===&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===get_summary===&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===add_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===delete_survey_language===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
===get_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_language_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
== Groups and Users ==&lt;br /&gt;
&lt;br /&gt;
===add_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
===delete_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
===import_group===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
===get_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_group_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_groups===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
===list_users===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===delete_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
===import_question===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
===get_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_question_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_questions===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
== Tokens and Participants ==&lt;br /&gt;
&lt;br /&gt;
===activate_tokens===&lt;br /&gt;
&lt;br /&gt;
Activate tokens&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
surveyid (string) The survey ID&lt;br /&gt;
&lt;br /&gt;
additional_attributes (array of integers) Any additional attribute fields to create. Just give the attribute IDs&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) status OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
&lt;br /&gt;
===add_participants===&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a unique token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public add_participants($sSessionKey, $iSurveyID, $participantData, $createTokenKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $participantData || (array) || 2-dimensional array/structure containing your participants data. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;{ &amp;quot;participantData&amp;quot;: [ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;} ] }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| $createTokenKey || boolean || Set this to true if you want a token key created automatically for each entry - if your participant data already included a [token] field it will be overwritten&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array(struct) On success: Structure containing your participants data plus the token ID and (if applicable) the new token. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;} ]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: string Failure Status: &amp;quot;Invalid session key&amp;quot;, &amp;quot;No permission&amp;quot;, &amp;quot;Invalid survey ID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===delete_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
===get_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|tid||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===set_participant_properties===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===list_participants===&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
===activate_tokens===&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
===invite_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
===remind_participants===&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
== Responses ==&lt;br /&gt;
&lt;br /&gt;
===add_response===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses===&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===export_responses_by_token===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64072</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64072"/>
		<updated>2015-01-27T12:12:46Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: Rewrote add_participants section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
==get_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure:  for protocol-level errors (invalid format etc), an error message.  For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
==release_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
==get_site_settings==&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
==add_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==import_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
==get_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
==list_surveys==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==activate_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==export_statistics==&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==get_summary==&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==add_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==delete_survey_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
==get_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
==add_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
==import_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
==get_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_groups==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==list_users==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
==delete_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
==import_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
==get_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_questions==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
Activate tokens&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
surveyid (string) The survey ID&lt;br /&gt;
&lt;br /&gt;
additional_attributes (array of integers) Any additional attribute fields to create. Just give the attribute IDs&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) status OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
&lt;br /&gt;
==add_participants==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public add_participants($sSessionKey, $iSurveyID, $participantData, $createTokenKey)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $participantData || (array) || 2-dimensional array/structure containing your participants data. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;{ &amp;quot;participantData&amp;quot;: [ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;} ] }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| $createTokenKey || boolean || Set this to true if you want a token key create automatically for each entry - if your participant data included a [token] field it will be overwritten&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array(struct) On success: Structure containing your participants data plus the token ID and (if applicable) the new token. Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
[ {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;} ]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: string Failure Status: &amp;quot;Invalid session key&amp;quot;, &amp;quot;No permission&amp;quot;, &amp;quot;Invalid survey ID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==delete_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
==get_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|tid||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_participants==&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
==invite_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==remind_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==add_response==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==export_responses==&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==export_responses_by_token==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64071</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64071"/>
		<updated>2015-01-27T12:00:41Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: reformatted add_participants&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
==get_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure:  for protocol-level errors (invalid format etc), an error message.  For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
==release_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
==get_site_settings==&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
==add_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==import_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
==get_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
==list_surveys==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==activate_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==export_statistics==&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==get_summary==&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==add_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==delete_survey_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
==get_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
==add_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
==import_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
==get_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_groups==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==list_users==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
==delete_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
==import_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
==get_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_questions==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
Activate tokens&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
surveyid (string) The survey ID&lt;br /&gt;
&lt;br /&gt;
additional_attributes (array of integers) Any additional attribute fields to create. Just give the attribute IDs&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) status OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
&lt;br /&gt;
==add_participants==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sessionkey (string) - The session key&lt;br /&gt;
*surveyID (string) - The survey id&lt;br /&gt;
*participantData (array) -  2-dimensional array/structure containing your participants data&lt;br /&gt;
*createTokenKey (boolean) - Set this to true if you want a token key create automatically for each entry - if your participant data included a [token] field it will be overwritten&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success:  participant data (struct) -  structure containing your participants data plus the token ID and (if applicable) the new token&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
&lt;br /&gt;
JSON-RPC example:&lt;br /&gt;
&lt;br /&gt;
Request:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
 &amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&lt;br /&gt;
 &amp;quot;method&amp;quot;:&amp;quot;add_participants&amp;quot;,&lt;br /&gt;
 &amp;quot;params&amp;quot;: {&lt;br /&gt;
  &amp;quot;sessionkey&amp;quot;:&amp;quot;73e8rx864rnxmk64gp67bah44u2igivm&amp;quot;,&lt;br /&gt;
  &amp;quot;surveyID&amp;quot;:&amp;quot;668138&amp;quot;,&lt;br /&gt;
  &amp;quot;participantData&amp;quot;: [&lt;br /&gt;
   {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;}&lt;br /&gt;
  ]&lt;br /&gt;
 }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
 &amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&lt;br /&gt;
 &amp;quot;result&amp;quot;: [&lt;br /&gt;
  {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;}&lt;br /&gt;
 ],&lt;br /&gt;
 &amp;quot;error&amp;quot;:null&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==delete_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
==get_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|tid||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_participants==&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
==invite_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==remind_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==add_response==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==export_responses==&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==export_responses_by_token==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64070</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=64070"/>
		<updated>2015-01-27T12:00:20Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: reformatted add_participants&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers a lot of functions. Please check the automatically generated [http://api.limesurvey.org/classes/remotecontrol_handle.html API Documentation].&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
==get_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure:  for protocol-level errors (invalid format etc), an error message.  For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
==release_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
==get_site_settings==&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
==add_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==import_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
==get_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returns&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Available properties&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
* Allways&lt;br /&gt;
** sid&lt;br /&gt;
** language&lt;br /&gt;
** additional_languages&lt;br /&gt;
** active&lt;br /&gt;
* When survey active&lt;br /&gt;
** anonymized&lt;br /&gt;
** datestamp&lt;br /&gt;
** savetimings&lt;br /&gt;
** ipaddr&lt;br /&gt;
** refurl&lt;br /&gt;
&lt;br /&gt;
==list_surveys==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==activate_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==export_statistics==&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==get_summary==&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==add_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==delete_survey_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
==get_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
==add_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
==import_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
==get_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_groups==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==list_users==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
==delete_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
==import_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
==get_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_questions==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
Activate tokens&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
surveyid (string) The survey ID&lt;br /&gt;
&lt;br /&gt;
additional_attributes (array of integers) Any additional attribute fields to create. Just give the attribute IDs&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) status OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
&lt;br /&gt;
==add_participants==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sessionkey (string) - The session key&lt;br /&gt;
*surveyID (string) - The survey id&lt;br /&gt;
*participantData (array) -  2-dimensional array/structure containing your participants data&lt;br /&gt;
*createTokenKey (boolean) - Set this to true if you want a token key create automatically for each entry - if your participant data included a [token] field it will be overwritten&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success:  participant data (struct) -  structure containing your participants data plus the token ID and (if applicable) the new token&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
&lt;br /&gt;
JSON-RPC example:&lt;br /&gt;
&lt;br /&gt;
Request:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
 &amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&lt;br /&gt;
 &amp;quot;method&amp;quot;:&amp;quot;add_participants&amp;quot;,&lt;br /&gt;
 &amp;quot;params&amp;quot;: {&lt;br /&gt;
  &amp;quot;sessionkey&amp;quot;:&amp;quot;73e8rx864rnxmk64gp67bah44u2igivm&amp;quot;,&lt;br /&gt;
  &amp;quot;surveyID&amp;quot;:&amp;quot;668138&amp;quot;,&lt;br /&gt;
  &amp;quot;participantData&amp;quot;: [&lt;br /&gt;
   {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;}&lt;br /&gt;
  ]&lt;br /&gt;
 }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
 &amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&lt;br /&gt;
 &amp;quot;result&amp;quot;: [&lt;br /&gt;
  {&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;}&lt;br /&gt;
 ],&lt;br /&gt;
 &amp;quot;error&amp;quot;:null}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==delete_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
==get_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|tid||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_participants==&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
==invite_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==remind_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==add_response==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==export_responses==&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested data in the specified format as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested data in the specified format as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refered to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==export_responses_by_token==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new \org\jsonrpcphp\jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=62189</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=62189"/>
		<updated>2014-07-30T15:51:12Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: improved documentation for add_response&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
==get_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure:  for protocol-level errors (invalid format etc), an error message.  For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
==release_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
==get_site_settings==&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
==add_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==import_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
==get_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|properties not allowed to be modified|| Properties not allowed to be modified when survey active&lt;br /&gt;
|-&lt;br /&gt;
|sid||anonymized&lt;br /&gt;
|-&lt;br /&gt;
|language||datestamp&lt;br /&gt;
|-&lt;br /&gt;
|additional_languages||savetimings&lt;br /&gt;
|-&lt;br /&gt;
|active||ipaddr&lt;br /&gt;
|-&lt;br /&gt;
|||refurl&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_surveys==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==activate_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==export_statistics==&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==get_summary==&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==add_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==delete_survey_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
==get_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
==add_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
==import_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
==get_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_groups==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==list_users==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
==delete_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
==import_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
==get_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_questions==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
Activate tokens&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
surveyid (string) The survey ID&lt;br /&gt;
&lt;br /&gt;
additional_attributes (array of integers) Any additional attribute fields to create. Just give the attribute IDs&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) status OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
&lt;br /&gt;
==add_participants==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sessionkey (string) - The session key&lt;br /&gt;
*surveyID (string) - The survey id&lt;br /&gt;
*participantData (array) -  2-dimensional array/structure containing your participants data&lt;br /&gt;
*createTokenKey (boolean) - Set this to true if you want a token key create automatically for each entry - if your participant data included a [token] field it will be overwritten&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success:  participant data (struct) -  structure containing your participants data plus the token ID and (if applicable) the new token&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
&lt;br /&gt;
JSON-RPC example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;method&amp;quot;:&amp;quot;add_participants&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;sessionkey&amp;quot;:&amp;quot;73e8rx864rnxmk64gp67bah44u2igivm&amp;quot;,&amp;quot;surveyID&amp;quot;:&amp;quot;668138&amp;quot;,&amp;quot;participantData&amp;quot;:[{&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;}]}}&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;result&amp;quot;:[{&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;}],&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==delete_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
==get_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|tid||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_participants==&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
==invite_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==remind_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==add_response==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function add_response($sSessionKey, $iSurveyID, $aResponseData)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a response to the survey responses collection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: int|array On success: Returns the id of the inserted survey response. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $aResponseData || array || The actual response&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==export_responses==&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested file as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refer to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==export_responses_by_token==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=62188</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=62188"/>
		<updated>2014-07-30T15:44:31Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: Reformatted&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
==get_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure:  for protocol-level errors (invalid format etc), an error message.  For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
==release_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
==get_site_settings==&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
==add_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==import_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
==get_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|properties not allowed to be modified|| Properties not allowed to be modified when survey active&lt;br /&gt;
|-&lt;br /&gt;
|sid||anonymized&lt;br /&gt;
|-&lt;br /&gt;
|language||datestamp&lt;br /&gt;
|-&lt;br /&gt;
|additional_languages||savetimings&lt;br /&gt;
|-&lt;br /&gt;
|active||ipaddr&lt;br /&gt;
|-&lt;br /&gt;
|||refurl&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_surveys==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==activate_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==export_statistics==&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==get_summary==&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==add_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==delete_survey_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
==get_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
==add_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
==import_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
==get_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_groups==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==list_users==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
==delete_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
==import_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
==get_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_questions==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
Activate tokens&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
surveyid (string) The survey ID&lt;br /&gt;
&lt;br /&gt;
additional_attributes (array of integers) Any additional attribute fields to create. Just give the attribute IDs&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) status OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
&lt;br /&gt;
==add_participants==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sessionkey (string) - The session key&lt;br /&gt;
*surveyID (string) - The survey id&lt;br /&gt;
*participantData (array) -  2-dimensional array/structure containing your participants data&lt;br /&gt;
*createTokenKey (boolean) - Set this to true if you want a token key create automatically for each entry - if your participant data included a [token] field it will be overwritten&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success:  participant data (struct) -  structure containing your participants data plus the token ID and (if applicable) the new token&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
&lt;br /&gt;
JSON-RPC example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;method&amp;quot;:&amp;quot;add_participants&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;sessionkey&amp;quot;:&amp;quot;73e8rx864rnxmk64gp67bah44u2igivm&amp;quot;,&amp;quot;surveyID&amp;quot;:&amp;quot;668138&amp;quot;,&amp;quot;participantData&amp;quot;:[{&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;}]}}&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;result&amp;quot;:[{&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;}],&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==delete_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
==get_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|tid||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_participants==&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
==invite_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==remind_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==add_response==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new responses to your survey response table.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sSessionKey (string) - The session key&lt;br /&gt;
*iSurveyID (integer) - The survey id&lt;br /&gt;
*aResponseData (array) -  array/structure containing your response data&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: response_id (integer) -  Returns the id of the inserted survey response&lt;br /&gt;
*On failure: (array) with error description&lt;br /&gt;
&lt;br /&gt;
==export_responses==&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested file as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refer to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==export_responses_by_token==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=62187</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=62187"/>
		<updated>2014-07-30T15:44:12Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: Reformatted&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
==get_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure:  for protocol-level errors (invalid format etc), an error message.  For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
==release_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
==get_site_settings==&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
==add_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==import_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
==get_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|properties not allowed to be modified|| Properties not allowed to be modified when survey active&lt;br /&gt;
|-&lt;br /&gt;
|sid||anonymized&lt;br /&gt;
|-&lt;br /&gt;
|language||datestamp&lt;br /&gt;
|-&lt;br /&gt;
|additional_languages||savetimings&lt;br /&gt;
|-&lt;br /&gt;
|active||ipaddr&lt;br /&gt;
|-&lt;br /&gt;
|||refurl&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_surveys==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==activate_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==export_statistics==&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==get_summary==&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==add_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==delete_survey_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
==get_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
==add_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
==import_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
==get_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_groups==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==list_users==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
==delete_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
==import_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
==get_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_questions==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
Activate tokens&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
surveyid (string) The survey ID&lt;br /&gt;
&lt;br /&gt;
additional_attributes (array of integers) Any additional attribute fields to create. Just give the attribute IDs&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) status OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
&lt;br /&gt;
==add_participants==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sessionkey (string) - The session key&lt;br /&gt;
*surveyID (string) - The survey id&lt;br /&gt;
*participantData (array) -  2-dimensional array/structure containing your participants data&lt;br /&gt;
*createTokenKey (boolean) - Set this to true if you want a token key create automatically for each entry - if your participant data included a [token] field it will be overwritten&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success:  participant data (struct) -  structure containing your participants data plus the token ID and (if applicable) the new token&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
&lt;br /&gt;
JSON-RPC example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;method&amp;quot;:&amp;quot;add_participants&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;sessionkey&amp;quot;:&amp;quot;73e8rx864rnxmk64gp67bah44u2igivm&amp;quot;,&amp;quot;surveyID&amp;quot;:&amp;quot;668138&amp;quot;,&amp;quot;participantData&amp;quot;:[{&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;}]}}&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;result&amp;quot;:[{&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;}],&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==delete_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
==get_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|tid||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_participants==&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
==invite_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==remind_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==add_response==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new responses to your survey response table.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sSessionKey (string) - The session key&lt;br /&gt;
*iSurveyID (integer) - The survey id&lt;br /&gt;
*aResponseData (array) -  array/structure containing your response data&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: response_id (integer) -  Returns the id of the inserted survey response&lt;br /&gt;
*On failure: (array) with error description&lt;br /&gt;
&lt;br /&gt;
==export_responses==&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RPC Routine to export responses. Returns the requested file as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refer to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==export_responses_by_token==&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=62186</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=62186"/>
		<updated>2014-07-30T15:42:27Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: added return values&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
==get_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure:  for protocol-level errors (invalid format etc), an error message.  For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
==release_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
==get_site_settings==&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
==add_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==import_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
==get_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|properties not allowed to be modified|| Properties not allowed to be modified when survey active&lt;br /&gt;
|-&lt;br /&gt;
|sid||anonymized&lt;br /&gt;
|-&lt;br /&gt;
|language||datestamp&lt;br /&gt;
|-&lt;br /&gt;
|additional_languages||savetimings&lt;br /&gt;
|-&lt;br /&gt;
|active||ipaddr&lt;br /&gt;
|-&lt;br /&gt;
|||refurl&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_surveys==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==activate_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==export_statistics==&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==get_summary==&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==add_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==delete_survey_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
==get_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
==add_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
==import_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
==get_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_groups==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==list_users==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
==delete_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
==import_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
==get_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_questions==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
Activate tokens&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
surveyid (string) The survey ID&lt;br /&gt;
&lt;br /&gt;
additional_attributes (array of integers) Any additional attribute fields to create. Just give the attribute IDs&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) status OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
&lt;br /&gt;
==add_participants==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sessionkey (string) - The session key&lt;br /&gt;
*surveyID (string) - The survey id&lt;br /&gt;
*participantData (array) -  2-dimensional array/structure containing your participants data&lt;br /&gt;
*createTokenKey (boolean) - Set this to true if you want a token key create automatically for each entry - if your participant data included a [token] field it will be overwritten&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success:  participant data (struct) -  structure containing your participants data plus the token ID and (if applicable) the new token&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
&lt;br /&gt;
JSON-RPC example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;method&amp;quot;:&amp;quot;add_participants&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;sessionkey&amp;quot;:&amp;quot;73e8rx864rnxmk64gp67bah44u2igivm&amp;quot;,&amp;quot;surveyID&amp;quot;:&amp;quot;668138&amp;quot;,&amp;quot;participantData&amp;quot;:[{&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;}]}}&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;result&amp;quot;:[{&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;}],&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==delete_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
==get_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|tid||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_participants==&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
==invite_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==remind_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==add_response==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new responses to your survey response table.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sSessionKey (string) - The session key&lt;br /&gt;
*iSurveyID (integer) - The survey id&lt;br /&gt;
*aResponseData (array) -  array/structure containing your response data&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: response_id (integer) -  Returns the id of the inserted survey response&lt;br /&gt;
*On failure: (array) with error description&lt;br /&gt;
&lt;br /&gt;
==export_responses==&lt;br /&gt;
RPC Routine to export responses. Returns the requested file as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refer to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==export_responses_by_token==&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=62185</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=62185"/>
		<updated>2014-07-30T15:41:39Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: improved documentation of export_responses_by_token&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
==get_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure:  for protocol-level errors (invalid format etc), an error message.  For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
==release_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
==get_site_settings==&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
==add_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==import_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
==get_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|properties not allowed to be modified|| Properties not allowed to be modified when survey active&lt;br /&gt;
|-&lt;br /&gt;
|sid||anonymized&lt;br /&gt;
|-&lt;br /&gt;
|language||datestamp&lt;br /&gt;
|-&lt;br /&gt;
|additional_languages||savetimings&lt;br /&gt;
|-&lt;br /&gt;
|active||ipaddr&lt;br /&gt;
|-&lt;br /&gt;
|||refurl&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_surveys==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==activate_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==export_statistics==&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==get_summary==&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==add_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==delete_survey_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
==get_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
==add_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
==import_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
==get_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_groups==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==list_users==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
==delete_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
==import_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
==get_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_questions==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
Activate tokens&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
surveyid (string) The survey ID&lt;br /&gt;
&lt;br /&gt;
additional_attributes (array of integers) Any additional attribute fields to create. Just give the attribute IDs&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) status OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
&lt;br /&gt;
==add_participants==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sessionkey (string) - The session key&lt;br /&gt;
*surveyID (string) - The survey id&lt;br /&gt;
*participantData (array) -  2-dimensional array/structure containing your participants data&lt;br /&gt;
*createTokenKey (boolean) - Set this to true if you want a token key create automatically for each entry - if your participant data included a [token] field it will be overwritten&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success:  participant data (struct) -  structure containing your participants data plus the token ID and (if applicable) the new token&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
&lt;br /&gt;
JSON-RPC example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;method&amp;quot;:&amp;quot;add_participants&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;sessionkey&amp;quot;:&amp;quot;73e8rx864rnxmk64gp67bah44u2igivm&amp;quot;,&amp;quot;surveyID&amp;quot;:&amp;quot;668138&amp;quot;,&amp;quot;participantData&amp;quot;:[{&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;}]}}&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;result&amp;quot;:[{&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;}],&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==delete_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
==get_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|tid||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_participants==&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
==invite_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==remind_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==add_response==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new responses to your survey response table.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sSessionKey (string) - The session key&lt;br /&gt;
*iSurveyID (integer) - The survey id&lt;br /&gt;
*aResponseData (array) -  array/structure containing your response data&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: response_id (integer) -  Returns the id of the inserted survey response&lt;br /&gt;
*On failure: (array) with error description&lt;br /&gt;
&lt;br /&gt;
==export_responses==&lt;br /&gt;
RPC Routine to export responses. Returns the requested file as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refer to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
==export_responses_by_token==&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token. Returns the requested file as base64 encoded string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, \&lt;br /&gt;
   $sLanguageCode=null, $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Return&#039;&#039;&#039;: array|string On success: Requested file as base 64-encoded string. On failure array with error information&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sToken || string || The token for which responses needed&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=62184</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=62184"/>
		<updated>2014-07-30T15:36:05Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: Fixed typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
==get_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure:  for protocol-level errors (invalid format etc), an error message.  For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
==release_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
==get_site_settings==&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
==add_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==import_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
==get_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|properties not allowed to be modified|| Properties not allowed to be modified when survey active&lt;br /&gt;
|-&lt;br /&gt;
|sid||anonymized&lt;br /&gt;
|-&lt;br /&gt;
|language||datestamp&lt;br /&gt;
|-&lt;br /&gt;
|additional_languages||savetimings&lt;br /&gt;
|-&lt;br /&gt;
|active||ipaddr&lt;br /&gt;
|-&lt;br /&gt;
|||refurl&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_surveys==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==activate_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==export_statistics==&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==get_summary==&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==add_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==delete_survey_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
==get_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
==add_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
==import_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
==get_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_groups==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==list_users==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
==delete_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
==import_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
==get_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_questions==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
Activate tokens&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
surveyid (string) The survey ID&lt;br /&gt;
&lt;br /&gt;
additional_attributes (array of integers) Any additional attribute fields to create. Just give the attribute IDs&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) status OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
&lt;br /&gt;
==add_participants==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sessionkey (string) - The session key&lt;br /&gt;
*surveyID (string) - The survey id&lt;br /&gt;
*participantData (array) -  2-dimensional array/structure containing your participants data&lt;br /&gt;
*createTokenKey (boolean) - Set this to true if you want a token key create automatically for each entry - if your participant data included a [token] field it will be overwritten&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success:  participant data (struct) -  structure containing your participants data plus the token ID and (if applicable) the new token&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
&lt;br /&gt;
JSON-RPC example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;method&amp;quot;:&amp;quot;add_participants&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;sessionkey&amp;quot;:&amp;quot;73e8rx864rnxmk64gp67bah44u2igivm&amp;quot;,&amp;quot;surveyID&amp;quot;:&amp;quot;668138&amp;quot;,&amp;quot;participantData&amp;quot;:[{&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;}]}}&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;result&amp;quot;:[{&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;}],&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==delete_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
==get_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|tid||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_participants==&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
==invite_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==remind_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==add_response==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new responses to your survey response table.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sSessionKey (string) - The session key&lt;br /&gt;
*iSurveyID (integer) - The survey id&lt;br /&gt;
*aResponseData (array) -  array/structure containing your response data&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: response_id (integer) -  Returns the id of the inserted survey response&lt;br /&gt;
*On failure: (array) with error description&lt;br /&gt;
&lt;br /&gt;
==export_responses==&lt;br /&gt;
RPC Routine to export responses. Returns the requested file as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refer to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
==export_responses_by_token==&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token to pdf,csv,xls,doc&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (int) - Id of the Survey&lt;br /&gt;
&lt;br /&gt;
DocumentType (string) - pdf,csv,xls,doc,html&lt;br /&gt;
&lt;br /&gt;
sToken (string) - Token string of a candidate&lt;br /&gt;
&lt;br /&gt;
sLanguageCode (string) - Optional The language to be used - if not given then the base language will be used&lt;br /&gt;
&lt;br /&gt;
CompletionStatus (string) - Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; selection of responses - defaults to complete&lt;br /&gt;
&lt;br /&gt;
HeadingType (string) - &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039;. type of question heading. Optional defaults to &#039;code&#039;&lt;br /&gt;
&lt;br /&gt;
ResponseType (string) - &#039;short&#039; or &#039;long&#039; response type.Optional defaults to &#039;short&#039;&lt;br /&gt;
&lt;br /&gt;
aFields (array) - Optional Selected fields&lt;br /&gt;
&lt;br /&gt;
Return:&lt;br /&gt;
&lt;br /&gt;
On success: Requested file as base 64-encoded string.&lt;br /&gt;
&lt;br /&gt;
On failure: Array with error information&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=62183</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=62183"/>
		<updated>2014-07-30T15:35:19Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: improved documentation for export_response&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
==get_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure:  for protocol-level errors (invalid format etc), an error message.  For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
==release_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
==get_site_settings==&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
==add_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==import_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
==get_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|properties not allowed to be modified|| Properties not allowed to be modified when survey active&lt;br /&gt;
|-&lt;br /&gt;
|sid||anonymized&lt;br /&gt;
|-&lt;br /&gt;
|language||datestamp&lt;br /&gt;
|-&lt;br /&gt;
|additional_languages||savetimings&lt;br /&gt;
|-&lt;br /&gt;
|active||ipaddr&lt;br /&gt;
|-&lt;br /&gt;
|||refurl&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_surveys==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==activate_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==export_statistics==&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==get_summary==&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==add_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==delete_survey_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
==get_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
==add_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
==import_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
==get_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_groups==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==list_users==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
==delete_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
==import_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
==get_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_questions==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
Activate tokens&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
surveyid (string) The survey ID&lt;br /&gt;
&lt;br /&gt;
additional_attributes (array of integers) Any additional attribute fields to create. Just give the attribute IDs&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) status OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
&lt;br /&gt;
==add_participants==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sessionkey (string) - The session key&lt;br /&gt;
*surveyID (string) - The survey id&lt;br /&gt;
*participantData (array) -  2-dimensional array/structure containing your participants data&lt;br /&gt;
*createTokenKey (boolean) - Set this to true if you want a token key create automatically for each entry - if your participant data included a [token] field it will be overwritten&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success:  participant data (struct) -  structure containing your participants data plus the token ID and (if applicable) the new token&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
&lt;br /&gt;
JSON-RPC example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;method&amp;quot;:&amp;quot;add_participants&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;sessionkey&amp;quot;:&amp;quot;73e8rx864rnxmk64gp67bah44u2igivm&amp;quot;,&amp;quot;surveyID&amp;quot;:&amp;quot;668138&amp;quot;,&amp;quot;participantData&amp;quot;:[{&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;}]}}&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;result&amp;quot;:[{&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;}],&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==delete_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
==get_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|tid||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_participants==&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
==invite_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==remind_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==add_response==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new responses to your survey response table.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sSessionKey (string) - The session key&lt;br /&gt;
*iSurveyID (integer) - The survey id&lt;br /&gt;
*aResponseData (array) -  array/structure containing your response data&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: response_id (integer) -  Returns the id of the inserted survey response&lt;br /&gt;
*On failure: (array) with error description&lt;br /&gt;
&lt;br /&gt;
==export_responses==&lt;br /&gt;
RPC Routine to export responses. Returns the requested file as base64 encoded string. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null,&lt;br /&gt;
   $sCompletionStatus=&#039;all&#039;, $sHeadingType=&#039;code&#039;, $sResponseType=&#039;short&#039;, $iFromResponseID=null, $iToResponseID=null, $aFields=null)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $sSessionKey || string || Auth credentials&lt;br /&gt;
|-&lt;br /&gt;
| $iSurveyID || int || Id of the Survey&lt;br /&gt;
|-&lt;br /&gt;
| $sDocumentType || string || pdf,csv,xls,doc,json&lt;br /&gt;
|-&lt;br /&gt;
| $sLanguageCode || string || The language to be used&lt;br /&gt;
|-&lt;br /&gt;
| $sCompletionStatus || string || Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; - defaults to &#039;all&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sHeadingType || string || &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039; Optional defaults to &#039;code&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $sResponseType || string || &#039;short&#039; or &#039;long&#039; Optional defaults to &#039;short&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $iFromResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $iToResponseID || integer || Optional&lt;br /&gt;
|-&lt;br /&gt;
| $aFields|| array || Optional Selected fields&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Starting with version 2.0.5 the $iFromResponseID and $iToResponseID parameters refer to the minimum and maximum id&#039;s; prior to this version the parameters refer to the record&#039;s offset in the table&lt;br /&gt;
&lt;br /&gt;
==export_responses_by_token==&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token to pdf,csv,xls,doc&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (int) - Id of the Survey&lt;br /&gt;
&lt;br /&gt;
DocumentType (string) - pdf,csv,xls,doc,html&lt;br /&gt;
&lt;br /&gt;
sToken (string) - Token string of a candidate&lt;br /&gt;
&lt;br /&gt;
sLanguageCode (string) - Optional The language to be used - if not given then the base language will be used&lt;br /&gt;
&lt;br /&gt;
CompletionStatus (string) - Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; selection of responses - defaults to complete&lt;br /&gt;
&lt;br /&gt;
HeadingType (string) - &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039;. type of question heading. Optional defaults to &#039;code&#039;&lt;br /&gt;
&lt;br /&gt;
ResponseType (string) - &#039;short&#039; or &#039;long&#039; response type.Optional defaults to &#039;short&#039;&lt;br /&gt;
&lt;br /&gt;
aFields (array) - Optional Selected fields&lt;br /&gt;
&lt;br /&gt;
Return:&lt;br /&gt;
&lt;br /&gt;
On success: Requested file as base 64-encoded string.&lt;br /&gt;
&lt;br /&gt;
On failure: Array with error information&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=62155</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=62155"/>
		<updated>2014-07-24T16:54:30Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: linked a newer version of jsonrpcphp&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of LimeSurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
==get_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure:  for protocol-level errors (invalid format etc), an error message.  For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
==release_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
==get_site_settings==&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
==add_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==import_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
==get_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|properties not allowed to be modified|| Properties not allowed to be modified when survey active&lt;br /&gt;
|-&lt;br /&gt;
|sid||anonymized&lt;br /&gt;
|-&lt;br /&gt;
|language||datestamp&lt;br /&gt;
|-&lt;br /&gt;
|additional_languages||savetimings&lt;br /&gt;
|-&lt;br /&gt;
|active||ipaddr&lt;br /&gt;
|-&lt;br /&gt;
|||refurl&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_surveys==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==activate_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==export_statistics==&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==get_summary==&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return or &#039;all&#039; to get an array of all statistics&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||token_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==add_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==delete_survey_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
==get_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
==add_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
==import_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
==get_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_groups==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==list_users==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of users&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of users&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No users found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission (super admin is required)&lt;br /&gt;
&lt;br /&gt;
==delete_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
==import_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
==get_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_questions==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
Activate tokens&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
surveyid (string) The survey ID&lt;br /&gt;
&lt;br /&gt;
additional_attributes (array of integers) Any additional attribute fields to create. Just give the attribute IDs&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) status OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
&lt;br /&gt;
==add_participants==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sessionkey (string) - The session key&lt;br /&gt;
*surveyID (string) - The survey id&lt;br /&gt;
*participantData (array) -  2-dimensional array/structure containing your participants data&lt;br /&gt;
*createTokenKey (boolean) - Set this to true if you want a token key create automatically for each entry - if your participant data included a [token] field it will be overwritten&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success:  participant data (struct) -  structure containing your participants data plus the token ID and (if applicable) the new token&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
&lt;br /&gt;
JSON-RPC example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;method&amp;quot;:&amp;quot;add_participants&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;sessionkey&amp;quot;:&amp;quot;73e8rx864rnxmk64gp67bah44u2igivm&amp;quot;,&amp;quot;surveyID&amp;quot;:&amp;quot;668138&amp;quot;,&amp;quot;participantData&amp;quot;:[{&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;}]}}&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;result&amp;quot;:[{&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;}],&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==delete_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
==get_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|tid||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_participants==&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
If you provide the iLimit parameter it is required to provide the iStart parameter.&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
==invite_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==remind_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==add_response==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new responses to your survey response table.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sSessionKey (string) - The session key&lt;br /&gt;
*iSurveyID (integer) - The survey id&lt;br /&gt;
*aResponseData (array) -  array/structure containing your response data&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: response_id (integer) -  Returns the id of the inserted survey response&lt;br /&gt;
*On failure: (array) with error description&lt;br /&gt;
&lt;br /&gt;
==export_responses==&lt;br /&gt;
&lt;br /&gt;
Export response data to pdf,csv,xls,doc&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (int) - Id of the Survey&lt;br /&gt;
&lt;br /&gt;
DocumentType (string) - pdf,csv,xls,doc, html&lt;br /&gt;
&lt;br /&gt;
sLanguageCode (string) - Optional The language to be used - if not given then the base language will be used&lt;br /&gt;
&lt;br /&gt;
CompletionStatus (string) - Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; selection of responses - defaults to complete&lt;br /&gt;
&lt;br /&gt;
HeadingType (string) - &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039;. type of question heading. Optional defaults to &#039;code&#039;&lt;br /&gt;
&lt;br /&gt;
ResponseType (string) - &#039;short&#039; or &#039;long&#039; response type.Optional defaults to &#039;short&#039;&lt;br /&gt;
&lt;br /&gt;
FromResponse (int) - Optional start number of response&lt;br /&gt;
&lt;br /&gt;
ToResponse (int) - Optional end number of responses&lt;br /&gt;
&lt;br /&gt;
Return:&lt;br /&gt;
&lt;br /&gt;
On success: Requested file as base 64-encoded string.&lt;br /&gt;
&lt;br /&gt;
On failure: Array with error information&lt;br /&gt;
&lt;br /&gt;
Note: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
==export_responses_by_token==&lt;br /&gt;
&lt;br /&gt;
Export responses data of specific token to pdf,csv,xls,doc&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (int) - Id of the Survey&lt;br /&gt;
&lt;br /&gt;
DocumentType (string) - pdf,csv,xls,doc,html&lt;br /&gt;
&lt;br /&gt;
sToken (string) - Token string of a candidate&lt;br /&gt;
&lt;br /&gt;
sLanguageCode (string) - Optional The language to be used - if not given then the base language will be used&lt;br /&gt;
&lt;br /&gt;
CompletionStatus (string) - Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; selection of responses - defaults to complete&lt;br /&gt;
&lt;br /&gt;
HeadingType (string) - &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039;. type of question heading. Optional defaults to &#039;code&#039;&lt;br /&gt;
&lt;br /&gt;
ResponseType (string) - &#039;short&#039; or &#039;long&#039; response type.Optional defaults to &#039;short&#039;&lt;br /&gt;
&lt;br /&gt;
aFields (array) - Optional Selected fields&lt;br /&gt;
&lt;br /&gt;
Return:&lt;br /&gt;
&lt;br /&gt;
On success: Requested file as base 64-encoded string.&lt;br /&gt;
&lt;br /&gt;
On failure: Array with error information&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
There are some cool things that you can use with the RemoteControl2 API and this is an example of a production use of this. Basically, I, (kobaltz in the forums) have a third party site that I built that controls the users and level of access of each company and their users. From within this site, I have a daemon that will generate participants of the appropriate survey twice an hour. This will use LimeSurvey&#039;s Mail Function to send the end user a link to the survey. Administrators of the third party site will get statistical data of the end user filling out the survey as well as a link to review the surveys completed using the same template that the user used to fill it out. Reducing duplicate entry of data made possible with the RemoteControl2 API.&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my LimeSurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module LimeSurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module LimeSurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the LimeSurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = LimeSurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.release_session_key(session_key)&lt;br /&gt;
puts &amp;quot;Release Session: #{response}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Grabs a Survey&#039;s list of participants and parses through them&lt;br /&gt;
# The response is in an array format.&lt;br /&gt;
# Each response within the array is in JSON format (How the survey is configured with RemoteControl2)&lt;br /&gt;
# Convert the participant response to JSON and then display the token.&lt;br /&gt;
response = survey.list_participants(session_key, &amp;quot;593987&amp;quot;)&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
response_participants = []&lt;br /&gt;
response.each do |part|&lt;br /&gt;
	resps = JSON.parse(part.to_json)&lt;br /&gt;
	puts &amp;quot;Participant: #{resps[&#039;token&#039;]}&amp;quot;&lt;br /&gt;
	puts &amp;quot;\n&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Participant: p7m5zmh38wi9mbk&lt;br /&gt;
Participant: nssu6ne6ii9wva9&lt;br /&gt;
Participant: r9kr2sahn7tfsv9&lt;br /&gt;
Participant: a28ci2z9m7ynfgg&lt;br /&gt;
Participant: 4ytt5axg9ebdazh&lt;br /&gt;
Participant: wswjv2t5v7vh4p7&lt;br /&gt;
Participant: fqvxeckgh6vgy3e&lt;br /&gt;
Participant: n5p2vfnh7dwx699&lt;br /&gt;
Participant: ycsmigup9pagm6z&lt;br /&gt;
Participant: 33ztf4g74k2kvx4&lt;br /&gt;
&lt;br /&gt;
Release Session: OK&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application using the light-weight jsonRPCClient from the [https://github.com/weberhofer/jsonrpcphp jsonrpcphp Github repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JAVA example=&lt;br /&gt;
To decode and code your json calls you can use the library gson as you can see in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.UnsupportedEncodingException;&lt;br /&gt;
&lt;br /&gt;
import org.apache.http.HttpEntity;&lt;br /&gt;
import org.apache.http.HttpResponse;&lt;br /&gt;
import org.apache.http.client.methods.HttpPost;&lt;br /&gt;
import org.apache.http.entity.StringEntity;&lt;br /&gt;
import org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;
import org.apache.http.util.EntityUtils;&lt;br /&gt;
&lt;br /&gt;
import com.google.gson.JsonElement;&lt;br /&gt;
import com.google.gson.JsonObject;&lt;br /&gt;
import com.google.gson.JsonParser;&lt;br /&gt;
&lt;br /&gt;
public class TestHttpClient {&lt;br /&gt;
	&lt;br /&gt;
    public static String parse(String jsonLine) {&lt;br /&gt;
	 JsonElement jelement = new JsonParser().parse(jsonLine);&lt;br /&gt;
	 JsonObject  jobject = jelement.getAsJsonObject();&lt;br /&gt;
	 String result = jobject.get(&amp;quot;result&amp;quot;).toString();&lt;br /&gt;
	 return result;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
    public static void main(String[] args) throws UnsupportedEncodingException {&lt;br /&gt;
      DefaultHttpClient client = new DefaultHttpClient();          &lt;br /&gt;
         &lt;br /&gt;
      HttpPost post = new HttpPost(&amp;quot;http://PATH_OF_YOUR_SERVER/index.php/admin/remotecontrol&amp;quot;);&lt;br /&gt;
      post.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/json&amp;quot;);&lt;br /&gt;
      post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;get_session_key\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;username\&amp;quot;: \&amp;quot;YOUR_USERNAME\&amp;quot;, \&amp;quot;password\&amp;quot;: \&amp;quot;YOUR_PASSWORD\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
      try {&lt;br /&gt;
        HttpResponse response = client.execute(post);&lt;br /&gt;
        if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
            HttpEntity entity = response.getEntity();&lt;br /&gt;
            String sessionKey = parse(EntityUtils.toString(entity));&lt;br /&gt;
            post.setEntity( new StringEntity(&amp;quot;{\&amp;quot;method\&amp;quot;: \&amp;quot;list_groups\&amp;quot;, \&amp;quot;params\&amp;quot;: {\&amp;quot;sSessionKey \&amp;quot;: &amp;quot;+sessionKey+&amp;quot;, \&amp;quot;iSurveyID \&amp;quot;: \&amp;quot;ID_SURVEY\&amp;quot; }, \&amp;quot;id\&amp;quot;: 1}&amp;quot;));&lt;br /&gt;
            response = client.execute(post);&lt;br /&gt;
            if(response.getStatusLine().getStatusCode() == 200){&lt;br /&gt;
                entity = response.getEntity();&lt;br /&gt;
                System.out.println(EntityUtils.toString(entity));&lt;br /&gt;
                }&lt;br /&gt;
           }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
    }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Python  example=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib2&lt;br /&gt;
import json&lt;br /&gt;
import sys&lt;br /&gt;
# There is an generic json-rpc implemantation in Python but it dose not work for me in this case so I worte Some functions &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
def get_session_key():&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;username\&amp;quot;:\&amp;quot;admin\&amp;quot;,\&amp;quot;password\&amp;quot;:\&amp;quot;mypassword\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
		&lt;br /&gt;
def get_question_properties(skey,QuestionID):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;get_question_properties\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iQuestionID\&amp;quot;:&#039;+QuestionID+&#039;,\&lt;br /&gt;
\&amp;quot;aQuestionSettings\&amp;quot;:[\&amp;quot;gid\&amp;quot;,\&amp;quot;type\&amp;quot;,\&amp;quot;help\&amp;quot;,\&amp;quot;language\&amp;quot;,\&amp;quot;sid\&amp;quot;,\&amp;quot;question_order\&amp;quot;,\&amp;quot;question\&amp;quot;,\&amp;quot;subquestions\&amp;quot;]},\&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
def release_session_key(relkey):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;release_session_key\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+relkey+&#039;\&amp;quot;},\&amp;quot;id\&amp;quot;:1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def export_responses2(skey,sid):&lt;br /&gt;
    req = urllib2.Request(url=&#039;http://myurl/index.php/admin/remotecontrol&#039;,\&lt;br /&gt;
                          data=&#039;{\&amp;quot;method\&amp;quot;:\&amp;quot;export_responses\&amp;quot;,\&amp;quot;params\&amp;quot;:{\&amp;quot;sSessionKey\&amp;quot;:\&amp;quot;&#039;+skey+&#039;\&amp;quot;,\&amp;quot;iSurveyID\&amp;quot;:\&amp;quot;&#039;+sid+&#039;\&amp;quot;,\&lt;br /&gt;
\&amp;quot;DocumentType\&amp;quot;:\&amp;quot;csv\&amp;quot;,\&amp;quot;sLanguageCode\&amp;quot;:\&amp;quot;de\&amp;quot;,\&amp;quot;sHeadingType\&amp;quot;:\&amp;quot;full\&amp;quot;},\&lt;br /&gt;
&amp;quot;id\&amp;quot;: 1}&#039;)&lt;br /&gt;
    req.add_header(&#039;content-type&#039;, &#039;application/json&#039;)&lt;br /&gt;
    req.add_header(&#039;connection&#039;, &#039;Keep-Alive&#039;)&lt;br /&gt;
    try:&lt;br /&gt;
        f = urllib2.urlopen(req)&lt;br /&gt;
        myretun = f.read()&lt;br /&gt;
        #print myretun&lt;br /&gt;
        j=json.loads(myretun)&lt;br /&gt;
        return j[&#039;result&#039;]&lt;br /&gt;
    except :&lt;br /&gt;
        e = sys.exc_info()[0]&lt;br /&gt;
        print ( &amp;quot;&amp;lt;p&amp;gt;Error: %s&amp;lt;/p&amp;gt;&amp;quot; % e )		&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
mykey=get_session_key()&lt;br /&gt;
print export_responses2(mykey,&#039;566237&#039;).decode(&#039;base64&#039;)&lt;br /&gt;
get_question_properties(mykey,&#039;574&#039;)&lt;br /&gt;
print release_session_key(mykey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Expression_Manager&amp;diff=41381</id>
		<title>Expression Manager</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Expression_Manager&amp;diff=41381"/>
		<updated>2013-06-13T12:30:45Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: added category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;languages /&amp;gt; &amp;lt;translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:1--&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:2--&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt; Note: This feature is only available in LimeSurvey 1.92 or later. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Quick Start Tutorial= &amp;lt;!--T:3--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overview== &amp;lt;!--T:4--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:5--&amp;gt;&lt;br /&gt;
When customizing your surveys, you typically need a way to specify the following:&lt;br /&gt;
#&#039;&#039;&#039;Navigation/Branching&#039;&#039;&#039; - letting a subject&#039;s answers change the order in which questions are asked&lt;br /&gt;
#&#039;&#039;&#039;Tailoring/Piping&#039;&#039;&#039; - how to phrase the question (such as referring to prior answers, or conjugating sentences based upon the number or gender of your subjects), or how to generate custom reports (like assessment scores or tailored advice).&lt;br /&gt;
#&#039;&#039;&#039;Validation&#039;&#039;&#039; - ensuring that answers pass certain criteria, like min and max values, or matching an input pattern&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:6--&amp;gt;&lt;br /&gt;
Expression Manager (EM) provides an intuitive way to specifying the logic for each of those features.  Nearly anything that you can write as a standard mathematical equation is a valid expression, even if you are calling functions.  EM currently provides access to 70 functions, and can be easily extended to support more.  It also lets you access your variables using human-readable variable names (rather than SGQA names).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:7--&amp;gt;&lt;br /&gt;
The following sections show the main places where Expression Manager is used&lt;br /&gt;
&lt;br /&gt;
==Relevance (Controlling Navigation/Branching)== &amp;lt;!--T:8--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:9--&amp;gt;&lt;br /&gt;
Some surveys use &amp;quot;Goto Logic&amp;quot;, such that if you answer Question 1 with option C, then jump to Question 5. This approach is very limiting, since is hard to validate, and easily breaks if you have to re-order questions.  EM uses an Boolean relevance equation to specify all of the conditions under which a question might be valid.  If the question is relevant, then the question is asked, otherwise it is Not Applicable, and the value NULL is stored in the database.  This is similar to what can be done via the Conditions editor, but EM lets you easily specify much more complex and powerful criteria (and lets you use the variable name rather than SGQA naming).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:10--&amp;gt;&lt;br /&gt;
This image shows one way to review the relevance logic for a survey.  It computes Body Mass Index.  The relevance equation is shown in square bracket right after the variable name (which is in green).  So, the relevance of weight, weight_units, weight_kg are all 1, meaning that those questions are always asked.  However, the relevance for BMI is {!is_empty(height) and !is_empty(weight)}, which means that BMI will only be computed if the subject enters a value for both height and weight (thereby avoiding the risk of a divide by zero error).  Also, the Report question is only shown if the subject answers all four main questions (height, height_units, weight, weight_units).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:11--&amp;gt;&lt;br /&gt;
[[File:tutorial1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:12--&amp;gt;&lt;br /&gt;
Relevance is shown and editable in the following places:&lt;br /&gt;
&lt;br /&gt;
===Viewing / Editing Question-Level Relevance=== &amp;lt;!--T:13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:14--&amp;gt;&lt;br /&gt;
This equation computes the Body Mass Index (BMI).  It is only asked if the person first enters their height and weight.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:15--&amp;gt;&lt;br /&gt;
[[File:tutorial2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:16--&amp;gt;&lt;br /&gt;
This is the edit screen for the BMI question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:17--&amp;gt;&lt;br /&gt;
[[File:tutorial3.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:18--&amp;gt;&lt;br /&gt;
Note that you do not use the curly braces when you enter a Relevance Equation.&lt;br /&gt;
&lt;br /&gt;
===Viewing / Editing Group-Level Relevance=== &amp;lt;!--T:19--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:20--&amp;gt;&lt;br /&gt;
This is a sample census survey.  The first page asks how many people live with you and stores that in the &amp;quot;cohabs&amp;quot; variable.  This page is only shown if you have more than one cohabitant (so it is shown for the second person cohabitating with you), and also only shows if you specified how Person One is related to you (p1_rel).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:21--&amp;gt;&lt;br /&gt;
[[File:tutorial4.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:22--&amp;gt;&lt;br /&gt;
As you can see, the group also has question-level relevance criteria, such that each question only appears once you have answered the question before it (e.g. {!is_empty(p1_sex)}.  EM combines the Group and Question-level relevance for you.  Questions in a group are only asked  if the group as a whole is relevant.  Then, only the subset of questions within the group that are relevant are asked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:23--&amp;gt;&lt;br /&gt;
Here is the screen for editing the group-level relevance for that question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:24--&amp;gt;&lt;br /&gt;
[[File:tutorial5.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:25--&amp;gt;&lt;br /&gt;
Note that you do not use the curly braces when you enter a Relevance Equation.&lt;br /&gt;
&lt;br /&gt;
==Tailoring/Piping== &amp;lt;!--T:26--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:27--&amp;gt;&lt;br /&gt;
EM lets you easily do simple and complex conditional tailoring of your questions.  Sometimes you just need simple substitution, like saying, &amp;quot;You said you purchased &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;Product].  What did you like best about it?&amp;quot;.  Sometimes you need conditional substitution like &amp;quot;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;Mr./Mrs.] &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;LastName], would you be willing to complete our survey?&amp;quot;.  In this case,  you want to use Mr. or Mrs. based upon the person&#039;s gender.  Other times you need even more complex substitution (such as based upon a mathematical computation.  EM supports each of these types of tailoring/piping.&lt;br /&gt;
&lt;br /&gt;
===Conditional Equations=== &amp;lt;!--T:28--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:29--&amp;gt;&lt;br /&gt;
The Body Mass Index example shows the ability to compute a person&#039;s BMI, even while letting them enter their height in weight in metric or non-metric units.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:30--&amp;gt;&lt;br /&gt;
[[File:tailoring7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:31--&amp;gt;&lt;br /&gt;
Here weight_kg is {if(weight_units == &#039;kg&#039;, weight, weight * .453592)}.  This if() function means that if the subject entered the weight using kilograms, use that value, otherwise multiple the entered value (which was in pounds) by .453592 to convert it to kilograms.  The height_m variable uses a similar approach to compute the person&#039;s height in meters, even if he entered his height in inches.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:32--&amp;gt;&lt;br /&gt;
BMI computes the weight formula as {weight_kg / (height_m * height_m)}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:33--&amp;gt;&lt;br /&gt;
Lastly, the report conditionally tailors the message for the subject, telling him what he entered (e.g. &amp;quot;You said you are 2 meters tall and weight 70 kg.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:34--&amp;gt;&lt;br /&gt;
Although not well shown in the above image, weight_status uses nested if() statements to categorize the person as underweight to severely obese.  You can see its equation in the Show Logic View&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:35--&amp;gt;&lt;br /&gt;
[[File:tailoring8.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:36--&amp;gt;&lt;br /&gt;
From the edit window for this question, you can see two things:&lt;br /&gt;
#Tailoring must surround expressions with Curly Braces&lt;br /&gt;
#Expressions can span multiple lines if, as in this case, you want to make it easier to read the nested conditional logic.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:37--&amp;gt;&lt;br /&gt;
[[File:tailoring9.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Tailored Questions, Answers, and Reports=== &amp;lt;!--T:38--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:39--&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note: Dynamic tailoring may not work if answer options are made available in select boxes on the same question page. This results from the fact that tailoring inserts a &amp;lt;nowiki&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/nowiki&amp;gt; tag which is not valid inside select options.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:40--&amp;gt;&lt;br /&gt;
This example shows the BMI report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:41--&amp;gt;&lt;br /&gt;
[[File:tailoring10.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:42--&amp;gt;&lt;br /&gt;
Here is the edit window for the same question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:43--&amp;gt;&lt;br /&gt;
[[File:tailoring11.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:44--&amp;gt;&lt;br /&gt;
As you can see, anything in curly braces is treated as an expression, so is syntax-highlighted (color coded) in the prior image.  If you had any typos (such as misspelled or undefined variable names or functions), EM would show an error, such as this, showing that height_unit is an undefined variable name (it is actually height_units), and rnd() is an undefined function (the proper function name is round()).  In both cases, the errors are surrounded by a red box to make it easier to spot and fix them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:45--&amp;gt;&lt;br /&gt;
[[File:tailoring12.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:46--&amp;gt;&lt;br /&gt;
You can also see that you can quickly create complex reports, such as a table of entered values or tailored advice.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:47--&amp;gt;&lt;br /&gt;
Please remember that all tailoring must surround expressions with Curly Braces, so that LimeSurvey knows which parts of the question are free text and which should be parsed through Expression Manager.&lt;br /&gt;
&lt;br /&gt;
==Validation== &amp;lt;!--T:48--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:49--&amp;gt;&lt;br /&gt;
EM controls how most of the advanced question options work.  These control aspects like min/max numbers of answers; min/max individual values; min/max sum values; and checking that entered values match specified string patterns.  You continue to enter those advanced question options as usual.  However, now any value in one of those fields is considered an expression, so you can have min/max criteria with complex conditional relationships to other questions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:50--&amp;gt;&lt;br /&gt;
In all of these cases, since the advanced question option is always considered an expression, you do not use curly braces when specifying it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:51--&amp;gt;&lt;br /&gt;
The [[Expression Manager Sample Surveys|Sample Surveys]] pages shows many working examples of using expressions for validations.&lt;br /&gt;
&lt;br /&gt;
=Introduction= &amp;lt;!--T:52--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:53--&amp;gt;&lt;br /&gt;
LimeSurvey 1.92 and later uses the new Expression Manager (EM) module which will let LimeSurvey support more complex branching, assessments, validation, and tailoring.  It will replace how LimeSurvey manages Replacements, Conditions, and Assessments on the back-end.  It will also speed up processing considerably since it eliminates most run-time database reads.  EM was developed by Dr. Thomas White (TMSWhite).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:54--&amp;gt;&lt;br /&gt;
This wiki page is the definitive reference for Expression Manager syntax and functionality.&lt;br /&gt;
&lt;br /&gt;
==Key Definitions== &amp;lt;!--T:55--&amp;gt;&lt;br /&gt;
#&#039;&#039;&#039;Expression&#039;&#039;&#039;:  Anything surrounded by curly braces&lt;br /&gt;
#*As long as there is no white space immediately after the opening brace or before the closing curly brace&lt;br /&gt;
#*The contents of Expressions are evaluted by EM, so they can contain mathematical formulas, functions, and complex string and date processing.&lt;br /&gt;
#&#039;&#039;&#039;Tailoring&#039;&#039;&#039;: Sometimes called &amp;quot;piping&amp;quot;, this is the process of conditionally modifying text&lt;br /&gt;
#*You have access to all &#039;replacement fields&#039;, TOKENs, and INSERTANS values&lt;br /&gt;
#*You also have easier access to questions, answers, and their properties.&lt;br /&gt;
#&#039;&#039;&#039;Relevance&#039;&#039;&#039; Equation:  A new question attribute controlling question visiblity&lt;br /&gt;
#*If there is a relevance equation, then the question is only shown if the relevance evaluates to true.&lt;br /&gt;
#*Internally, all array_filter and array_filter_exclude commands become sub-question-level relevance&lt;br /&gt;
#&#039;&#039;&#039;Equation&#039;&#039;&#039; Question Type:  A new question type that saves calculations or reports to the database&lt;br /&gt;
#*It is like a Boilerplate question, but its contents are saved to the database even if you set &amp;quot;Always Hide this Question&amp;quot;&lt;br /&gt;
#&#039;&#039;&#039;SGQA&#039;&#039;&#039;:  This is how variables are named in LimeSurvey &amp;lt;= 1.91+&lt;br /&gt;
#*Stands for Survey-Group-Question-Answer&lt;br /&gt;
#*SGQA variable names look like 123X5X382X971, and may have sub-question suffixes.&lt;br /&gt;
#*These variable names are specific to the underlying S/Q/G/A database codes, so often need to be changed&lt;br /&gt;
#&#039;&#039;&#039;Question Code&#039;&#039;&#039;:  This is the preferred variable name for EM&lt;br /&gt;
#*This can be a descriptive name indicating the purpose of the question, making it easier to read complex logic&lt;br /&gt;
#*Although not required to be unique in &amp;lt;= 1.91+, it must be unique if you want to use EM&lt;br /&gt;
#*Valid question codes should NOT start with a number, so when using the question code to number your questions, simply use &amp;quot;q1&amp;quot;, or &amp;quot;q1a&amp;quot; or &amp;quot;g1q2&amp;quot;.&lt;br /&gt;
#*This is what currently becomes the variable name if you export data to SPSS or R, so if you do statistical analysis, you probably already made this unique.&lt;br /&gt;
&lt;br /&gt;
==Do I have to use EM?== &amp;lt;!--T:56--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:57--&amp;gt;&lt;br /&gt;
The short answer is No (but also yes).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:58--&amp;gt;&lt;br /&gt;
EM is fully backwards-compatible with existing surveys.  So, if you are happy to use Conditions and Assessments in the style that LimeSurvey used in versions &amp;lt;= 1.91+, you can continue to do so.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:59--&amp;gt;&lt;br /&gt;
However, EM completely replaces how LimeSurvey internally deals with Conditions.  Although you can still use the Conditions Editor to create and manage conditions, LimeSurvey 1.92 will convert those to the equivalent Relevance Equations.  As part of the upgrade, LimeSurvey 1.92 will auto-convert all existing Conditions to Relevance Equations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:60--&amp;gt;&lt;br /&gt;
This should give you the best of both worlds - you can continue using LimeSurvey as you are used to, but will see the Relevance Equation equivalent so you can gradually migrate to Relevance Equations directly whenever you see fit.&lt;br /&gt;
&lt;br /&gt;
==Can I mix use of Conditions and Relevance?== &amp;lt;!--T:61--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:62--&amp;gt;&lt;br /&gt;
Yes. You can use the Conditions editor for some questions and the Relevance editor for others.  Conditions are auto-converted to Relevance when you save the question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:63--&amp;gt;&lt;br /&gt;
Note, we assume that if you are using the Conditions editor, that you want those Conditions to over-write any manually entered Relevance equation.  So, if you have existing Conditions and want to manually edit the Relevance, please delete the Conditions for that question first.  Specifically, copy the generated relevance equation to a text editor, use the Conditions menu to delete all of the conditions for that question (which will also delete the relevance), then edit the question and paste the generated relevance equation from the text editor back into the relevance field for that question (and save the question).  If there is enough demand for deleting conditions without deleting the generated relevance equation, we could add a bulk conversion process.&lt;br /&gt;
&lt;br /&gt;
==How should I choose between Conditions and Relevance?== &amp;lt;!--T:64--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:65--&amp;gt;&lt;br /&gt;
Here is a list of pros and cons of each style:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:66--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Style!!Pros!!Cons&lt;br /&gt;
|-&lt;br /&gt;
|Conditions||1. Nice GUI for creating simple conditions &amp;lt;br/&amp;gt;2. GUI well documented and understood by support team||1. Only supports simple comparisons and does not AND/OR conditions well &amp;lt;br/&amp;gt;2. Cascading conditions work erratically &amp;lt;br/&amp;gt;3. Slow - database intensive, so can slow down long surveys &amp;lt;br/&amp;gt;4. Some reported problems with re-loading conditions &amp;lt;br/&amp;gt;5. GUI doesn&#039;t scale well when there are dozens, hundreds, or thousands of questions &amp;lt;br/&amp;gt;6. May be slow to convert paper-based surveys since must use SGQA names &amp;lt;br/&amp;gt;7. Often need a programmer to custom-code logic needed for complex branching&lt;br /&gt;
|-&lt;br /&gt;
|Relevance||1. Supports very complex logic, including 80+ functions and math/string operators &amp;lt;br/&amp;gt;2. Perfect support for cascading logic &amp;lt;br/&amp;gt;3. Fast - no extra database calls, so supports 1000+ question surveys &amp;lt;br/&amp;gt;4. No problems with re-loading logic since does not require SGQA codes &amp;lt;br/&amp;gt;5. Syntax-highlighting scales to 1000+ question surveys &amp;lt;br/&amp;gt;6. Easy and fast to use for groups wanting to computerize existing paper-based suveys.  &amp;lt;br/&amp;gt;7. Easily supports semi-structured interviews and epidemiological surveys without needing a programmers||1. No GUI for simple conditions - use syntax-highlighting instead &amp;lt;br/&amp;gt;2. New, so support teams have not mastered EM yet.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:67--&amp;gt;&lt;br /&gt;
The bottom is that if you are happy with how LimeSurvey 1.91+ works, there is no reason to change what you do.&lt;br /&gt;
&lt;br /&gt;
==What are some other benefits of using EM?== &amp;lt;!--T:68--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:69--&amp;gt;&lt;br /&gt;
Here are some of the other reasons you might want to use EM.&lt;br /&gt;
#Calculations - you can create any calculation you can think of:&lt;br /&gt;
#*You have access to all common mathematical operators and functions&lt;br /&gt;
#*You have access to 70+ mathematical, date, and string processing functions&lt;br /&gt;
#*It is fairly easy for developers to add new functions if users need them&lt;br /&gt;
#Storing Calculations to Database&lt;br /&gt;
#*You can now compute simple and complex calculations and/or scale scores AND have them stored in the database without needing JavaScript.&lt;br /&gt;
#*You use the Equation question type to accomplish this.&lt;br /&gt;
#Assessments&lt;br /&gt;
#*You can now create assessments or scale scores from any question type, not just the subset that used to be supported&lt;br /&gt;
#*You can use Tailoring to show running or total assessment scores anywhere needed - even on the same page&lt;br /&gt;
#*You have more control over the reports generated based upon those assessment scores&lt;br /&gt;
#*You can store assessment scores in the database without needing JavaScript&lt;br /&gt;
#*You can hide assessment scores without needing JavaScript or CSS&lt;br /&gt;
#Replacement Fields&lt;br /&gt;
#*Instead of using {INSERTANS:SGQA}, you can just use the Question Code - this makes it easier to read and validate.&lt;br /&gt;
#*This also avoids the common need to edit questions to change the SGQA code to make everything work.&lt;br /&gt;
#Tailoring - you can conditionally display text based upon other values&lt;br /&gt;
#*Use the appropriate title for a subject, like (e.g. &amp;quot;Hello &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;Mr./Mrs.] Smith&amp;quot;)&lt;br /&gt;
#*Output gramatically correct sentences based when singular/plural matter:  (e.g. &amp;quot;You have 1 child&amp;quot; vs. &amp;quot;You have 2 chldren&amp;quot;)&lt;br /&gt;
#*Appropriately conjugate verbs and decline nouns based upon subject&#039;s gender and plurality.&lt;br /&gt;
#New Variable Attributes - you can access the following to do your tailoring:&lt;br /&gt;
#* (no suffix) -  an alias for qcode.code&lt;br /&gt;
#*.code - the selected response code for the question if it is relevant (otherwise blank), or the text value if it is not a coded question&lt;br /&gt;
#*.NAOK - same as .code, but can be part of calculations or lists even if irrelevant&lt;br /&gt;
#*.value - the assessment value for the question if it is relevant (otherwise blank), or the text value if it is not a coded question&lt;br /&gt;
#*.valueNAOK - same as .value, but can be part of calculations or lists even if irrelevant&lt;br /&gt;
#*.shown - the answer as displayed to the user (this is what {INSERTANS:xxx}  does)&lt;br /&gt;
#*.qid - the question ID&lt;br /&gt;
#*.gid - the group ID&lt;br /&gt;
#*.sgqa - the SGQA value for the question&lt;br /&gt;
#*.jsName - the correct javascript variable name for the question, regardless whether defined on this page or another&lt;br /&gt;
#*.qseq - the question sequence (starting from 0)&lt;br /&gt;
#*.gseq - the group sequence (starting from 0)&lt;br /&gt;
#*.mandatory - whether the question is mandatory (Y/N)&lt;br /&gt;
#*.question - the text of the question&lt;br /&gt;
#*.relevance - the relevance equation for the question&lt;br /&gt;
#*.grelevance - the relevance equation for the group&lt;br /&gt;
#*.relevanceStatus - whether or not the question is currently relevant (1 if true, 0 if false)&lt;br /&gt;
#*.type - the question type (the one character code)&lt;br /&gt;
#Dynamic On-Page Changes&lt;br /&gt;
#*All Relevance, Calculation, and Tailoring works dynamically on a page - so changes in values instantly update the page&lt;br /&gt;
#*So, you have questions dynamically appear/disappear based upon whether they are relevant&lt;br /&gt;
#*Questions are also dynamically tailored based upon responses on the page, so you can see running totals, tailored sentences and customized reports.&lt;br /&gt;
#New Data Entry Screen&lt;br /&gt;
#*In addition to using the current data-entry system, you can just use Survey-All-In-One.&lt;br /&gt;
#*This supports the on-page relevance and tailoring, so data entry clerks can quickly tab through and they will only have to enter the relevant responses&lt;br /&gt;
#*This can be critical if your data entry person needs to see the tailoring, which is also dynamic.&lt;br /&gt;
#Eliminates the need for most custom JavaScript&lt;br /&gt;
#*EM easily supports complicated computations, scoring, tailoring and conditional logic.&lt;br /&gt;
#*Some things will still need JavaScript (like custom layouts and conditionally hiding question sub-elements), but your JavaScript can use the EM functions so that you can access questions by their Qcode instead of SGQA, and access any of the question properties listed above.&lt;br /&gt;
&lt;br /&gt;
==What are some other helpful new features enabled by EM?== &amp;lt;!--T:70--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:71--&amp;gt;&lt;br /&gt;
Regardless of whether you continue to use the Conditions Editor or manually compose Relevance Equations, you get these additional benefits:&lt;br /&gt;
#You can create more complex validation criteria&lt;br /&gt;
#*All of the advanced question attribute (like max_answers, min_num_value_n, max_num_value) can use Expressions.  So, you min/max criteria can be easily adjusted based upon prior responses, even if they are on the same page.&lt;br /&gt;
#*EM also handles all regular-expression-based validation, so you can robustly combine preg and equation-based question attributes.&lt;br /&gt;
#Easy Re-ordering (or deleting) of Questions and Groups&lt;br /&gt;
#*Prior to version 1.92, you could not re-order questions or groups if LimeSurvey thought that such-re-ordering could break conditions in which they were used.  Similarly, you could not delete questions if any other questions depended upon them.&lt;br /&gt;
#*With EM&#039;s syntax highlighting, it is easy to see and validate whether you try to use questions before they are declared.  So, we now let you re-order or delete questions and groups whenever you like.  EM will update all of the syntax highlighting to show you potential errors.&lt;br /&gt;
#*The re-order questions view has been enhanced to help with such review.  It now shows the question&#039;s relevance equation and tailoring, so you can immediately see whether any variables become pink (meaning they are used before being declared).&lt;br /&gt;
#The Question/Group Navigation Index is always available and accurate&lt;br /&gt;
#*Prior to version 1.92, these indexes were not available if there were complex conditions&lt;br /&gt;
#*With EM, we can guarantee that they are accurate.&lt;br /&gt;
#*Subjects can even jump back, to a prior question, change the answer, then jump forward (or submit)&lt;br /&gt;
#**When jumping forwards, EM will re-validate all of the intervening questions/groups.&lt;br /&gt;
#**If any questions become irrelevant, they will be NULLed in the database so that your data is internally consistent&lt;br /&gt;
#**If any questions become relevant or newly fail mandatory or validation rules, EM will stop on that page and force the user to answer those questions before jumping to their final destination.&lt;br /&gt;
#Auto-conversion of Conditions to Relevance&lt;br /&gt;
#*When you upgrade your database, all existing surveys that have conditions will have relevance equations generated for them&lt;br /&gt;
#*Whenever you import a survey, relevance equations will be created as needed&lt;br /&gt;
#*Whenever you add, delete, or modify conditions, EM will generate the appropriate relevance equation.&lt;br /&gt;
#Convenient Syntax Highlighting&lt;br /&gt;
#*When EM shows the relevance equation, it will show the Qcode, even if you entered an SGQA code, as we assume this will be easier to read.&lt;br /&gt;
#*All variables are color coded to show whether they were declared before or after the current question (or before or after the current group).  This lets you quickly detect and fix cases where you try to use variables for relevance (including array_filter), tailoring, or validation equations prior to declaring them.&lt;br /&gt;
#*In addition, if you hover your mouse over the color-coded variable, you will see the most important metadata about that question.   This includes the Group Sequence #, Question Sequence #, Qcode, Text of the question, and all available answer choices (if it is a question type with enumerated answer choices).&lt;br /&gt;
#**The list of answer choices uses this syntax:  &#039;answers&#039;:{key:val, ... }.&lt;br /&gt;
#**&#039;&#039;key&#039;&#039; has the syntax &#039;&#039;&#039;&#039;scale~code&#039;&#039;&#039;&#039; where &#039;&#039;scale&#039;&#039; is the answer scale (e.g. for dual scale), and &#039;&#039;code&#039;&#039; is the answer code.&lt;br /&gt;
#**&#039;&#039;val&#039;&#039; has the syntax &#039;&#039;&#039;&#039;value~shown&#039;&#039;&#039;&#039; where &#039;&#039;value&#039;&#039; is the assessment value (if using assessments, otherwise &#039;&#039;code&#039;&#039;)(e.g. Qcode.value), and &#039;&#039;shown&#039;&#039; is the display value as seen by the subject (e.g. Qcode.shown)&lt;br /&gt;
#**This means that many surveys can use calculations without needing assessment mode.  If you have enumerated answer options  that are unique, non-decimal, and non-negative, you can simply do calculations on the Qcode.code values).&lt;br /&gt;
#Easy review of entire survey logic and content&lt;br /&gt;
#*There is a new Show Survey Logic feature that lets you see everything about the survey (or group or question) on a single page.&lt;br /&gt;
#*It shows the Group, Question, Sub-Question, and Answer-level details for the selected scope (survey vs. group vs. question)&lt;br /&gt;
#*It also shows the relevance, sub-question-level relevance (for array_filter and array_filter_exclude), and generated validation equation (for preg and any validation rules like min/max sum/number of values), and all non-blank question attributes.&lt;br /&gt;
#*Eveything is syntax-highlighted so that you can see potential syntax errors (like unbalanced parentheses or use of variables before they were declared)&lt;br /&gt;
#*The syntax-highligting supports rapid navigation and editing of the survey.&lt;br /&gt;
#**If you click on a variable name, it opens a browser window (or tab) that shows you that question and lets you edit it.&lt;br /&gt;
#**If you click on a group name, it opens a browser window (or tab) showing the group-reorder view so that you can easily move questions around.&lt;br /&gt;
#**All of the question attributes are also syntax highlighted.  This lets you set and see expressions within advanced question options (like basing the max/min number/sum of values on an expression)&lt;br /&gt;
#*The EM author used similar view (a little cleaner) to let his collaborating Epidemiologists and Institutional Review Board validate and authorize surveys with thousands of questions in highly branched and tailored structured interviews&lt;br /&gt;
&lt;br /&gt;
==How Backwards Compatible is EM with 1.91+?== &amp;lt;!--T:72--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:73--&amp;gt;&lt;br /&gt;
LimeSurvey 1.92 is fully backwards-compatible with 1.91+ with one exception/caveat:  1.92 handles less-than / greater-than comparisons against empty values differently than 1.91+.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:74--&amp;gt;&lt;br /&gt;
One of the LimeSurvey demo surveys uses a set of conditions that translates to this relevance equation:  {(age &amp;lt; 16) or (age == 20) or ... or (age == 80)}. In LimeSurvey 1.91+, (age &amp;lt; 16) is FALSE when there is no answer (the value is blank).  However, in LimeSurey 1.92, (age &amp;lt; 16) is TRUE when there is no answer, since both PHP and JavaScript treat blank as 0 in mathematical comparisons.  Thus, 1.91+ would hide that question when age was unanswered, but 1.92 would show it.  We went to great pains to prevent this, but since we needed to have the Expressions generate identical results in PHP and JavaScript, there was no way to make 1.92 treat &amp;quot;&amp;quot; &amp;lt; 16 as FALSE.  Fortunately, there is an easy work-around for this.  If you want (age &amp;lt; 16) to be FALSE, then use this expression instead: {(!is_empty(age) and age &amp;lt; 16)}.  You can use the new [[Show Logic File|Survey Logic File]] view to quickly identify and fix any such comparisons in your survey.&lt;br /&gt;
&lt;br /&gt;
=Getting Started= &amp;lt;!--T:75--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:76--&amp;gt;&lt;br /&gt;
The best way to get started with EM is to:&lt;br /&gt;
*Install 1.92+ from http://www.limesurvey.org/en/download .&lt;br /&gt;
*Import and explore the [[Expression Manager Sample Surveys|sample surveys]].&lt;br /&gt;
*Explore the [[Expression Manager HowTos|use cases and HowTos]] and [[Expression Manager Examples|step-by-step examples]].&lt;br /&gt;
*Explore the EM documentation (this page)&lt;br /&gt;
*Examine the built-in EM test suite&lt;br /&gt;
**From any survey, under tools, select the EM option&lt;br /&gt;
**Availalbe Functions lists the 70+ functions and syntax&lt;br /&gt;
**Unit Tests of Isolsted Expressions&lt;br /&gt;
***shows examples of using all EM functions and operators, and the PHP and JavaScript results&lt;br /&gt;
***note there are few functions that generate different results in the PHP and JavaScript versions, so this page lets you plan your EM logic accordingly.&lt;br /&gt;
&lt;br /&gt;
=What Functionality does Expression Manager Extend/Replace? (LimeSurvey &amp;lt;= 1.91+)= &amp;lt;!--T:77--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Conditions =&amp;gt; Relevance== &amp;lt;!--T:78--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:79--&amp;gt;&lt;br /&gt;
Conditions controlled which  questions are visible.  The general syntax was &#039;&#039;SGQA operator Value&#039;&#039;, like &#039;&#039;111X2X3 == &amp;quot;Y&amp;quot;&#039;&#039;.  Conditions could be ANDed or ORed together, but mixing ANDs and ORs was difficult.  The conditions themselves were stored in a separate table, and large portion of LimeSurvey&#039;s code was devoted to managing Conditions.  Because of extensive database access, processing large numbers of conditions could cause noticable performance problems.  Furthermore, once you had conditions assigned to questions or groups, you were often not allowed to re-order or delete them.&lt;br /&gt;
&lt;br /&gt;
==Assessments =&amp;gt; Equations and  Micro-Tailoring== &amp;lt;!--T:80--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:81--&amp;gt;&lt;br /&gt;
Assessments let users create scale scores from a collection of questions.  However, they could not dynamically change on the current page, and their values were not stored to the database.&lt;br /&gt;
&lt;br /&gt;
==Replacements =&amp;gt; Micro-Tailoring== &amp;lt;!--T:82--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:83--&amp;gt;&lt;br /&gt;
Users could tailor some messages and questions based  upon prior responses.  For example, a question might be, &#039;&#039;{TOKEN:FIRSTNAME}, you said {INSERTANS:111X3X4} was your favorite sport&#039;&#039;.  However, it was not possible to do conditional tailoring (like say &amp;quot;Mr.&amp;quot; or &amp;quot;Mrs.&amp;quot; depending upon the person&#039;s gender), or conjugate verbs or decline nouns without fancy JavaScript.  Authors could implement surveys that seemed to tailor questions, but it required separate questions for each permutation, and complex conditions to decide which questions to display.&lt;br /&gt;
&lt;br /&gt;
==Validation== &amp;lt;!--T:84--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:85--&amp;gt;&lt;br /&gt;
Question could be validated with Regular expressions, or minimum/maximum values, or let an SGQA response serve as the minimum or maximum value.  However, validations could not be based upon calculations of other variables without fancy JavaScript.&lt;br /&gt;
&lt;br /&gt;
==Equations== &amp;lt;!--T:86--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:87--&amp;gt;&lt;br /&gt;
Equations were not supported without fancy JavaScript.&lt;br /&gt;
&lt;br /&gt;
==Equation Question Type== &amp;lt;!--T:88--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:89--&amp;gt;&lt;br /&gt;
Equations could not be saved to the database (e.g. the final score for an assessment) without fancy JavaScript.&lt;br /&gt;
&lt;br /&gt;
=How Will Expression Manager Replace/Extend That Functionality?= &amp;lt;!--T:90--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:91--&amp;gt;&lt;br /&gt;
The Expression Manager is a new core module within LimeSurvey that makes it much easier to support the type of complex functionality that used to require custom JavaScript.  It is also replacing the way LimeSurvey currently manages Conditions and Assessments.&lt;br /&gt;
&lt;br /&gt;
==New Terminology When Referring to Expression Manager (EM)== &amp;lt;!--T:92--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:93--&amp;gt;&lt;br /&gt;
EM &amp;quot;thinks&amp;quot; of its functionality in the following terms:&lt;br /&gt;
*&#039;&#039;&#039;Relevance-based Branching&#039;&#039;&#039; - if a question is relevant, then ask it, otherwise don&#039;t (e.g. make it invisible, and mark it as NULL in the database).  There is a new Relevance field for all Question types, and also for each Group (so you can apply a set of conditions to an entire group without having to copy the same condition to each question, and/or combine group and question-level conditional logic).&lt;br /&gt;
*&#039;&#039;&#039;Tailoring&#039;&#039;&#039; - Once you know which questions should be asked, tailoring (sometimes called &#039;&#039;piping&#039;&#039;) specifies how the question should be asked. This lets you support not only simple subsitution (like {TOKEN:FIRSTNAME}), but also conjugation of verbs and declination of nouns based upon the gender or number of your subjects.  It also lets you change the message you deliver to a subject based upon whether they answered (or how they answered) other questions.&lt;br /&gt;
*&#039;&#039;&#039;Equations&#039;&#039;&#039; - EM adds a new question type called Equation which stores the result of an Expression.  These equations results are computed and written to the database, even if you hide them on the page.  Thus, they are useful for hidden scoring calculations, navigation based upon complex equations, assessments, and reports that should be generated and easily available within the database.&lt;br /&gt;
&lt;br /&gt;
===Relevance and Cascading Relevance=== &amp;lt;!--T:94--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:95--&amp;gt;&lt;br /&gt;
Every question type now has a Relevance option which controls whether the question is displayed.  EM processes each of the Relevance Equations in the order they should appear in the survey.  If the expression is true (or missing - to support legacy surveys), the question will be diplayed. If it is not relevant, then the question will be hidden, and the value will be NULLed in the database.  If there are no relevant questions in a group, the entire group will be skipped.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:96--&amp;gt;&lt;br /&gt;
Moreover, if any of the variables within an expression is irrelevant, then the expression always evaluates to false.  This enables Cascading Relevance so that you do not have to write very long Relevance equations for each question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:97--&amp;gt;&lt;br /&gt;
Say you have 5 questions Q1-Q5, and you only want to show Q2 if Q1 was answered, and Q3 if Q2 was answered, etc.  The relevance equations might be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:98--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Question Code!!Relevance!!Question&lt;br /&gt;
|-&lt;br /&gt;
|Q1||1||What is your name?&lt;br /&gt;
|-&lt;br /&gt;
|Q2||Q1||{Q1}, how old are you?&lt;br /&gt;
|-&lt;br /&gt;
|Q3||Q2||So, you are {Q2} years old.  Are you married?&lt;br /&gt;
|-&lt;br /&gt;
|Q4||Q3 == &amp;quot;Y&amp;quot;||{Q1}, how long have you been married?&lt;br /&gt;
|-&lt;br /&gt;
|Q5||Q4||How many children do you have, {Q1}?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:99--&amp;gt;&lt;br /&gt;
The relevance calculations also work in JavaScript - so you could put all the above questions on one page and it would still work as expected.  In fact, EM totally replaces how EM processes Survey vs. Group vs. Question-at-a-time survey formats.  They now all use the exactly same navigation engine so they work identically regardless of survey style.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:100--&amp;gt;&lt;br /&gt;
As long as you are on the same page, any data you entered will still be there, just hidden.  So, if you enter some information, then choose and option that makes them irrelevant, then make them relevant again, your answers will still be available.  However, as soon as you move to a different page, all irrelevant responses will be lost to integrity of the dataset.&lt;br /&gt;
&lt;br /&gt;
===Group-Level Relevance=== &amp;lt;!--T:101--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:102--&amp;gt;&lt;br /&gt;
Expression Manager also supports group-level relevance.  This makes it easier to implement looping.   Say you want to collect information about up to 10 entities (such a products or people in a household), where you first deterimine how many entities need follow-up (such as by asking how many people live in a household, or having people check which products they like from a long list).  After knowning how many entities need follow-up, you can use Group-level relevance like {count &amp;gt;= 1}, {count &amp;gt;=2}, ... {count &amp;gt;= 10} for each of the 10 groups of follow-up questions.  Within each group, you can have question-level conditional logic (e.g. gender or age-specific follow-up questions for each subject).  The question and group-level relevance equations are ANDed together to determine which should be shown.&lt;br /&gt;
&lt;br /&gt;
===Tailoring / Piping=== &amp;lt;!--T:103--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:104--&amp;gt;&lt;br /&gt;
Anything within curly braces is now treated as an Expression (with one exception described below).  Expressions have acccess to all of the LimeReplacementFields, all of the variables (via several aliases), all typical equation operators (mathematical, logical, and comparison), and dozens of functions (that even work dynamically on the client-side).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:105--&amp;gt;&lt;br /&gt;
Using these equations, you can do things such as:&lt;br /&gt;
#Conditionally show tailored messages to the respondants based upon prior responses&lt;br /&gt;
#Create Assessments and show Assessment results (or conditionally branch or show messages) based upon those results, all without using the Assessments module itself&lt;br /&gt;
#Conjugate verbs and decline nouns within questions, answers, and reports.&lt;br /&gt;
#Show summaries of responses before the &amp;quot;Show your answers&amp;quot; page at the end of the survey&lt;br /&gt;
&lt;br /&gt;
===Equations=== &amp;lt;!--T:106--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:107--&amp;gt;&lt;br /&gt;
There is a new question type called  Equation.  It is like a Boilerplate questions, except that it stores the value of what is displayed in the database.  So, if the Equation Question text contains an Assessment computation, that value would be stored in the database in a variable that can be displayed within public or private statistics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:108--&amp;gt;&lt;br /&gt;
This solves a common request for storing Assessment scores within the database&lt;br /&gt;
&lt;br /&gt;
==Syntax== &amp;lt;!--T:109--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:110--&amp;gt;&lt;br /&gt;
Anything contained within curly braces is now considered an Expression (with one exception:  there must be no leading or trailing whitespace - this is needed to ensure the Expression Manager does not try to process embedded JavaScript).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:111--&amp;gt;&lt;br /&gt;
Note, it is OK for expressions to span multiple lines, as long as there is no whitespace after the opening  curly brace or before the closing curly brace.  This is especially helpful for nested if() statements like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:112--&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;{if(is_empty(PFTotals),&lt;br /&gt;
 &#039;&#039;,&lt;br /&gt;
 if(PFTotals &amp;gt;= -5 &amp;amp;&amp;amp; PFTotals &amp;lt;= -4,&lt;br /&gt;
   &#039;Very Soft&#039;,&lt;br /&gt;
   if(PFTotals &amp;gt;= -3 &amp;amp;&amp;amp; PFTotals &amp;lt;= -2,&lt;br /&gt;
     &#039;Soft&#039;,&lt;br /&gt;
     if(PFTotals == -1,&lt;br /&gt;
       &#039;Somewhat Soft&#039;,&lt;br /&gt;
       if(PFTotals == 0,&lt;br /&gt;
         &#039;Moderate&#039;,&lt;br /&gt;
         if(PFTotals == 1,&lt;br /&gt;
           &#039;Somewhat Hard&#039;,&lt;br /&gt;
           if(PFTotals &amp;gt;= 2 &amp;amp;&amp;amp; PFTotals &amp;lt;= 3,&lt;br /&gt;
             &#039;Hard&#039;,&lt;br /&gt;
             if(PFTotals &amp;gt;= 4 &amp;amp;&amp;amp; PFTotals &amp;lt;= 5,&lt;br /&gt;
               &#039;Very Hard&#039;,&lt;br /&gt;
               &#039;&#039;&lt;br /&gt;
             )&lt;br /&gt;
           )&lt;br /&gt;
         )&lt;br /&gt;
       )&lt;br /&gt;
     )&lt;br /&gt;
   )&lt;br /&gt;
 )&lt;br /&gt;
)}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:138--&amp;gt;&lt;br /&gt;
Expression Manager supports the following syntax:&lt;br /&gt;
*All standard mathematical operators (e.g. +,-,*,/,!)&lt;br /&gt;
*All standard comparison operators (e.g. &amp;lt;,&amp;lt;=,==,!=,&amp;gt;,&amp;gt;=, plus these equivalents:  lt,le,eq,ne,gt,ge)&lt;br /&gt;
*Parentheses (so you can group sub-expressions)&lt;br /&gt;
*Conditional operators (e.g. &amp;amp;&amp;amp;,| | and these equivalents: and,or)&lt;br /&gt;
*Single and double-quoted strings (which can each embed strings with the other quote type)&lt;br /&gt;
*Comma operator (so can have a list of expressions and just return the final result)&lt;br /&gt;
*Assignment operator (=)&lt;br /&gt;
*Pre-defined variables (to refer to questions, question attributes, and responses) - e.g. all of the SGQA codes&lt;br /&gt;
*Pre-defined functions (there are already 70+, and it is easy to add more)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:139--&amp;gt;&lt;br /&gt;
EM syntax follows normal operator precedence:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:140--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level!!Operator(s)!!Description&lt;br /&gt;
|-&lt;br /&gt;
|1||()||parentheses for grouping or calling functions&lt;br /&gt;
|-&lt;br /&gt;
|2||! - +||unary operators: not, negation, unary-plus&lt;br /&gt;
|-&lt;br /&gt;
|3||* /||times, divide&lt;br /&gt;
|-&lt;br /&gt;
|4||+ -||plus, minus&lt;br /&gt;
|-&lt;br /&gt;
|5||&amp;lt; &amp;lt;= &amp;gt; &amp;gt;= lt le gt ge||relative comparisons&lt;br /&gt;
|-&lt;br /&gt;
|6||== != eq ne||equality comparisons&lt;br /&gt;
|-&lt;br /&gt;
|7||and||logical AND&lt;br /&gt;
|-&lt;br /&gt;
|8||or||logical OR&lt;br /&gt;
|-&lt;br /&gt;
|9||=||assignment operator&lt;br /&gt;
|-&lt;br /&gt;
|10||,||comma operator&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:141--&amp;gt;&lt;br /&gt;
Note, for consistency between JavaScript and PHP, the plus operator (+) does addition if both operands are numeric, but does concatenation if both parts are non-numeric strings.  However, we recommend using the join() function for concatenation, as that makes your intent more clear, and avoids unexpected results if you were expecting strings but got numbers instead (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Caution about using Assignment Operator (=)=== &amp;lt;!--T:142--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:143--&amp;gt;&lt;br /&gt;
Note, you should avoid using the assignment operators unless absolutely necessary, since they may cause unexpected side-effects.  For example, if you change the value of a previous response, the cascading relevance and validation logic between that question and the current question is not re-computed, so you could end up with internally inconsistent data (e.g. questions that stay answered but should have been NULLed, or questions that are skipped but should have been answered).  In general, if you want to assign a value to a variable, you sould create an Equation question type, and use an expression to set its value.  However, there are some rare times that people really need this operator, so we made it available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:144--&amp;gt;&lt;br /&gt;
To help caution you about this operator, it is shown in red font within the syntax equations (so that you don&#039;t confuse it with &amp;quot;==&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:145--&amp;gt;&lt;br /&gt;
The main reasons you may want to use assignment are:&lt;br /&gt;
*You need to set the default value for a question that does not accept defaults via equation (such as list radio, where the user interface lets you pick one of the answer options, but does not let you enter an equation).  However, be careful, as LimeSurvey will not be able to validate that your equation generates one of the allowable answers for that question.&lt;br /&gt;
*You need to forcibly change the response to a previous question based upon a later response&lt;br /&gt;
&lt;br /&gt;
==Access to Variables== &amp;lt;!--T:146--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:147--&amp;gt;&lt;br /&gt;
Expression Manager provides read-only access to whichever variables we might need.  For backwards compatibility, it provides access to the following:&lt;br /&gt;
*TOKEN:xxx - the value of a TOKEN (e.g. TOKEN:FIRSTNAME, TOKEN:ATTRIBUTE_5)&lt;br /&gt;
*INSERTANS:SGQA - the display value of an answer (e.g. &amp;quot;Yes&amp;quot;)&lt;br /&gt;
*All {XXX} values used by templates&lt;br /&gt;
*In question text, you can use {QID} replaced by the question id and {SGQ} replaced by the SGQA of the question&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:148--&amp;gt;&lt;br /&gt;
In addition, Expression Manager lets you refer to variables by the Question Code (the &#039;title&#039; column in the questions table within the database).  This is also the variable label used when you export your data to SPSS, R, or SAS.  For example, if you have questions about name, age, and gender, you could call those variables &#039;&#039;name&#039;&#039;, &#039;&#039;age&#039;&#039;, and &#039;&#039;gender&#039;&#039; instead of &#039;&#039;12345X13X22&#039;&#039;, &#039;&#039;12345X13X23&#039;&#039;, and  &#039;&#039;12345X13X24&#039;&#039;.  This makes equations easier for everyone to read and validate the logic, plus makes it possible to shuffle questions around without having to keep track of group or question numbers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:149--&amp;gt;&lt;br /&gt;
Furthermore, Expression Manager lets you access many properties of the Question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:150--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Syntax!!Meaning!!Example!!Example Result&lt;br /&gt;
|-&lt;br /&gt;
|Qcode||an alias for Qcode.code||{implode(&#039;,&#039;,name,gender)}||&#039;Tom&#039;,&#039;M&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.code||the selected response code for the question if it is relevant (otherwise blank), or the text value if it is not a coded question||{implode(&#039;,&#039;,name.code,gender.code)}||&#039;Tom&#039;,&#039;M&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.NAOK||same as Qcode - see discussion of NAOK||{gender.NAOK}||&#039;M&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.value||the assessment value for the question if it is relevant (otherwise blank), or the text value if it is not a coded question||{gender.value}||&#039;1&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.valueNAOK||same as Qcode.value - see discussion about NAOK||{gender.valueNAOK}||&#039;1&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.shown||the dispay value for the question||{implode(&#039;,&#039;,name.shown,gender.shown)}||&#039;Tom&#039;,&#039;Male&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.question||the text of the question||{gender.question}||&#039;What is your gender?&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.mandatory||whether the question is mandatory (Y/N)||{gender.mandatory}||&#039;N&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.qid||the internal question number (not the sequential number)||{gender.qid}||337&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.type||the question type||{gender.type}||&#039;G&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.jsName||the correct javascript name for the question, regardless whether declared on or off this page||{gender.jsName}||&#039;java1827X3X337&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.gid||the internal group number (not the sequential number)||{gender.gid}||3&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.qseq||the sequential number of the question, starting from 0||{gender.qseq}||5&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.gseq||the sequential number of the group, starting from 0||{gender.gseq}||1&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.relevanceStatus||whether the question is currently relevant (0 or 1)||{gender.relevanceStatus)||1&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.relevance||the question-level relevance equation||{gender.relevance}||&#039;!is_empty(name)&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.grelevance||the  group-level relevance equation||{gender.grelevance}||&#039;num_children &amp;gt;= 5&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.sgqa||the SGQA value for this question||{gender.sgqa}||&#039;1827X3X337&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Security issue=== &amp;lt;!--T:151--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:152--&amp;gt;&lt;br /&gt;
For security issues, text entered by user are filtered. Some caracter are replaced by HTML entities.&lt;br /&gt;
* &amp;amp; by &amp;amp;amp;amp;&lt;br /&gt;
* &amp;lt; by &amp;amp;amp;lt;&lt;br /&gt;
* &amp;gt; by &amp;amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Qcode Variable Naming== &amp;lt;!--T:153--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:154--&amp;gt;&lt;br /&gt;
Here are the details of how to construct a Qcode (and access some properties) by question type.  In general, Qcodes are constructed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:155--&amp;gt;&lt;br /&gt;
QuestionCode . &#039;_&#039; . AnswerID . &#039;_&#039; . ScaleId&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:156--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type!!Description!!Code!!SubQs!!Answer Options!!Scales!!Answer Code!!Answer Shown!!Relevance&lt;br /&gt;
|-&lt;br /&gt;
|5||5 Point Choice Radio-Buttons||Q1|| ||1-5|| ||{Q1}||{Q1.shown}||{Q1==3}&lt;br /&gt;
|-&lt;br /&gt;
|B||Array (10 Point Choice) Radio-Buttons||Q2||L1-L6||1-10|| ||{Q2_L2}||{Q2_L2.shown}||{Q2_L2==7}&lt;br /&gt;
|-&lt;br /&gt;
|A||Array (5 Point Choice) Radio-Buttons||Q3||1-5||1-5|| ||{Q3_1}||{Q3_1.shown}||{Q3_1&amp;gt;=3}&lt;br /&gt;
|-&lt;br /&gt;
|1||Array (Flexible Labels) Dual Scale||Q4||sq1-sq5||0:a1-a3||1:b1-b3||{Q4_sq1_0}||{Q4_sq1_1.shown}||{Q4_sq1_1==&#039;b2&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|H||Array (Flexible) - Column Format||Q5||1-5||s,m,t|| ||{Q5_1}||{Q5_1.shown}||{Q5_1==&#039;s&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|F||Array (Flexible) - Row Format||Q6||F1-F5||1-5|| ||{Q6_F3}||{Q6_F3.shown}||{Q6_F3==4}&lt;br /&gt;
|-&lt;br /&gt;
|E||Array (Increase/Same/Decrease) Radio-Buttons||Q7||1-7||I,S,D|| ||{Q7_4}||{Q7_4.shown}||{Q7_4==&#039;D&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|:||Array (Multi Flexi) 1 To 10||Q8||ls1,todo,ls2||min,max,avg|| ||{Q8_ls1_max}||{Q8_ls2_avg.shown}||{Q8_ls2_min==7}&lt;br /&gt;
|-&lt;br /&gt;
|;||Array (Multi Flexi) Text||Q9||hp,st,sw||1st,2nd,3rd|| ||{Q9_hp_3rd}||{Q9_hp_3rd.shown}||{Q9_hp_3rd==&#039;Peter&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|C||Array (Yes/Uncertain/No) Radio-Buttons||Q10||1-5||Y,N,U|| ||{Q10_1}||{Q10_1.shown}||{Q10_3==&#039;Y&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|X||Boilerplate Question||Q11|| || || || ||{Q11.shown}||&lt;br /&gt;
|-&lt;br /&gt;
|D||Date||Q12|| || || ||{Q12}||{Q12.shown}||&lt;br /&gt;
|-&lt;br /&gt;
|*||Equation||Q13|| || || ||{Q13}||{Q13.shown}||{Q13&amp;gt;5}&lt;br /&gt;
|-&lt;br /&gt;
|~124~||File Upload (records number of files uploaded)||Q14|| || || ||{Q14}|| ||{Q14&amp;gt;0}&lt;br /&gt;
|-&lt;br /&gt;
|G||Gender Drop-Down List||Q15|| ||M,F|| ||{Q15}||{Q15.shown}||{Q15==&#039;M&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|U||Huge Free Text||Q16|| || || ||{Q16}||{Q16.shown}||{strlen(Q16)&amp;gt;100}&lt;br /&gt;
|-&lt;br /&gt;
|I||Language Question||Q17|| || || ||{Q17}||{Q17.shown}||{Q17==&#039;en&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|!||List - Dropdown||Q18|| ||1-5|| ||{Q18}||{Q18.shown}||{Q18==3}&lt;br /&gt;
|-&lt;br /&gt;
|L||List Drop-Down/Radio-Button List||Q19|| ||A-Z|| ||{Q19}||{Q19.shown}||{Q19==&#039;X&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|O||List With Comment Drop-Down/Radio-Button List + Textarea||Q20|| ||A-F|| ||{Q20},{Q20comment}||{Q20.shown}||{Q20==&#039;B&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|T||Long Free Text||Q21|| || || ||{Q21}||{Q21.shown}||{strstr(Q21,&#039;hello&#039;)&amp;gt;0}&lt;br /&gt;
|-&lt;br /&gt;
|M||Multiple Choice Checkbox||Q22||A-F|| || ||{Q22_E}||{Q22_E.shown}||{Q22_E==&#039;Y&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|P||Multiple Choice With Comments Checkbox + Text||Q23||A-F|| || ||{Q23_D}, {Q23_Dcomment}||{Q23_D.shown}||{!is_empty(Q23)}&lt;br /&gt;
|-&lt;br /&gt;
|K||Multiple Numerical Question||Q24||self,mom,dad|| || ||{Q24_self}||{Q24_self.shown}||{Q24_self&amp;gt;30}&lt;br /&gt;
|-&lt;br /&gt;
|Q||Multiple Short Text||Q25||A-F|| || ||{Q25_B}||{Q25_B.shown}||{substr(Q25_B,1,1)==&#039;Q&#039;)}&lt;br /&gt;
|-&lt;br /&gt;
|N||Numerical Question Type||Q26|| || || ||{Q26}||{Q26.shown}||{Q26 &amp;gt; 30}&lt;br /&gt;
|-&lt;br /&gt;
|R||Ranking Style||Q27||1-4|| || ||{Q27_1}||{Q27_1.shown}||{Q27_1==3}&lt;br /&gt;
|-&lt;br /&gt;
|S||Short Free Text||Q28|| || || ||{Q28}||{Q28.shown}||{Q28==&#039;mine&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|Y||Yes/No Radio-Buttons||Q29|| || || ||{Q29}||{Q29.shown}||{Q29==&#039;Y&#039;}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==The reserved &#039;this&#039;, &#039;self&#039;, and &#039;that&#039; variables== &amp;lt;!--T:157--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:158--&amp;gt;&lt;br /&gt;
Quite often, you want to evalute all parts of a question, such as counting how many sub-questions have been answered, or summing the scores.  Other times, you want to process just certain rows or columns of a question (such as getting the row or column sums and storing them in the database).  These reserved variables make that process relatively painless.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:159--&amp;gt;&lt;br /&gt;
The &#039;this&#039; variable is used exclusively within the &amp;quot;Whole question validation equation&amp;quot; and &amp;quot;Sub-question validation equation&amp;quot; advanced question options.  It expands to the variable names of each of the cells within those questions.  So, if you want to make sure that each entry is greater than three, you would set the &amp;quot;Sub-question validation equation&amp;quot; to (this &amp;gt; 3).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:160--&amp;gt;&lt;br /&gt;
The &#039;self&#039; and &#039;that&#039; variable are more powerful, and serve as macros which are expanded prior to processing equations.  The syntax choices are:&lt;br /&gt;
*self&lt;br /&gt;
*self.&#039;&#039;suffix&#039;&#039;&lt;br /&gt;
*self.&#039;&#039;sub-selector&#039;&#039;&lt;br /&gt;
*self.&#039;&#039;sub-selector&#039;&#039;.&#039;&#039;suffix&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:161--&amp;gt;&lt;br /&gt;
&#039;&#039;suffix&#039;&#039; is any of the normal qcode suffixes (e.g. NAOK, value, shown)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:162--&amp;gt;&lt;br /&gt;
&#039;&#039;sub-selector&#039;&#039; is one of:&lt;br /&gt;
*comments - only subquestions that are comments (e.g. from multiple choice with comment and list with comment)&lt;br /&gt;
*nocomments - only subquestions that are not comments&lt;br /&gt;
*sq_X - where X is a row or column identifier.  Only sub-questions matching pattern X are selected.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:163--&amp;gt;&lt;br /&gt;
Examples:&lt;br /&gt;
*Has any part of a question been answered?  {count(self.NAOK)&amp;gt;0}&lt;br /&gt;
*What is the assessment score for this question?  {sum(self.value)}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:164--&amp;gt;&lt;br /&gt;
You can also use these to get row and column totals.  Say you have a array of numbers with rows A-E and columns 1-5.&lt;br /&gt;
*What is the grand total?  {sum(self.NAOK)}&lt;br /&gt;
*What is the total of row B?  {sum(self.sq_B.NAOK)}&lt;br /&gt;
*What is the total of column 3? {sum(self.sq_3.NAOK)}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:165--&amp;gt;&lt;br /&gt;
The &#039;that&#039; variable is like the &#039;self&#039; variable, but lets you refer to other questions.  Its syntax is:&lt;br /&gt;
*that.&#039;&#039;qname&#039;&#039;&lt;br /&gt;
*that.&#039;&#039;qname&#039;&#039;.&#039;&#039;suffix&#039;&#039;&lt;br /&gt;
*that.&#039;&#039;qname&#039;&#039;.&#039;&#039;sub-selector&#039;&#039;&lt;br /&gt;
*that.&#039;&#039;qname&#039;&#039;.&#039;&#039;sub-selector&#039;&#039;.&#039;&#039;suffix&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:166--&amp;gt;&lt;br /&gt;
&#039;&#039;qname&#039;&#039; is the question name without any sub-question extensions.  So, say you create a question &#039;q1&#039;, that is its &#039;&#039;qname&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:167--&amp;gt;&lt;br /&gt;
Examples:&lt;br /&gt;
*Has any part of question q1 been answered?  {count(that.q1.NAOK)&amp;gt;0}&lt;br /&gt;
*What is the assessment score for q2?  (sum(that.q2.NAOK)}&lt;br /&gt;
*What is the grand total of q3? {sum(that.q3.NAOK)}&lt;br /&gt;
*What is the total of row C in q4?  {sum(that.q4.sq_C.NAOK)}&lt;br /&gt;
*What is the total of column 2 in q4? {sum(that.q4.sq_2.NAOK)}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:168--&amp;gt;&lt;br /&gt;
The &#039;self&#039; and &#039;that&#039; variables can be used in any relevance,  validation, or tailoring.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:169--&amp;gt;&lt;br /&gt;
The one caveat is that when you use the [[Show Logic File|Show Logic File]] feature, it will show you the expanded value of &#039;self&#039; and &#039;that&#039;.  This lets you see the actual equation that will be generated so that you (and Expression Manager) can validate that the variables exist.  This may seem confusing since you may see quite lenghty equations.  However, if you edit the question, you will see the original equation using &#039;self&#039; and/or &#039;that&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:170--&amp;gt;&lt;br /&gt;
Also note that you should not use these variables if (a) you want to explicitly name each variable used in an equation, or (b) use variables that do not have sub-questions (e.g. single response questions).  In those cases, prefixing a variable with &#039;that&#039; is overkill, and you run the risk of getting unexpected results.&lt;br /&gt;
&lt;br /&gt;
==Access to Functions== &amp;lt;!--T:171--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:172--&amp;gt;&lt;br /&gt;
Expression Manager provides access to mathematical, string, and user-defined functions, as shown below.  It has PHP and JavaScript equivalents for these functions so that they work identically on server-side (PHP) and client-side (JavaScript).  It is easy to add new functions.&lt;br /&gt;
&lt;br /&gt;
===Implemented Functions=== &amp;lt;!--T:173--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:174--&amp;gt;&lt;br /&gt;
The following functions are currently available:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:175--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Function!!Meaning!!Syntax&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.abs.php abs]||Absolute value||number abs(number)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.acos.php acos]||Arc cosine||number acos(number)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.addslashes.php addslashes]||Quote string with slashes||string addslashes(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.asin.php asin]||Arc sine||number asin(number)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.atan.php atan]||Arc tangent||number atan(number)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.atan2.php atan2]||Arc tangent of two variables||number atan2(number, number)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.ceil.php ceil]||Round fractions up||number ceil(number)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.checkdate.php checkdate]||Returns true(1) if it is a valid date in gregorian calendar||bool checkdate(month,day,year)&lt;br /&gt;
|-&lt;br /&gt;
|convert_value||Convert a numerical value using a inputTable and outputTable of numerical values||number convert_value(fValue, iStrict, sTranslateFromList, sTranslateToList)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.cos.php cos]||Cosine||number cos(number)&lt;br /&gt;
|-&lt;br /&gt;
|count||count the number of answered (non-blank)questions in the list||number count(arg1, arg12, ..., argN)&lt;br /&gt;
|-&lt;br /&gt;
|countif||Count the number of answered questions in the list equal the first argument||number countif(matches, arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|countifop||Count the number of answered questions in the list which pass the criteria (arg op value)||number countifop(op, value, arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.date.php date]||Format a local date/time||string date(format &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, timestamp=time()])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.exp.php exp]||Calculates the exponent of e||number exp(number)&lt;br /&gt;
|-&lt;br /&gt;
|fixnum||Display numbers with comma as radix separator, if needed||string fixnum(number)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.floor.php floor]||Round fractions down||number floor(number)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.gmdate.php gmdate]||Format a GMT date/time||string gmdate(format &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, timestamp=time()])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.html-entity-decode.php html_entity_decode]||Convert all HTML entities to their applicable characters (always uses ENT_QUOTES and UTF-8)||string html_entity_decode(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.htmlentities.php htmlentities]||Convert all applicable characters to HTML entities (always uses ENT_QUOTES and UTF-8)||string htmlentities(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.htmlspecialchars.php expr_mgr_htmlspecialchars]||Convert special characters to HTML entities (always uses ENT_QUOTES and UTF-8)||string htmlspecialchars(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.htmlspecialchars-decode.php expr_mgr_htmlspecialchars_decode]||Convert special HTML entities back to characters (always uses ENT_QUOTES and UTF-8)||string htmlspecialchars_decode(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.idate.php idate]||Format a local time/date as integer||string idate(string &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, timestamp=time()])&lt;br /&gt;
|-&lt;br /&gt;
|if||Excel-style if(test,result_if_true,result_if_false)||if(test,result_if_true,result_if_false)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.implode.php implode]||Join array elements with a string||string implode(glue,arg1,arg2,...,argN)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.intval.php intval]||Get the integer value of a variable||int intval(number &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, base=10])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.empty.php is_empty]||Determine whether a variable is considered to be empty||bool is_empty(var)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.is-float.php is_float]||Finds whether the type of a variable is float||bool is_float(var)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.is-int.php is_int]||Find whether the type of a variable is integer||bool is_int(var)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.is-nan.php is_nan]||Finds whether a value is not a number||bool is_nan(var)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.is-null.php is_null]||Finds whether a variable is NULL||bool is_null(var)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.is-numeric.php is_numeric]||Finds whether a variable is a number or a numeric string||bool is_numeric(var)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.is-string.php is_string]||Find whether the type of a variable is string||bool is_string(var)&lt;br /&gt;
|-&lt;br /&gt;
|join (in last 2.0 version)||Join elements as a new string||join(arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|list||Return comma-separated list of non-blank values||string list(arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.log.php log]|| The logarithm of number to base, if given, or the natural logarithm. ||number log(number,base=e)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.ltrim.php ltrim]||Strip whitespace (or other characters) from the beginning of a string||string ltrim(string &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, charlist])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.max.php max]||Find highest value||number max(arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.min.php min]||Find lowest value||number min(arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.mktime.php mktime]||Get UNIX timestamp for a date (each of the 6 arguments are optional)||number mktime([hour [, minute [, second [, month [, day [, year ]]]]]])&lt;br /&gt;
|-&lt;br /&gt;
|modulo-function||The modulo function is &#039;&#039;&#039;not supported&#039;&#039;&#039; yet. You can use the floor() function instead||floor(x/y)==(x/y)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.nl2br.php nl2br]||Inserts HTML line breaks before all newlines in a string||string nl2br(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.number-format.php number_format]||Format a number with grouped thousands||string number_format(number)&lt;br /&gt;
|-&lt;br /&gt;
|pi||Get value of pi||number pi()&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.pow.php pow]||Exponential expression||number pow(base, exp)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.quoted-printable-decode.php quoted_printable_decode]||Convert a quoted-printable string to an 8 bit string||string quoted_printable_decode(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.quoted-printable-encode.php quoted_printable_encode]||Convert a 8 bit string to a quoted-printable string||string quoted_printable_encode(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.quotemeta.php quotemeta]||Quote meta characters||string quotemeta(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.rand.php rand]||Generate a random integer, see [[Expression Manager Sample Surveys#Randomly Ask One Question Per Group|this example]]||int rand() OR int rand(min, max)&lt;br /&gt;
|-&lt;br /&gt;
|regexMatch||compare a string to a [[Using regular expressions|regular expression]]||bool regexMatch(pattern,input)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.round.php round]||Rounds a number to an optional precision||number round(val &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, precision])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.rtrim.php rtrim]||Strip whitespace (or other characters) from the end of a string||string rtrim(string &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, charlist])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.sin.php sin]||Sine||number sin(arg)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.sprintf.php sprintf]||Return a formatted string||string sprintf(format, arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.sqrt.php sqrt]||Square root||number sqrt(arg)&lt;br /&gt;
|-&lt;br /&gt;
|stddev||Calculate the Sample Standard Deviation for the list of numbers||number stddev(arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.str-pad.php str_pad]||Pad a string to a certain length with another string||string str_pad(input, pad_length &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, pad_string])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.str-repeat.php str_repeat]||Repeat a string||string str_repeat(input, multiplier)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.str-replace.php str_replace]||Replace all occurrences of the search string with the replacement string||string str_replace(search, replace, subject)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strcasecmp.php strcasecmp]||Binary safe case-insensitive string comparison||int strcasecmp(str1, str2)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strcmp.php strcmp]||Binary safe string comparison||int strcmp(str1, str2)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strip-tags.php strip_tags]||Strip HTML and PHP tags from a string||string strip_tags(str, allowable_tags)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.stripos.php stripos]||Find position of first occurrence of a case-insensitive string||int stripos(haystack, needle &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, offset=0])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.stripslashes.php stripslashes]||Un-quotes a quoted string||string stripslashes(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.stristr.php stristr]||Case-insensitive strstr||string stristr(haystack, needle &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, before_needle=false])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strlen.php strlen]||Get string length||int strlen(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strpos.php strpos]||Find position of first occurrence of a string||int strpos(haystack, needle &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt; offset=0])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strrev.php strrev]||Reverse a string||string strrev(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strstr.php strstr]||Find first occurrence of a string||string strstr(haystack, needle)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strtolower.php strtolower]||Make a string lowercase||string strtolower(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strtotime.php strtotime]||Parse about any English textual datetime description into a Unix timestamp||int strtotime(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strtoupper.php strtoupper]||Make a string uppercase||string strtoupper(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.substr.php substr]||Return part of a string||string substr(string, start &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, length])&lt;br /&gt;
|-&lt;br /&gt;
|sum||Calculate the sum of values in an array||number sum(arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|sumifop||Sum the values of answered questions in the list which pass the criteria (arg op value)||number sumifop(op, value, arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.tan.php tan]||Tangent||number tan(arg)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.time.php time]||Return current UNIX timestamp||number time()&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.trim.php trim]||Strip whitespace (or other characters) from the beginning and end of a string||string trim(string &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, charlist])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.ucwords.php ucwords]||Uppercase the first character of each word in a string||string ucwords(string)&lt;br /&gt;
|-&lt;br /&gt;
|unique||Returns true if all non-empty responses are unique||boolean unique(arg1, ..., argN)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Functions that are Planned or Being Considered=== &amp;lt;!--T:176--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:177--&amp;gt;&lt;br /&gt;
Other functions that are planned (or being considered) but which are not implemented yet include the following.  Some of these are for backwards compatability with another survey tool.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:178--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Syntax!!Meaning!!Comments&lt;br /&gt;
|-&lt;br /&gt;
|e()||returns the value of e||&lt;br /&gt;
|-&lt;br /&gt;
|formatDate(X,PAT)||return the string value of date X formatted according to Java data format pattern PAT||&lt;br /&gt;
|-&lt;br /&gt;
|formatNumber(X,PAT)||return the string value of number X formatted according to Java number format pattern PAT||&lt;br /&gt;
|-&lt;br /&gt;
|getAnsOption(X)||returns the text corresponding to the selected option for answer X||this is the same as X.shown&lt;br /&gt;
|-&lt;br /&gt;
|getAnsOption(X,Y)||returns the text corresponding to the option at index Y of node X||&lt;br /&gt;
|-&lt;br /&gt;
|getRelevance(X)||returns the relevance equation for question X||&lt;br /&gt;
|-&lt;br /&gt;
|getStartTime()||returns the date corresponding to the system time when the interview was started||&lt;br /&gt;
|-&lt;br /&gt;
|getType(X)||returns the string name of the datatype - e.g. *NA* if isNA()||&lt;br /&gt;
|-&lt;br /&gt;
|gotoFirst()||jumps to the first relevant set of questions - this violates the normal flow of the system||&lt;br /&gt;
|-&lt;br /&gt;
|gotoNext()||jumps to the next set of relevant questions - this violates the normal flow of the system||&lt;br /&gt;
|-&lt;br /&gt;
|gotoPrevious()||jumps to the previous set of relevant questions - this violates the normal flow of the system||&lt;br /&gt;
|-&lt;br /&gt;
|isAsked(X)||returns true if the answer is neither *NA*, *INVALID*, nor *UNASKED*||&lt;br /&gt;
|-&lt;br /&gt;
|isInvalid(X)||returns true if the answer is of type *INVALID*||&lt;br /&gt;
|-&lt;br /&gt;
|isNA(X)||returns true if the answer is of type *NA*||&lt;br /&gt;
|-&lt;br /&gt;
|isNotUnderstood(X)||returns true if the answer if of type *HUH*||&lt;br /&gt;
|-&lt;br /&gt;
|isRefused(X)||returns true if the answer is of type *REFUSED*||&lt;br /&gt;
|-&lt;br /&gt;
|isSpecial(X)||returns true if the answer is of type *UNASKED*, *NA*, *REFUSED*, *INVALID*, *UNKNOWN*, or *HUH*||&lt;br /&gt;
|-&lt;br /&gt;
|isUnknown(X)||returns true if the answer is of type *UNKNOWN*||&lt;br /&gt;
|-&lt;br /&gt;
|jumpTo(X)||jump to the group containing the named question -- this violates the normal flow of the system||&lt;br /&gt;
|-&lt;br /&gt;
|jumpToFirstUnasked()||jump to the first unasked question &amp;lt;strike&amp;gt; thus bypassing previous answered questions &amp;lt;/strike&amp;gt; this violates the normal flow of the system||&lt;br /&gt;
|-&lt;br /&gt;
|lastIndexOf(X,Y)||returns the last index (base 0) of string Y in string X. Returns -1 if Y is not contained within X||&lt;br /&gt;
|-&lt;br /&gt;
|list(X,...)||a string containing a comma separated list of the positive values with &amp;quot;and&amp;quot; separating the last two||&lt;br /&gt;
|-&lt;br /&gt;
|mean(X,...)||returns the mean of a list of values||&lt;br /&gt;
|-&lt;br /&gt;
|numAnsOptions(X)||returns the number of answer options that question X has||&lt;br /&gt;
|-&lt;br /&gt;
|orlist(X,...)||a string containing a comma separated list of the positive values, with &amp;quot;or&amp;quot; separting the last two||&lt;br /&gt;
|-&lt;br /&gt;
|parseDate(X,PAT)||returns the date value of string X parsed with Java date format pattern PAT||&lt;br /&gt;
|-&lt;br /&gt;
|parseNumber(X,PAT)||returns the numerical value of string X parsed with Java number format pattern PAT||&lt;br /&gt;
|-&lt;br /&gt;
|showAllResponsesExcept(questionList,attributeList,attributeTitleList)||questionList = pipe-delimited list of question identifiers; attributeList = pipe-delimited list of attributes (like question#, title, text, type - so you can decide what to show); attributeTitleList = pipe-delimited list of table headers, so can internationalize the report.||&lt;br /&gt;
|-&lt;br /&gt;
|showTheseResponses(questionList,attributeList,attributeTitleList)||questionList = pipe-delimited list of question identifiers; attributeList = pipe-delimited list of attributes (like question#, title, text, type - so you can decide what to show); attributeTitleList = pipe-delimited list of table headers, so can internationalize the report.|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Expression Manager Knows Which Variables are Local== &amp;lt;!--T:179--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:180--&amp;gt;&lt;br /&gt;
In order to properly build the JavaScript for page, Expression Manager needs to know which variables are set on the page, and what their JavaScript ID is (e.g. for document.getElementById(x)).  It also must know which variables are set on other pages (so that it can ensure that the needed &amp;lt;input type=&#039;hidden&#039; value=&#039;x&#039;&amp;gt; fields are present and populated).&lt;br /&gt;
&lt;br /&gt;
==Cascading Conditions== &amp;lt;!--T:181--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:182--&amp;gt;&lt;br /&gt;
If any of the variables are irrelevant, the whole equation will be irrelevant (false).  For example, in the following table, N/A means that one of the variables was not relevant&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:183--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Operator!!Example!!a!!b!!Result&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;+ (unary)&amp;lt;/nowiki&amp;gt;||&amp;lt;nowiki&amp;gt;+a&amp;lt;/nowiki&amp;gt;||N/A|| ||false&lt;br /&gt;
|-&lt;br /&gt;
|- (unary)||-a||N/A|| ||false&lt;br /&gt;
|-&lt;br /&gt;
|!||!a||N/A|| ||false&lt;br /&gt;
|-&lt;br /&gt;
|== (or eq)||a == b||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|== (or eq)||a == b||N/A||0||false&lt;br /&gt;
|-&lt;br /&gt;
|== (or eq)||a == b||N/A||N/A||false&lt;br /&gt;
|-&lt;br /&gt;
|!= (or ne)||a != b||N/A||5|| false&lt;br /&gt;
|-&lt;br /&gt;
|!= (or ne)||a != b||N/A||N/A|| false&lt;br /&gt;
|-&lt;br /&gt;
|!= (or ne)||a != b||N/A||0||false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt; (or gt)||a &amp;gt; b||N/A||5|| false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt;= (or ge)||a &amp;gt;= b||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt; (or lt)||a &amp;lt; b||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;= (or le)||a &amp;lt;= b||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|and||a and b||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|and||a and b||N/A||N/A||false&lt;br /&gt;
|-&lt;br /&gt;
|or||a or b||N/A||N/A||false&lt;br /&gt;
|-&lt;br /&gt;
|or||a or b||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;+&amp;lt;/nowiki&amp;gt;||a + b||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|-||a - b||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|*||a * b||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|/||a / b||5||N/A||false&lt;br /&gt;
|-&lt;br /&gt;
|()||(a)||N/A|| ||false&lt;br /&gt;
|-&lt;br /&gt;
|(exp)||(a &amp;amp;&amp;amp; b)||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|(exp) op (exp)||(b + b) &amp;gt; (a &amp;amp;&amp;amp; b)||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|function||sum(a,b,b)||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|function||max(a,b)||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|function||min(a,b)||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|function||implode(&#039;, &#039;,a,b,a,b)||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|function||if(a,a,b)||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|function||is_empty(a)||N/A|| ||false&lt;br /&gt;
|-&lt;br /&gt;
|function||is_empty(a)||0 (or blank)|| ||true&lt;br /&gt;
|-&lt;br /&gt;
|function||!is_empty(a)||N/A|| ||false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Overriding Cascading Conditions=== &amp;lt;!--T:184--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:185--&amp;gt;&lt;br /&gt;
Say you want to show a running total of all relevant answers.  You might try to use the equation {sum(q1,q2,q3,...,qN)}.  However, this gets translated internally to LEMif(LEManyNA(&#039;q1&#039;,&#039;q2&#039;,&#039;q3&#039;,...,&#039;qN&#039;),&#039;&#039;,sum(LEMval(&#039;q1&#039;),LEMval(&#039;q2&#039;),LEMval(&#039;q3&#039;),...,LEMval(&#039;qN&#039;)).  So, if any of the values q1-qN are irrelevant, the equation will always return false.  In this case, the sum() will show 0 until all questions are answered.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:186--&amp;gt;&lt;br /&gt;
To get around this, each variable can have a &amp;quot;.NAOK&amp;quot; suffix (meaning that Not Applicable is OK) added to it.  In such cases, the following behavior occurs.  Say you have a variable q1.NAOK&lt;br /&gt;
#q1 is not added to the LEManyNA() clause&lt;br /&gt;
#LEMval(&#039;q1&#039;) will  continue to check whether the response is relevant, and will return &#039;&#039; if it is not (so individual irrelevant responses will be ignored, but they will not void the entire expression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:187--&amp;gt;&lt;br /&gt;
So, the solution to the running total problem is to use the equation sum(q1.NAOK,q2.NAOK,q3.NAOK,...,qN.NAOK).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:188--&amp;gt;&lt;br /&gt;
The use of the .NAOK suffix also lets authors design surveys that have several possible paths but then converage on common paths later.  For example, say subjects answer a survey in a way that is outside the normal range of responses.  The author could alert the subjects that they may not get valid results, and ask them whether they really want to  continue with the survey.  If they say Yes, then the rest of the questions will be shown.  The condition for the &amp;quot;rest of the questions&amp;quot; would check whether the initial responses were answered within the normal range OR whether the subject said Yes to the question that is only relevant if they answered outside the normal range.&lt;br /&gt;
&lt;br /&gt;
==How does Expression Manager Support Conditional Micro-Tailoring?== &amp;lt;!--T:189--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:190--&amp;gt;&lt;br /&gt;
Here is an example of micro-tailoring (where Question Type==&#039;expr&#039; means an Equation):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:191--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Question Code!!Relevance!!Question Type!!Question&lt;br /&gt;
|-&lt;br /&gt;
|name||1||text||What is your name?&lt;br /&gt;
|-&lt;br /&gt;
|age||1||text||How old are you?&lt;br /&gt;
|-&lt;br /&gt;
|badage||!is_empty(age)||expr||{(age&amp;lt;16) or (age&amp;gt;80)}&lt;br /&gt;
|-&lt;br /&gt;
|agestop||badage||message||Sorry, {name}, you are too {if( (age&amp;lt;16),&#039;young&#039;,if( (age&amp;gt;80),&#039;old&#039;,&#039;middle-aged&#039;) ) } for this test.&lt;br /&gt;
|-&lt;br /&gt;
|kids||!badage||yesno||Do you have children?&lt;br /&gt;
|-&lt;br /&gt;
|parents||1||expr||{!badage &amp;amp;&amp;amp; kids==&#039;Y&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|numKids||parents||text||How many children do you have?&lt;br /&gt;
|-&lt;br /&gt;
|kid1||parents &amp;amp;&amp;amp; numKids &amp;gt;= 1||text||How old is your first child?&lt;br /&gt;
|-&lt;br /&gt;
|kid2||parents &amp;amp;&amp;amp; numKids &amp;gt;= 2||text||How old is your second child?&lt;br /&gt;
|-&lt;br /&gt;
|kid3||parents &amp;amp;&amp;amp; numKids &amp;gt;= 3||text||How old is your third child?&lt;br /&gt;
|-&lt;br /&gt;
|kid4||parents &amp;amp;&amp;amp; numKids &amp;gt;= 4||text||How old is your fourth child?&lt;br /&gt;
|-&lt;br /&gt;
|kid5||parents &amp;amp;&amp;amp; numKids &amp;gt;= 5||text||How old is your fifth child?&lt;br /&gt;
|-&lt;br /&gt;
|sumage||1||expr||{sum(kid1.NAOK,kid2.NAOK,kid3.NAOK,kid4.NAOK,kid5.NAOK)}&lt;br /&gt;
|-&lt;br /&gt;
|report||parents||yesno||{name}, you said you are {age} and that you have {numKids}.  The sum of ages of your first {min(numKids,5)} kids is {sumage}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:192--&amp;gt;&lt;br /&gt;
All of these questions can be on a single page (e.g. in the same group), and only the relevant questions will display.  Moreover, as you enter the ages of children, the sum() expression in the last question will dynamically update on the page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:193--&amp;gt;&lt;br /&gt;
Expression Manager provides this functionality by surrounding each expression with a named &amp;lt;span&amp;gt; element.  Every time a value changes, it recomputes the expression that should appear in that &amp;lt;span&amp;gt; element and regenerates the display.  You can have dozens, or even hundreds, of such tailored expressions on the same page, and the page will re-display all of them in a single screen refresh.&lt;br /&gt;
&lt;br /&gt;
==Mapping of LimeSurvey 1.91+ to Expression Manager Functionality== &amp;lt;!--T:194--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:195--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Old Feature!!New Feature!!Comments&lt;br /&gt;
|-&lt;br /&gt;
|Conditions||Relevance||You can use very complex conditional equations, and access a broader range of variables&lt;br /&gt;
|-&lt;br /&gt;
|Assessments||Equation||Any assessment scores can be re-structured into an Equation. This both ensures that the score is written to the database, and also lets you see dynamic changes to the score value on the current page&lt;br /&gt;
|-&lt;br /&gt;
|Replacements||Expression Manager||The core engine takes the input string and treats everything within curly braces as an Expression - so it handles all historical replacements types.  To avoid messing up embedded JavaScript, Expression Manager only processes content between curly braces as long as (a)  there is no leading or trailing whitespace within the curly braces - e.g. {expr} is an expression, but { expr}, {expr }, and { expr } are not expressions.  Furthermore, Expression Manager does not process content within its own strings (e.g. {list(&#039;hi&#039;,&#039;there {braces}&#039;} generates &amp;quot;hi there {braces}&amp;quot;).  It also ignores escaped curly braces (e.g. \{this is not an expression\})&lt;br /&gt;
|-&lt;br /&gt;
|Validation||Expression Manager||The plan is to take the current min/max Question Attributes and have Expression Manager process them.  That way the min/max values can be expressions themselves&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Syntax Highlighting= &amp;lt;!--T:196--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:197--&amp;gt;&lt;br /&gt;
To help with entering and validating expressions, EM provides syntax highlighting with the following features:&lt;br /&gt;
&lt;br /&gt;
==Types and Meanings of Syntax Highlighting== &amp;lt;!--T:198--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:199--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Color!!Sample!!Meaning!!Tooltip!!Comments&lt;br /&gt;
|-&lt;br /&gt;
|tan background||style=&#039;background-color: #eee8aa&#039;|Sample||the whole equation||none||Anything within curly braces that is recognized as an equation (e.g. there is no leading or trailing whitepace) will be color-coded with a tan background to help distinguish it from surrounding text&lt;br /&gt;
|-&lt;br /&gt;
|blue bold text||style=&#039;color:blue; background-color:#eee8aa&#039;|&#039;&#039;&#039;Sample&#039;&#039;&#039;||function name||meaning and allowable syntax||function names, or things that should be functions since they are followed by an opening parenthesis, are presented in bold blue text.  Tooltips show the meaning and allowable syntax for the function.&lt;br /&gt;
|-&lt;br /&gt;
|grey text||style=&#039;color:grey; background-color:#eee8aa&#039;|Sample||string||none||single and double-quoted strings are shown in grey text&lt;br /&gt;
|-&lt;br /&gt;
|bold maroon text||style=&#039;color:maroon; background-color:#eee8aa&#039;|&#039;&#039;&#039;Sample&#039;&#039;&#039;||variable set on the same page, but after the current question||&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;name or SGQA code]: question; value; answerList showing codes for each value||Any variable that is set on the same page but after the current question is shown in bold maroon text.  This color coding should alert authors to possible errors in question sequencing; but it is allowed since some authors may want this sequence of variables a page, especially for dynamic reports.  The tooltip shows its name (if you used INSERTANS:xxx) or SGQA code (if you used the new naming system), the actual question, and its current value (or blank if not set).  If the question type expects responses from an enumerated value set, the mapping of the codes to display values is show.&lt;br /&gt;
|-&lt;br /&gt;
|bold cyan text||style=&#039;color:#4C88BE; background-color:#eee8aa&#039;|&#039;&#039;&#039;Sample&#039;&#039;&#039;||variable set on the same page, prior to the current question||&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;name or SGQA code]: question; value; answerList showing codes for each value||Any variable that is set on the same page and prior to the current question is shown in bold cyan text.  The tooltip shows its name (if you used INSERTANS:xxx) or SGQA code (if you used the new naming system), the actual question, and its current value (or blank if not set).  If the question type expects responses from an enumerated value set, the mapping of the codes to display values is show.&lt;br /&gt;
|-&lt;br /&gt;
|bold green text||style=&#039;color:green; background-color:#eee8aa&#039;|&#039;&#039;&#039;Sample&#039;&#039;&#039;||variable set on a prior page||&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;name or SGQA code]: question; value; answerList showing codes for each value||Any variable that is set on a prior pageis shown in bold green text.  The tooltip shows its name (if you used INSERTANS:xxx) or SGQA code (if you used the new naming system), the actual question, and its current value (or blank if not set).  If the question type expects responses from an enumerated value set, the mapping of the codes to display values is show.&lt;br /&gt;
|-&lt;br /&gt;
|bold pink text||style=&#039;color:#FF00FF; background-color:#eee8aa&#039;|&#039;&#039;&#039;Sample&#039;&#039;&#039;||variable set on a later page||&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;name or SGQA code]: question; value; answerList showing codes for each value||Any variable that is set on a prior pageis shown in bold pink text.  These are erorrs since the variable is  being used before it is declareed.  The tooltip shows its name (if you used INSERTANS:xxx) or SGQA code (if you used the new naming system), the actual question, and its current value (or blank if not set).  If the question type expects responses from an enumerated value set, the mapping of the codes to display values is show.&lt;br /&gt;
|-&lt;br /&gt;
|bold tan text||style=&#039;color:#996600; background-color:#eee8aa&#039;|&#039;&#039;&#039;Sample&#039;&#039;&#039;||a lime relacement value||the value||Lime Replacement Strings (like {TOKEN:xxx}, {PRIVACY_MESSAGE} are shown in bold tan text.  The tooltip shows the current value.&lt;br /&gt;
|-&lt;br /&gt;
|red text||style=&#039;color:red; background-color:#eee8aa&#039;|Sample||assignment operator||warning message||If you use one of the assignment operator (=) that operator will be displayed in red text.  This is meant to help prevent accidental re-assignment of values when you really meant to check whether a == b instead of  setting the value of a = b.&lt;br /&gt;
|-&lt;br /&gt;
|normal black text||style=&#039;color:black; background-color:#eee8aa&#039;|Sample||punctuation||none||All other punctuation within the expression is shown as normal black text.&lt;br /&gt;
|-&lt;br /&gt;
|red-boxed text||a bold red line surrounds the error||syntax error||description of the error||Any detected syntax errors are shown by surrounding the error with a red box.  The tooltip shows the error.  Examples include unmatched parentheses, use of undefined functions, passing the wrong number of arguments to functions, poorly structured expressions (e.g. missing operators between variables), trying to assign a new value to a read-only variable, trying to assign values to non-variables, or using unsupported syntax.  Note that the syntax error dectection system may only report one error in an expression even if there are multiple errors; however, if any errors are detected, at least one error will be shown.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Relationship to LimeSurvey Ideas / Feature Requests= &amp;lt;!--T:200--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:201--&amp;gt;&lt;br /&gt;
Expression Manager provides complete or partial solutions to each of the following:&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/1 Conditions]&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/3/ Answercounts]&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/5 Advanced reporting for assessments]&lt;br /&gt;
**partial: Equations let one store the Assessment value in the database, and micro-tailoring can generate simple formatted reports.  Authors can access those Equation values if they have more complex reporting needs.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/6 Assessment reports]&lt;br /&gt;
**partial:  Since Equations store the Assessment score, it should be possible to use Statistics to show distributions of those scores, and Quotas to limit the number of responses with those scores.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/7 Store assessment results for further evaluation]&lt;br /&gt;
**Equations let one store the Assessment value in the database, completely solving this problem&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/22/ More advanced condition rules]&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/28 Open Answertable up so that we can alter formatting]&lt;br /&gt;
**partial:  All of the question attributes are available, so authors can create custom AnswerTable equivalents as a Question.  Once implatemented, they can also use the showTheseResponses() or showAllResponsesExecpt() functions&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/37 Export survey results with full questions to include images]&lt;br /&gt;
**since Tailoring has access to the full question text, it can include images in the export&lt;br /&gt;
**if subjects choose Print Your Answers after finishing the survey, those printouts will be fully tailored&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/63 List of question codes and SGQA identifiers]&lt;br /&gt;
**The Show Survey Logic view shows that mapping (plus much more information)&lt;br /&gt;
**In addition, you no longer have to use SGQA codes to refer to variables - you can use the Question code/title.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/69 Branch/jump to another question (earlier or later) based on current question]&lt;br /&gt;
**You can use the Navigation Index for this in most cases&lt;br /&gt;
**Once implemented, you can use the JumpTo() function.  Like the Navigation Index, if you try to jump forward, it will stop on an intervening page if there are any of the relevant mandatory questions are unanswered, or if any relevant questions fail validation tests.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/86 set quota for total responses]&lt;br /&gt;
**If the final question is an Equation that flags a survey as completed (so is NULL if a respondant does not get to that page), you can use Quotas on that question to control the number of completed responses.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/101 Review all conditions]&lt;br /&gt;
**The [[Show Logic File|Show Logic File]] view shows this (and much more)&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/105 Review all questions + Review all groups]&lt;br /&gt;
**The [[Show Logic File|Show Logic File]] view shows this (and much more)&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/107 How to visualize questions, logic &amp;amp; conditions]&lt;br /&gt;
**The [[Show Logic File|Show Logic File]] view shows this (and much more)&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/113 Offline Surveys]&lt;br /&gt;
**Running a survey with all of the questions on the same page would let you do off-line data collection  (e.g. email the html page and associated JavaScript).  However, you would still want a way to submit the results so that they did not get lost.  It may be possible to use Save As HTML to save partially completed responses.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/120 Remove INSERTANS from question text at survey results]&lt;br /&gt;
**INSERTANS is no longer needed.  You can refer to a variable by its SGQA code (without prefixing it with INSERTANS:), or by its question code.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/137 Informed Consent and Authorization Functionality]&lt;br /&gt;
**You can show show the informed consent on the welcome page, then ask any additional questions needed (to ensure they meet the study inclusion/exclusion criteria), and ask them a Yes/No question whether they give their consent.  Then, make all of the remaining questions conditional on that yesNo.  For example, if the question is named &#039;&#039;consent&#039;&#039;, you would set the relevance to the remaining questions to &#039;&#039;consent == &amp;quot;Y&amp;quot;&#039;&#039; (possibly &#039;&#039;and&#039;&#039;ing that with whatever additional conditions you needed to support your branching needs.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/199 Show codes instead of of answers using INSERTANS]&lt;br /&gt;
**{Qcode} returns the code instead of the response text (which you can get via {INSERTANS:SGQA}, or {Qcode.shown}&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/204 Need group mean or calculations for assessments]&lt;br /&gt;
**Say you have N variables of which N-X were answered, you could compute the mean of the answered variables as {sum(var1, var2, ..., varN) / count(var1, var2, ..., varN)}&lt;br /&gt;
**Computing the mean across a set of respondants would require extension of the Quota functionality.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/222 To insert a language dependent text]&lt;br /&gt;
**Tailoring lets you conjugate verbs and decline nouns in each language&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/225 Surveyors should approve their answers]&lt;br /&gt;
**Custom Questions with tailoring, or the showAllResponsesExcept() function will let Surveyors see all of the questions and responses before clicking Submit. If the Navigation Menu option is enabled, it is easy to go back and correct answers.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/1.92 Suppliment to #answernnXnnXnnn method of targetting form elements]&lt;br /&gt;
**You can now refer to questions and answers by their Question Code, so there is no longer a need to modify SGQA values.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/262 More flexibility with hidden questions]&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/265 Remove specific conditions from multiple questions]&lt;br /&gt;
**You can now use Relevance, which is easier to manage than Conditions.  If  needed, they can all be exported from the database, edited in a spreadsheet, and re-imported.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/268 Cross Survey Reporting]&lt;br /&gt;
**By using question codes that are unique across your surveys and versions, you can consolidate data from multiple surveys and/or compare them&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/275 Simplifying integration with other tools]&lt;br /&gt;
**Expression Manager uses Question Codes instead of SGQA, making it easier to integrate with other tools.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/1.92 Expose assessment score to 3rd party app processing]&lt;br /&gt;
**This can be done with Equation question type&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/309 Multiple thank you pages]&lt;br /&gt;
**This can be supported via conditional relevance branching and tailoring&lt;br /&gt;
&lt;br /&gt;
=Additional Reading= &amp;lt;!--T:202--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==[[Expression Manager Sample Surveys|Expression Manager Sample Surveys]]== &amp;lt;!--T:203--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==[[Expression Manager HowTos|Use Cases and HowTos]]== &amp;lt;!--T:204--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==[[Expression Manager Examples|Step-by-Step Examples]].== &amp;lt;!--T:205--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==[[Expression Manager for developers|Reference for Developers]]== &amp;lt;!--T:206--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==[[Expression Manager Roadmap|RoadMap/Status/ToDo List]]== &amp;lt;!--T:207--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Expression_Manager&amp;diff=41380</id>
		<title>Expression Manager</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Expression_Manager&amp;diff=41380"/>
		<updated>2013-06-13T12:27:11Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: Added function convert_value&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;languages /&amp;gt; &amp;lt;translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:1--&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:2--&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt; Note: This feature is only available in LimeSurvey 1.92 or later. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Quick Start Tutorial= &amp;lt;!--T:3--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overview== &amp;lt;!--T:4--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:5--&amp;gt;&lt;br /&gt;
When customizing your surveys, you typically need a way to specify the following:&lt;br /&gt;
#&#039;&#039;&#039;Navigation/Branching&#039;&#039;&#039; - letting a subject&#039;s answers change the order in which questions are asked&lt;br /&gt;
#&#039;&#039;&#039;Tailoring/Piping&#039;&#039;&#039; - how to phrase the question (such as referring to prior answers, or conjugating sentences based upon the number or gender of your subjects), or how to generate custom reports (like assessment scores or tailored advice).&lt;br /&gt;
#&#039;&#039;&#039;Validation&#039;&#039;&#039; - ensuring that answers pass certain criteria, like min and max values, or matching an input pattern&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:6--&amp;gt;&lt;br /&gt;
Expression Manager (EM) provides an intuitive way to specifying the logic for each of those features.  Nearly anything that you can write as a standard mathematical equation is a valid expression, even if you are calling functions.  EM currently provides access to 70 functions, and can be easily extended to support more.  It also lets you access your variables using human-readable variable names (rather than SGQA names).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:7--&amp;gt;&lt;br /&gt;
The following sections show the main places where Expression Manager is used&lt;br /&gt;
&lt;br /&gt;
==Relevance (Controlling Navigation/Branching)== &amp;lt;!--T:8--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:9--&amp;gt;&lt;br /&gt;
Some surveys use &amp;quot;Goto Logic&amp;quot;, such that if you answer Question 1 with option C, then jump to Question 5. This approach is very limiting, since is hard to validate, and easily breaks if you have to re-order questions.  EM uses an Boolean relevance equation to specify all of the conditions under which a question might be valid.  If the question is relevant, then the question is asked, otherwise it is Not Applicable, and the value NULL is stored in the database.  This is similar to what can be done via the Conditions editor, but EM lets you easily specify much more complex and powerful criteria (and lets you use the variable name rather than SGQA naming).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:10--&amp;gt;&lt;br /&gt;
This image shows one way to review the relevance logic for a survey.  It computes Body Mass Index.  The relevance equation is shown in square bracket right after the variable name (which is in green).  So, the relevance of weight, weight_units, weight_kg are all 1, meaning that those questions are always asked.  However, the relevance for BMI is {!is_empty(height) and !is_empty(weight)}, which means that BMI will only be computed if the subject enters a value for both height and weight (thereby avoiding the risk of a divide by zero error).  Also, the Report question is only shown if the subject answers all four main questions (height, height_units, weight, weight_units).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:11--&amp;gt;&lt;br /&gt;
[[File:tutorial1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:12--&amp;gt;&lt;br /&gt;
Relevance is shown and editable in the following places:&lt;br /&gt;
&lt;br /&gt;
===Viewing / Editing Question-Level Relevance=== &amp;lt;!--T:13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:14--&amp;gt;&lt;br /&gt;
This equation computes the Body Mass Index (BMI).  It is only asked if the person first enters their height and weight.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:15--&amp;gt;&lt;br /&gt;
[[File:tutorial2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:16--&amp;gt;&lt;br /&gt;
This is the edit screen for the BMI question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:17--&amp;gt;&lt;br /&gt;
[[File:tutorial3.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:18--&amp;gt;&lt;br /&gt;
Note that you do not use the curly braces when you enter a Relevance Equation.&lt;br /&gt;
&lt;br /&gt;
===Viewing / Editing Group-Level Relevance=== &amp;lt;!--T:19--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:20--&amp;gt;&lt;br /&gt;
This is a sample census survey.  The first page asks how many people live with you and stores that in the &amp;quot;cohabs&amp;quot; variable.  This page is only shown if you have more than one cohabitant (so it is shown for the second person cohabitating with you), and also only shows if you specified how Person One is related to you (p1_rel).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:21--&amp;gt;&lt;br /&gt;
[[File:tutorial4.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:22--&amp;gt;&lt;br /&gt;
As you can see, the group also has question-level relevance criteria, such that each question only appears once you have answered the question before it (e.g. {!is_empty(p1_sex)}.  EM combines the Group and Question-level relevance for you.  Questions in a group are only asked  if the group as a whole is relevant.  Then, only the subset of questions within the group that are relevant are asked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:23--&amp;gt;&lt;br /&gt;
Here is the screen for editing the group-level relevance for that question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:24--&amp;gt;&lt;br /&gt;
[[File:tutorial5.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:25--&amp;gt;&lt;br /&gt;
Note that you do not use the curly braces when you enter a Relevance Equation.&lt;br /&gt;
&lt;br /&gt;
==Tailoring/Piping== &amp;lt;!--T:26--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:27--&amp;gt;&lt;br /&gt;
EM lets you easily do simple and complex conditional tailoring of your questions.  Sometimes you just need simple substitution, like saying, &amp;quot;You said you purchased &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;Product].  What did you like best about it?&amp;quot;.  Sometimes you need conditional substitution like &amp;quot;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;Mr./Mrs.] &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;LastName], would you be willing to complete our survey?&amp;quot;.  In this case,  you want to use Mr. or Mrs. based upon the person&#039;s gender.  Other times you need even more complex substitution (such as based upon a mathematical computation.  EM supports each of these types of tailoring/piping.&lt;br /&gt;
&lt;br /&gt;
===Conditional Equations=== &amp;lt;!--T:28--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:29--&amp;gt;&lt;br /&gt;
The Body Mass Index example shows the ability to compute a person&#039;s BMI, even while letting them enter their height in weight in metric or non-metric units.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:30--&amp;gt;&lt;br /&gt;
[[File:tailoring7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:31--&amp;gt;&lt;br /&gt;
Here weight_kg is {if(weight_units == &#039;kg&#039;, weight, weight * .453592)}.  This if() function means that if the subject entered the weight using kilograms, use that value, otherwise multiple the entered value (which was in pounds) by .453592 to convert it to kilograms.  The height_m variable uses a similar approach to compute the person&#039;s height in meters, even if he entered his height in inches.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:32--&amp;gt;&lt;br /&gt;
BMI computes the weight formula as {weight_kg / (height_m * height_m)}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:33--&amp;gt;&lt;br /&gt;
Lastly, the report conditionally tailors the message for the subject, telling him what he entered (e.g. &amp;quot;You said you are 2 meters tall and weight 70 kg.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:34--&amp;gt;&lt;br /&gt;
Although not well shown in the above image, weight_status uses nested if() statements to categorize the person as underweight to severely obese.  You can see its equation in the Show Logic View&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:35--&amp;gt;&lt;br /&gt;
[[File:tailoring8.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:36--&amp;gt;&lt;br /&gt;
From the edit window for this question, you can see two things:&lt;br /&gt;
#Tailoring must surround expressions with Curly Braces&lt;br /&gt;
#Expressions can span multiple lines if, as in this case, you want to make it easier to read the nested conditional logic.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:37--&amp;gt;&lt;br /&gt;
[[File:tailoring9.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Tailored Questions, Answers, and Reports=== &amp;lt;!--T:38--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:39--&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note: Dynamic tailoring may not work if answer options are made available in select boxes on the same question page. This results from the fact that tailoring inserts a &amp;lt;nowiki&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/nowiki&amp;gt; tag which is not valid inside select options.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:40--&amp;gt;&lt;br /&gt;
This example shows the BMI report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:41--&amp;gt;&lt;br /&gt;
[[File:tailoring10.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:42--&amp;gt;&lt;br /&gt;
Here is the edit window for the same question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:43--&amp;gt;&lt;br /&gt;
[[File:tailoring11.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:44--&amp;gt;&lt;br /&gt;
As you can see, anything in curly braces is treated as an expression, so is syntax-highlighted (color coded) in the prior image.  If you had any typos (such as misspelled or undefined variable names or functions), EM would show an error, such as this, showing that height_unit is an undefined variable name (it is actually height_units), and rnd() is an undefined function (the proper function name is round()).  In both cases, the errors are surrounded by a red box to make it easier to spot and fix them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:45--&amp;gt;&lt;br /&gt;
[[File:tailoring12.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:46--&amp;gt;&lt;br /&gt;
You can also see that you can quickly create complex reports, such as a table of entered values or tailored advice.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:47--&amp;gt;&lt;br /&gt;
Please remember that all tailoring must surround expressions with Curly Braces, so that LimeSurvey knows which parts of the question are free text and which should be parsed through Expression Manager.&lt;br /&gt;
&lt;br /&gt;
==Validation== &amp;lt;!--T:48--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:49--&amp;gt;&lt;br /&gt;
EM controls how most of the advanced question options work.  These control aspects like min/max numbers of answers; min/max individual values; min/max sum values; and checking that entered values match specified string patterns.  You continue to enter those advanced question options as usual.  However, now any value in one of those fields is considered an expression, so you can have min/max criteria with complex conditional relationships to other questions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:50--&amp;gt;&lt;br /&gt;
In all of these cases, since the advanced question option is always considered an expression, you do not use curly braces when specifying it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:51--&amp;gt;&lt;br /&gt;
The [[Expression Manager Sample Surveys|Sample Surveys]] pages shows many working examples of using expressions for validations.&lt;br /&gt;
&lt;br /&gt;
=Introduction= &amp;lt;!--T:52--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:53--&amp;gt;&lt;br /&gt;
LimeSurvey 1.92 and later uses the new Expression Manager (EM) module which will let LimeSurvey support more complex branching, assessments, validation, and tailoring.  It will replace how LimeSurvey manages Replacements, Conditions, and Assessments on the back-end.  It will also speed up processing considerably since it eliminates most run-time database reads.  EM was developed by Dr. Thomas White (TMSWhite).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:54--&amp;gt;&lt;br /&gt;
This wiki page is the definitive reference for Expression Manager syntax and functionality.&lt;br /&gt;
&lt;br /&gt;
==Key Definitions== &amp;lt;!--T:55--&amp;gt;&lt;br /&gt;
#&#039;&#039;&#039;Expression&#039;&#039;&#039;:  Anything surrounded by curly braces&lt;br /&gt;
#*As long as there is no white space immediately after the opening brace or before the closing curly brace&lt;br /&gt;
#*The contents of Expressions are evaluted by EM, so they can contain mathematical formulas, functions, and complex string and date processing.&lt;br /&gt;
#&#039;&#039;&#039;Tailoring&#039;&#039;&#039;: Sometimes called &amp;quot;piping&amp;quot;, this is the process of conditionally modifying text&lt;br /&gt;
#*You have access to all &#039;replacement fields&#039;, TOKENs, and INSERTANS values&lt;br /&gt;
#*You also have easier access to questions, answers, and their properties.&lt;br /&gt;
#&#039;&#039;&#039;Relevance&#039;&#039;&#039; Equation:  A new question attribute controlling question visiblity&lt;br /&gt;
#*If there is a relevance equation, then the question is only shown if the relevance evaluates to true.&lt;br /&gt;
#*Internally, all array_filter and array_filter_exclude commands become sub-question-level relevance&lt;br /&gt;
#&#039;&#039;&#039;Equation&#039;&#039;&#039; Question Type:  A new question type that saves calculations or reports to the database&lt;br /&gt;
#*It is like a Boilerplate question, but its contents are saved to the database even if you set &amp;quot;Always Hide this Question&amp;quot;&lt;br /&gt;
#&#039;&#039;&#039;SGQA&#039;&#039;&#039;:  This is how variables are named in LimeSurvey &amp;lt;= 1.91+&lt;br /&gt;
#*Stands for Survey-Group-Question-Answer&lt;br /&gt;
#*SGQA variable names look like 123X5X382X971, and may have sub-question suffixes.&lt;br /&gt;
#*These variable names are specific to the underlying S/Q/G/A database codes, so often need to be changed&lt;br /&gt;
#&#039;&#039;&#039;Question Code&#039;&#039;&#039;:  This is the preferred variable name for EM&lt;br /&gt;
#*This can be a descriptive name indicating the purpose of the question, making it easier to read complex logic&lt;br /&gt;
#*Although not required to be unique in &amp;lt;= 1.91+, it must be unique if you want to use EM&lt;br /&gt;
#*Valid question codes should NOT start with a number, so when using the question code to number your questions, simply use &amp;quot;q1&amp;quot;, or &amp;quot;q1a&amp;quot; or &amp;quot;g1q2&amp;quot;.&lt;br /&gt;
#*This is what currently becomes the variable name if you export data to SPSS or R, so if you do statistical analysis, you probably already made this unique.&lt;br /&gt;
&lt;br /&gt;
==Do I have to use EM?== &amp;lt;!--T:56--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:57--&amp;gt;&lt;br /&gt;
The short answer is No (but also yes).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:58--&amp;gt;&lt;br /&gt;
EM is fully backwards-compatible with existing surveys.  So, if you are happy to use Conditions and Assessments in the style that LimeSurvey used in versions &amp;lt;= 1.91+, you can continue to do so.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:59--&amp;gt;&lt;br /&gt;
However, EM completely replaces how LimeSurvey internally deals with Conditions.  Although you can still use the Conditions Editor to create and manage conditions, LimeSurvey 1.92 will convert those to the equivalent Relevance Equations.  As part of the upgrade, LimeSurvey 1.92 will auto-convert all existing Conditions to Relevance Equations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:60--&amp;gt;&lt;br /&gt;
This should give you the best of both worlds - you can continue using LimeSurvey as you are used to, but will see the Relevance Equation equivalent so you can gradually migrate to Relevance Equations directly whenever you see fit.&lt;br /&gt;
&lt;br /&gt;
==Can I mix use of Conditions and Relevance?== &amp;lt;!--T:61--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:62--&amp;gt;&lt;br /&gt;
Yes. You can use the Conditions editor for some questions and the Relevance editor for others.  Conditions are auto-converted to Relevance when you save the question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:63--&amp;gt;&lt;br /&gt;
Note, we assume that if you are using the Conditions editor, that you want those Conditions to over-write any manually entered Relevance equation.  So, if you have existing Conditions and want to manually edit the Relevance, please delete the Conditions for that question first.  Specifically, copy the generated relevance equation to a text editor, use the Conditions menu to delete all of the conditions for that question (which will also delete the relevance), then edit the question and paste the generated relevance equation from the text editor back into the relevance field for that question (and save the question).  If there is enough demand for deleting conditions without deleting the generated relevance equation, we could add a bulk conversion process.&lt;br /&gt;
&lt;br /&gt;
==How should I choose between Conditions and Relevance?== &amp;lt;!--T:64--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:65--&amp;gt;&lt;br /&gt;
Here is a list of pros and cons of each style:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:66--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Style!!Pros!!Cons&lt;br /&gt;
|-&lt;br /&gt;
|Conditions||1. Nice GUI for creating simple conditions &amp;lt;br/&amp;gt;2. GUI well documented and understood by support team||1. Only supports simple comparisons and does not AND/OR conditions well &amp;lt;br/&amp;gt;2. Cascading conditions work erratically &amp;lt;br/&amp;gt;3. Slow - database intensive, so can slow down long surveys &amp;lt;br/&amp;gt;4. Some reported problems with re-loading conditions &amp;lt;br/&amp;gt;5. GUI doesn&#039;t scale well when there are dozens, hundreds, or thousands of questions &amp;lt;br/&amp;gt;6. May be slow to convert paper-based surveys since must use SGQA names &amp;lt;br/&amp;gt;7. Often need a programmer to custom-code logic needed for complex branching&lt;br /&gt;
|-&lt;br /&gt;
|Relevance||1. Supports very complex logic, including 80+ functions and math/string operators &amp;lt;br/&amp;gt;2. Perfect support for cascading logic &amp;lt;br/&amp;gt;3. Fast - no extra database calls, so supports 1000+ question surveys &amp;lt;br/&amp;gt;4. No problems with re-loading logic since does not require SGQA codes &amp;lt;br/&amp;gt;5. Syntax-highlighting scales to 1000+ question surveys &amp;lt;br/&amp;gt;6. Easy and fast to use for groups wanting to computerize existing paper-based suveys.  &amp;lt;br/&amp;gt;7. Easily supports semi-structured interviews and epidemiological surveys without needing a programmers||1. No GUI for simple conditions - use syntax-highlighting instead &amp;lt;br/&amp;gt;2. New, so support teams have not mastered EM yet.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:67--&amp;gt;&lt;br /&gt;
The bottom is that if you are happy with how LimeSurvey 1.91+ works, there is no reason to change what you do.&lt;br /&gt;
&lt;br /&gt;
==What are some other benefits of using EM?== &amp;lt;!--T:68--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:69--&amp;gt;&lt;br /&gt;
Here are some of the other reasons you might want to use EM.&lt;br /&gt;
#Calculations - you can create any calculation you can think of:&lt;br /&gt;
#*You have access to all common mathematical operators and functions&lt;br /&gt;
#*You have access to 70+ mathematical, date, and string processing functions&lt;br /&gt;
#*It is fairly easy for developers to add new functions if users need them&lt;br /&gt;
#Storing Calculations to Database&lt;br /&gt;
#*You can now compute simple and complex calculations and/or scale scores AND have them stored in the database without needing JavaScript.&lt;br /&gt;
#*You use the Equation question type to accomplish this.&lt;br /&gt;
#Assessments&lt;br /&gt;
#*You can now create assessments or scale scores from any question type, not just the subset that used to be supported&lt;br /&gt;
#*You can use Tailoring to show running or total assessment scores anywhere needed - even on the same page&lt;br /&gt;
#*You have more control over the reports generated based upon those assessment scores&lt;br /&gt;
#*You can store assessment scores in the database without needing JavaScript&lt;br /&gt;
#*You can hide assessment scores without needing JavaScript or CSS&lt;br /&gt;
#Replacement Fields&lt;br /&gt;
#*Instead of using {INSERTANS:SGQA}, you can just use the Question Code - this makes it easier to read and validate.&lt;br /&gt;
#*This also avoids the common need to edit questions to change the SGQA code to make everything work.&lt;br /&gt;
#Tailoring - you can conditionally display text based upon other values&lt;br /&gt;
#*Use the appropriate title for a subject, like (e.g. &amp;quot;Hello &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;Mr./Mrs.] Smith&amp;quot;)&lt;br /&gt;
#*Output gramatically correct sentences based when singular/plural matter:  (e.g. &amp;quot;You have 1 child&amp;quot; vs. &amp;quot;You have 2 chldren&amp;quot;)&lt;br /&gt;
#*Appropriately conjugate verbs and decline nouns based upon subject&#039;s gender and plurality.&lt;br /&gt;
#New Variable Attributes - you can access the following to do your tailoring:&lt;br /&gt;
#* (no suffix) -  an alias for qcode.code&lt;br /&gt;
#*.code - the selected response code for the question if it is relevant (otherwise blank), or the text value if it is not a coded question&lt;br /&gt;
#*.NAOK - same as .code, but can be part of calculations or lists even if irrelevant&lt;br /&gt;
#*.value - the assessment value for the question if it is relevant (otherwise blank), or the text value if it is not a coded question&lt;br /&gt;
#*.valueNAOK - same as .value, but can be part of calculations or lists even if irrelevant&lt;br /&gt;
#*.shown - the answer as displayed to the user (this is what {INSERTANS:xxx}  does)&lt;br /&gt;
#*.qid - the question ID&lt;br /&gt;
#*.gid - the group ID&lt;br /&gt;
#*.sgqa - the SGQA value for the question&lt;br /&gt;
#*.jsName - the correct javascript variable name for the question, regardless whether defined on this page or another&lt;br /&gt;
#*.qseq - the question sequence (starting from 0)&lt;br /&gt;
#*.gseq - the group sequence (starting from 0)&lt;br /&gt;
#*.mandatory - whether the question is mandatory (Y/N)&lt;br /&gt;
#*.question - the text of the question&lt;br /&gt;
#*.relevance - the relevance equation for the question&lt;br /&gt;
#*.grelevance - the relevance equation for the group&lt;br /&gt;
#*.relevanceStatus - whether or not the question is currently relevant (1 if true, 0 if false)&lt;br /&gt;
#*.type - the question type (the one character code)&lt;br /&gt;
#Dynamic On-Page Changes&lt;br /&gt;
#*All Relevance, Calculation, and Tailoring works dynamically on a page - so changes in values instantly update the page&lt;br /&gt;
#*So, you have questions dynamically appear/disappear based upon whether they are relevant&lt;br /&gt;
#*Questions are also dynamically tailored based upon responses on the page, so you can see running totals, tailored sentences and customized reports.&lt;br /&gt;
#New Data Entry Screen&lt;br /&gt;
#*In addition to using the current data-entry system, you can just use Survey-All-In-One.&lt;br /&gt;
#*This supports the on-page relevance and tailoring, so data entry clerks can quickly tab through and they will only have to enter the relevant responses&lt;br /&gt;
#*This can be critical if your data entry person needs to see the tailoring, which is also dynamic.&lt;br /&gt;
#Eliminates the need for most custom JavaScript&lt;br /&gt;
#*EM easily supports complicated computations, scoring, tailoring and conditional logic.&lt;br /&gt;
#*Some things will still need JavaScript (like custom layouts and conditionally hiding question sub-elements), but your JavaScript can use the EM functions so that you can access questions by their Qcode instead of SGQA, and access any of the question properties listed above.&lt;br /&gt;
&lt;br /&gt;
==What are some other helpful new features enabled by EM?== &amp;lt;!--T:70--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:71--&amp;gt;&lt;br /&gt;
Regardless of whether you continue to use the Conditions Editor or manually compose Relevance Equations, you get these additional benefits:&lt;br /&gt;
#You can create more complex validation criteria&lt;br /&gt;
#*All of the advanced question attribute (like max_answers, min_num_value_n, max_num_value) can use Expressions.  So, you min/max criteria can be easily adjusted based upon prior responses, even if they are on the same page.&lt;br /&gt;
#*EM also handles all regular-expression-based validation, so you can robustly combine preg and equation-based question attributes.&lt;br /&gt;
#Easy Re-ordering (or deleting) of Questions and Groups&lt;br /&gt;
#*Prior to version 1.92, you could not re-order questions or groups if LimeSurvey thought that such-re-ordering could break conditions in which they were used.  Similarly, you could not delete questions if any other questions depended upon them.&lt;br /&gt;
#*With EM&#039;s syntax highlighting, it is easy to see and validate whether you try to use questions before they are declared.  So, we now let you re-order or delete questions and groups whenever you like.  EM will update all of the syntax highlighting to show you potential errors.&lt;br /&gt;
#*The re-order questions view has been enhanced to help with such review.  It now shows the question&#039;s relevance equation and tailoring, so you can immediately see whether any variables become pink (meaning they are used before being declared).&lt;br /&gt;
#The Question/Group Navigation Index is always available and accurate&lt;br /&gt;
#*Prior to version 1.92, these indexes were not available if there were complex conditions&lt;br /&gt;
#*With EM, we can guarantee that they are accurate.&lt;br /&gt;
#*Subjects can even jump back, to a prior question, change the answer, then jump forward (or submit)&lt;br /&gt;
#**When jumping forwards, EM will re-validate all of the intervening questions/groups.&lt;br /&gt;
#**If any questions become irrelevant, they will be NULLed in the database so that your data is internally consistent&lt;br /&gt;
#**If any questions become relevant or newly fail mandatory or validation rules, EM will stop on that page and force the user to answer those questions before jumping to their final destination.&lt;br /&gt;
#Auto-conversion of Conditions to Relevance&lt;br /&gt;
#*When you upgrade your database, all existing surveys that have conditions will have relevance equations generated for them&lt;br /&gt;
#*Whenever you import a survey, relevance equations will be created as needed&lt;br /&gt;
#*Whenever you add, delete, or modify conditions, EM will generate the appropriate relevance equation.&lt;br /&gt;
#Convenient Syntax Highlighting&lt;br /&gt;
#*When EM shows the relevance equation, it will show the Qcode, even if you entered an SGQA code, as we assume this will be easier to read.&lt;br /&gt;
#*All variables are color coded to show whether they were declared before or after the current question (or before or after the current group).  This lets you quickly detect and fix cases where you try to use variables for relevance (including array_filter), tailoring, or validation equations prior to declaring them.&lt;br /&gt;
#*In addition, if you hover your mouse over the color-coded variable, you will see the most important metadata about that question.   This includes the Group Sequence #, Question Sequence #, Qcode, Text of the question, and all available answer choices (if it is a question type with enumerated answer choices).&lt;br /&gt;
#**The list of answer choices uses this syntax:  &#039;answers&#039;:{key:val, ... }.&lt;br /&gt;
#**&#039;&#039;key&#039;&#039; has the syntax &#039;&#039;&#039;&#039;scale~code&#039;&#039;&#039;&#039; where &#039;&#039;scale&#039;&#039; is the answer scale (e.g. for dual scale), and &#039;&#039;code&#039;&#039; is the answer code.&lt;br /&gt;
#**&#039;&#039;val&#039;&#039; has the syntax &#039;&#039;&#039;&#039;value~shown&#039;&#039;&#039;&#039; where &#039;&#039;value&#039;&#039; is the assessment value (if using assessments, otherwise &#039;&#039;code&#039;&#039;)(e.g. Qcode.value), and &#039;&#039;shown&#039;&#039; is the display value as seen by the subject (e.g. Qcode.shown)&lt;br /&gt;
#**This means that many surveys can use calculations without needing assessment mode.  If you have enumerated answer options  that are unique, non-decimal, and non-negative, you can simply do calculations on the Qcode.code values).&lt;br /&gt;
#Easy review of entire survey logic and content&lt;br /&gt;
#*There is a new Show Survey Logic feature that lets you see everything about the survey (or group or question) on a single page.&lt;br /&gt;
#*It shows the Group, Question, Sub-Question, and Answer-level details for the selected scope (survey vs. group vs. question)&lt;br /&gt;
#*It also shows the relevance, sub-question-level relevance (for array_filter and array_filter_exclude), and generated validation equation (for preg and any validation rules like min/max sum/number of values), and all non-blank question attributes.&lt;br /&gt;
#*Eveything is syntax-highlighted so that you can see potential syntax errors (like unbalanced parentheses or use of variables before they were declared)&lt;br /&gt;
#*The syntax-highligting supports rapid navigation and editing of the survey.&lt;br /&gt;
#**If you click on a variable name, it opens a browser window (or tab) that shows you that question and lets you edit it.&lt;br /&gt;
#**If you click on a group name, it opens a browser window (or tab) showing the group-reorder view so that you can easily move questions around.&lt;br /&gt;
#**All of the question attributes are also syntax highlighted.  This lets you set and see expressions within advanced question options (like basing the max/min number/sum of values on an expression)&lt;br /&gt;
#*The EM author used similar view (a little cleaner) to let his collaborating Epidemiologists and Institutional Review Board validate and authorize surveys with thousands of questions in highly branched and tailored structured interviews&lt;br /&gt;
&lt;br /&gt;
==How Backwards Compatible is EM with 1.91+?== &amp;lt;!--T:72--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:73--&amp;gt;&lt;br /&gt;
LimeSurvey 1.92 is fully backwards-compatible with 1.91+ with one exception/caveat:  1.92 handles less-than / greater-than comparisons against empty values differently than 1.91+.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:74--&amp;gt;&lt;br /&gt;
One of the LimeSurvey demo surveys uses a set of conditions that translates to this relevance equation:  {(age &amp;lt; 16) or (age == 20) or ... or (age == 80)}. In LimeSurvey 1.91+, (age &amp;lt; 16) is FALSE when there is no answer (the value is blank).  However, in LimeSurey 1.92, (age &amp;lt; 16) is TRUE when there is no answer, since both PHP and JavaScript treat blank as 0 in mathematical comparisons.  Thus, 1.91+ would hide that question when age was unanswered, but 1.92 would show it.  We went to great pains to prevent this, but since we needed to have the Expressions generate identical results in PHP and JavaScript, there was no way to make 1.92 treat &amp;quot;&amp;quot; &amp;lt; 16 as FALSE.  Fortunately, there is an easy work-around for this.  If you want (age &amp;lt; 16) to be FALSE, then use this expression instead: {(!is_empty(age) and age &amp;lt; 16)}.  You can use the new [[Show Logic File|Survey Logic File]] view to quickly identify and fix any such comparisons in your survey.&lt;br /&gt;
&lt;br /&gt;
=Getting Started= &amp;lt;!--T:75--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:76--&amp;gt;&lt;br /&gt;
The best way to get started with EM is to:&lt;br /&gt;
*Install 1.92+ from http://www.limesurvey.org/en/download .&lt;br /&gt;
*Import and explore the [[Expression Manager Sample Surveys|sample surveys]].&lt;br /&gt;
*Explore the [[Expression Manager HowTos|use cases and HowTos]] and [[Expression Manager Examples|step-by-step examples]].&lt;br /&gt;
*Explore the EM documentation (this page)&lt;br /&gt;
*Examine the built-in EM test suite&lt;br /&gt;
**From any survey, under tools, select the EM option&lt;br /&gt;
**Availalbe Functions lists the 70+ functions and syntax&lt;br /&gt;
**Unit Tests of Isolsted Expressions&lt;br /&gt;
***shows examples of using all EM functions and operators, and the PHP and JavaScript results&lt;br /&gt;
***note there are few functions that generate different results in the PHP and JavaScript versions, so this page lets you plan your EM logic accordingly.&lt;br /&gt;
&lt;br /&gt;
=What Functionality does Expression Manager Extend/Replace? (LimeSurvey &amp;lt;= 1.91+)= &amp;lt;!--T:77--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Conditions =&amp;gt; Relevance== &amp;lt;!--T:78--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:79--&amp;gt;&lt;br /&gt;
Conditions controlled which  questions are visible.  The general syntax was &#039;&#039;SGQA operator Value&#039;&#039;, like &#039;&#039;111X2X3 == &amp;quot;Y&amp;quot;&#039;&#039;.  Conditions could be ANDed or ORed together, but mixing ANDs and ORs was difficult.  The conditions themselves were stored in a separate table, and large portion of LimeSurvey&#039;s code was devoted to managing Conditions.  Because of extensive database access, processing large numbers of conditions could cause noticable performance problems.  Furthermore, once you had conditions assigned to questions or groups, you were often not allowed to re-order or delete them.&lt;br /&gt;
&lt;br /&gt;
==Assessments =&amp;gt; Equations and  Micro-Tailoring== &amp;lt;!--T:80--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:81--&amp;gt;&lt;br /&gt;
Assessments let users create scale scores from a collection of questions.  However, they could not dynamically change on the current page, and their values were not stored to the database.&lt;br /&gt;
&lt;br /&gt;
==Replacements =&amp;gt; Micro-Tailoring== &amp;lt;!--T:82--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:83--&amp;gt;&lt;br /&gt;
Users could tailor some messages and questions based  upon prior responses.  For example, a question might be, &#039;&#039;{TOKEN:FIRSTNAME}, you said {INSERTANS:111X3X4} was your favorite sport&#039;&#039;.  However, it was not possible to do conditional tailoring (like say &amp;quot;Mr.&amp;quot; or &amp;quot;Mrs.&amp;quot; depending upon the person&#039;s gender), or conjugate verbs or decline nouns without fancy JavaScript.  Authors could implement surveys that seemed to tailor questions, but it required separate questions for each permutation, and complex conditions to decide which questions to display.&lt;br /&gt;
&lt;br /&gt;
==Validation== &amp;lt;!--T:84--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:85--&amp;gt;&lt;br /&gt;
Question could be validated with Regular expressions, or minimum/maximum values, or let an SGQA response serve as the minimum or maximum value.  However, validations could not be based upon calculations of other variables without fancy JavaScript.&lt;br /&gt;
&lt;br /&gt;
==Equations== &amp;lt;!--T:86--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:87--&amp;gt;&lt;br /&gt;
Equations were not supported without fancy JavaScript.&lt;br /&gt;
&lt;br /&gt;
==Equation Question Type== &amp;lt;!--T:88--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:89--&amp;gt;&lt;br /&gt;
Equations could not be saved to the database (e.g. the final score for an assessment) without fancy JavaScript.&lt;br /&gt;
&lt;br /&gt;
=How Will Expression Manager Replace/Extend That Functionality?= &amp;lt;!--T:90--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:91--&amp;gt;&lt;br /&gt;
The Expression Manager is a new core module within LimeSurvey that makes it much easier to support the type of complex functionality that used to require custom JavaScript.  It is also replacing the way LimeSurvey currently manages Conditions and Assessments.&lt;br /&gt;
&lt;br /&gt;
==New Terminology When Referring to Expression Manager (EM)== &amp;lt;!--T:92--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:93--&amp;gt;&lt;br /&gt;
EM &amp;quot;thinks&amp;quot; of its functionality in the following terms:&lt;br /&gt;
*&#039;&#039;&#039;Relevance-based Branching&#039;&#039;&#039; - if a question is relevant, then ask it, otherwise don&#039;t (e.g. make it invisible, and mark it as NULL in the database).  There is a new Relevance field for all Question types, and also for each Group (so you can apply a set of conditions to an entire group without having to copy the same condition to each question, and/or combine group and question-level conditional logic).&lt;br /&gt;
*&#039;&#039;&#039;Tailoring&#039;&#039;&#039; - Once you know which questions should be asked, tailoring (sometimes called &#039;&#039;piping&#039;&#039;) specifies how the question should be asked. This lets you support not only simple subsitution (like {TOKEN:FIRSTNAME}), but also conjugation of verbs and declination of nouns based upon the gender or number of your subjects.  It also lets you change the message you deliver to a subject based upon whether they answered (or how they answered) other questions.&lt;br /&gt;
*&#039;&#039;&#039;Equations&#039;&#039;&#039; - EM adds a new question type called Equation which stores the result of an Expression.  These equations results are computed and written to the database, even if you hide them on the page.  Thus, they are useful for hidden scoring calculations, navigation based upon complex equations, assessments, and reports that should be generated and easily available within the database.&lt;br /&gt;
&lt;br /&gt;
===Relevance and Cascading Relevance=== &amp;lt;!--T:94--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:95--&amp;gt;&lt;br /&gt;
Every question type now has a Relevance option which controls whether the question is displayed.  EM processes each of the Relevance Equations in the order they should appear in the survey.  If the expression is true (or missing - to support legacy surveys), the question will be diplayed. If it is not relevant, then the question will be hidden, and the value will be NULLed in the database.  If there are no relevant questions in a group, the entire group will be skipped.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:96--&amp;gt;&lt;br /&gt;
Moreover, if any of the variables within an expression is irrelevant, then the expression always evaluates to false.  This enables Cascading Relevance so that you do not have to write very long Relevance equations for each question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:97--&amp;gt;&lt;br /&gt;
Say you have 5 questions Q1-Q5, and you only want to show Q2 if Q1 was answered, and Q3 if Q2 was answered, etc.  The relevance equations might be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:98--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Question Code!!Relevance!!Question&lt;br /&gt;
|-&lt;br /&gt;
|Q1||1||What is your name?&lt;br /&gt;
|-&lt;br /&gt;
|Q2||Q1||{Q1}, how old are you?&lt;br /&gt;
|-&lt;br /&gt;
|Q3||Q2||So, you are {Q2} years old.  Are you married?&lt;br /&gt;
|-&lt;br /&gt;
|Q4||Q3 == &amp;quot;Y&amp;quot;||{Q1}, how long have you been married?&lt;br /&gt;
|-&lt;br /&gt;
|Q5||Q4||How many children do you have, {Q1}?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:99--&amp;gt;&lt;br /&gt;
The relevance calculations also work in JavaScript - so you could put all the above questions on one page and it would still work as expected.  In fact, EM totally replaces how EM processes Survey vs. Group vs. Question-at-a-time survey formats.  They now all use the exactly same navigation engine so they work identically regardless of survey style.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:100--&amp;gt;&lt;br /&gt;
As long as you are on the same page, any data you entered will still be there, just hidden.  So, if you enter some information, then choose and option that makes them irrelevant, then make them relevant again, your answers will still be available.  However, as soon as you move to a different page, all irrelevant responses will be lost to integrity of the dataset.&lt;br /&gt;
&lt;br /&gt;
===Group-Level Relevance=== &amp;lt;!--T:101--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:102--&amp;gt;&lt;br /&gt;
Expression Manager also supports group-level relevance.  This makes it easier to implement looping.   Say you want to collect information about up to 10 entities (such a products or people in a household), where you first deterimine how many entities need follow-up (such as by asking how many people live in a household, or having people check which products they like from a long list).  After knowning how many entities need follow-up, you can use Group-level relevance like {count &amp;gt;= 1}, {count &amp;gt;=2}, ... {count &amp;gt;= 10} for each of the 10 groups of follow-up questions.  Within each group, you can have question-level conditional logic (e.g. gender or age-specific follow-up questions for each subject).  The question and group-level relevance equations are ANDed together to determine which should be shown.&lt;br /&gt;
&lt;br /&gt;
===Tailoring / Piping=== &amp;lt;!--T:103--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:104--&amp;gt;&lt;br /&gt;
Anything within curly braces is now treated as an Expression (with one exception described below).  Expressions have acccess to all of the LimeReplacementFields, all of the variables (via several aliases), all typical equation operators (mathematical, logical, and comparison), and dozens of functions (that even work dynamically on the client-side).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:105--&amp;gt;&lt;br /&gt;
Using these equations, you can do things such as:&lt;br /&gt;
#Conditionally show tailored messages to the respondants based upon prior responses&lt;br /&gt;
#Create Assessments and show Assessment results (or conditionally branch or show messages) based upon those results, all without using the Assessments module itself&lt;br /&gt;
#Conjugate verbs and decline nouns within questions, answers, and reports.&lt;br /&gt;
#Show summaries of responses before the &amp;quot;Show your answers&amp;quot; page at the end of the survey&lt;br /&gt;
&lt;br /&gt;
===Equations=== &amp;lt;!--T:106--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:107--&amp;gt;&lt;br /&gt;
There is a new question type called  Equation.  It is like a Boilerplate questions, except that it stores the value of what is displayed in the database.  So, if the Equation Question text contains an Assessment computation, that value would be stored in the database in a variable that can be displayed within public or private statistics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:108--&amp;gt;&lt;br /&gt;
This solves a common request for storing Assessment scores within the database&lt;br /&gt;
&lt;br /&gt;
==Syntax== &amp;lt;!--T:109--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:110--&amp;gt;&lt;br /&gt;
Anything contained within curly braces is now considered an Expression (with one exception:  there must be no leading or trailing whitespace - this is needed to ensure the Expression Manager does not try to process embedded JavaScript).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:111--&amp;gt;&lt;br /&gt;
Note, it is OK for expressions to span multiple lines, as long as there is no whitespace after the opening  curly brace or before the closing curly brace.  This is especially helpful for nested if() statements like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:112--&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;{if(is_empty(PFTotals),&lt;br /&gt;
 &#039;&#039;,&lt;br /&gt;
 if(PFTotals &amp;gt;= -5 &amp;amp;&amp;amp; PFTotals &amp;lt;= -4,&lt;br /&gt;
   &#039;Very Soft&#039;,&lt;br /&gt;
   if(PFTotals &amp;gt;= -3 &amp;amp;&amp;amp; PFTotals &amp;lt;= -2,&lt;br /&gt;
     &#039;Soft&#039;,&lt;br /&gt;
     if(PFTotals == -1,&lt;br /&gt;
       &#039;Somewhat Soft&#039;,&lt;br /&gt;
       if(PFTotals == 0,&lt;br /&gt;
         &#039;Moderate&#039;,&lt;br /&gt;
         if(PFTotals == 1,&lt;br /&gt;
           &#039;Somewhat Hard&#039;,&lt;br /&gt;
           if(PFTotals &amp;gt;= 2 &amp;amp;&amp;amp; PFTotals &amp;lt;= 3,&lt;br /&gt;
             &#039;Hard&#039;,&lt;br /&gt;
             if(PFTotals &amp;gt;= 4 &amp;amp;&amp;amp; PFTotals &amp;lt;= 5,&lt;br /&gt;
               &#039;Very Hard&#039;,&lt;br /&gt;
               &#039;&#039;&lt;br /&gt;
             )&lt;br /&gt;
           )&lt;br /&gt;
         )&lt;br /&gt;
       )&lt;br /&gt;
     )&lt;br /&gt;
   )&lt;br /&gt;
 )&lt;br /&gt;
)}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:138--&amp;gt;&lt;br /&gt;
Expression Manager supports the following syntax:&lt;br /&gt;
*All standard mathematical operators (e.g. +,-,*,/,!)&lt;br /&gt;
*All standard comparison operators (e.g. &amp;lt;,&amp;lt;=,==,!=,&amp;gt;,&amp;gt;=, plus these equivalents:  lt,le,eq,ne,gt,ge)&lt;br /&gt;
*Parentheses (so you can group sub-expressions)&lt;br /&gt;
*Conditional operators (e.g. &amp;amp;&amp;amp;,| | and these equivalents: and,or)&lt;br /&gt;
*Single and double-quoted strings (which can each embed strings with the other quote type)&lt;br /&gt;
*Comma operator (so can have a list of expressions and just return the final result)&lt;br /&gt;
*Assignment operator (=)&lt;br /&gt;
*Pre-defined variables (to refer to questions, question attributes, and responses) - e.g. all of the SGQA codes&lt;br /&gt;
*Pre-defined functions (there are already 70+, and it is easy to add more)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:139--&amp;gt;&lt;br /&gt;
EM syntax follows normal operator precedence:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:140--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level!!Operator(s)!!Description&lt;br /&gt;
|-&lt;br /&gt;
|1||()||parentheses for grouping or calling functions&lt;br /&gt;
|-&lt;br /&gt;
|2||! - +||unary operators: not, negation, unary-plus&lt;br /&gt;
|-&lt;br /&gt;
|3||* /||times, divide&lt;br /&gt;
|-&lt;br /&gt;
|4||+ -||plus, minus&lt;br /&gt;
|-&lt;br /&gt;
|5||&amp;lt; &amp;lt;= &amp;gt; &amp;gt;= lt le gt ge||relative comparisons&lt;br /&gt;
|-&lt;br /&gt;
|6||== != eq ne||equality comparisons&lt;br /&gt;
|-&lt;br /&gt;
|7||and||logical AND&lt;br /&gt;
|-&lt;br /&gt;
|8||or||logical OR&lt;br /&gt;
|-&lt;br /&gt;
|9||=||assignment operator&lt;br /&gt;
|-&lt;br /&gt;
|10||,||comma operator&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:141--&amp;gt;&lt;br /&gt;
Note, for consistency between JavaScript and PHP, the plus operator (+) does addition if both operands are numeric, but does concatenation if both parts are non-numeric strings.  However, we recommend using the join() function for concatenation, as that makes your intent more clear, and avoids unexpected results if you were expecting strings but got numbers instead (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Caution about using Assignment Operator (=)=== &amp;lt;!--T:142--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:143--&amp;gt;&lt;br /&gt;
Note, you should avoid using the assignment operators unless absolutely necessary, since they may cause unexpected side-effects.  For example, if you change the value of a previous response, the cascading relevance and validation logic between that question and the current question is not re-computed, so you could end up with internally inconsistent data (e.g. questions that stay answered but should have been NULLed, or questions that are skipped but should have been answered).  In general, if you want to assign a value to a variable, you sould create an Equation question type, and use an expression to set its value.  However, there are some rare times that people really need this operator, so we made it available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:144--&amp;gt;&lt;br /&gt;
To help caution you about this operator, it is shown in red font within the syntax equations (so that you don&#039;t confuse it with &amp;quot;==&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:145--&amp;gt;&lt;br /&gt;
The main reasons you may want to use assignment are:&lt;br /&gt;
*You need to set the default value for a question that does not accept defaults via equation (such as list radio, where the user interface lets you pick one of the answer options, but does not let you enter an equation).  However, be careful, as LimeSurvey will not be able to validate that your equation generates one of the allowable answers for that question.&lt;br /&gt;
*You need to forcibly change the response to a previous question based upon a later response&lt;br /&gt;
&lt;br /&gt;
==Access to Variables== &amp;lt;!--T:146--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:147--&amp;gt;&lt;br /&gt;
Expression Manager provides read-only access to whichever variables we might need.  For backwards compatibility, it provides access to the following:&lt;br /&gt;
*TOKEN:xxx - the value of a TOKEN (e.g. TOKEN:FIRSTNAME, TOKEN:ATTRIBUTE_5)&lt;br /&gt;
*INSERTANS:SGQA - the display value of an answer (e.g. &amp;quot;Yes&amp;quot;)&lt;br /&gt;
*All {XXX} values used by templates&lt;br /&gt;
*In question text, you can use {QID} replaced by the question id and {SGQ} replaced by the SGQA of the question&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:148--&amp;gt;&lt;br /&gt;
In addition, Expression Manager lets you refer to variables by the Question Code (the &#039;title&#039; column in the questions table within the database).  This is also the variable label used when you export your data to SPSS, R, or SAS.  For example, if you have questions about name, age, and gender, you could call those variables &#039;&#039;name&#039;&#039;, &#039;&#039;age&#039;&#039;, and &#039;&#039;gender&#039;&#039; instead of &#039;&#039;12345X13X22&#039;&#039;, &#039;&#039;12345X13X23&#039;&#039;, and  &#039;&#039;12345X13X24&#039;&#039;.  This makes equations easier for everyone to read and validate the logic, plus makes it possible to shuffle questions around without having to keep track of group or question numbers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:149--&amp;gt;&lt;br /&gt;
Furthermore, Expression Manager lets you access many properties of the Question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:150--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Syntax!!Meaning!!Example!!Example Result&lt;br /&gt;
|-&lt;br /&gt;
|Qcode||an alias for Qcode.code||{implode(&#039;,&#039;,name,gender)}||&#039;Tom&#039;,&#039;M&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.code||the selected response code for the question if it is relevant (otherwise blank), or the text value if it is not a coded question||{implode(&#039;,&#039;,name.code,gender.code)}||&#039;Tom&#039;,&#039;M&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.NAOK||same as Qcode - see discussion of NAOK||{gender.NAOK}||&#039;M&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.value||the assessment value for the question if it is relevant (otherwise blank), or the text value if it is not a coded question||{gender.value}||&#039;1&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.valueNAOK||same as Qcode.value - see discussion about NAOK||{gender.valueNAOK}||&#039;1&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.shown||the dispay value for the question||{implode(&#039;,&#039;,name.shown,gender.shown)}||&#039;Tom&#039;,&#039;Male&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.question||the text of the question||{gender.question}||&#039;What is your gender?&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.mandatory||whether the question is mandatory (Y/N)||{gender.mandatory}||&#039;N&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.qid||the internal question number (not the sequential number)||{gender.qid}||337&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.type||the question type||{gender.type}||&#039;G&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.jsName||the correct javascript name for the question, regardless whether declared on or off this page||{gender.jsName}||&#039;java1827X3X337&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.gid||the internal group number (not the sequential number)||{gender.gid}||3&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.qseq||the sequential number of the question, starting from 0||{gender.qseq}||5&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.gseq||the sequential number of the group, starting from 0||{gender.gseq}||1&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.relevanceStatus||whether the question is currently relevant (0 or 1)||{gender.relevanceStatus)||1&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.relevance||the question-level relevance equation||{gender.relevance}||&#039;!is_empty(name)&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.grelevance||the  group-level relevance equation||{gender.grelevance}||&#039;num_children &amp;gt;= 5&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Qcode.sgqa||the SGQA value for this question||{gender.sgqa}||&#039;1827X3X337&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Security issue=== &amp;lt;!--T:151--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:152--&amp;gt;&lt;br /&gt;
For security issues, text entered by user are filtered. Some caracter are replaced by HTML entities.&lt;br /&gt;
* &amp;amp; by &amp;amp;amp;amp;&lt;br /&gt;
* &amp;lt; by &amp;amp;amp;lt;&lt;br /&gt;
* &amp;gt; by &amp;amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Qcode Variable Naming== &amp;lt;!--T:153--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:154--&amp;gt;&lt;br /&gt;
Here are the details of how to construct a Qcode (and access some properties) by question type.  In general, Qcodes are constructed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:155--&amp;gt;&lt;br /&gt;
QuestionCode . &#039;_&#039; . AnswerID . &#039;_&#039; . ScaleId&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:156--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type!!Description!!Code!!SubQs!!Answer Options!!Scales!!Answer Code!!Answer Shown!!Relevance&lt;br /&gt;
|-&lt;br /&gt;
|5||5 Point Choice Radio-Buttons||Q1|| ||1-5|| ||{Q1}||{Q1.shown}||{Q1==3}&lt;br /&gt;
|-&lt;br /&gt;
|B||Array (10 Point Choice) Radio-Buttons||Q2||L1-L6||1-10|| ||{Q2_L2}||{Q2_L2.shown}||{Q2_L2==7}&lt;br /&gt;
|-&lt;br /&gt;
|A||Array (5 Point Choice) Radio-Buttons||Q3||1-5||1-5|| ||{Q3_1}||{Q3_1.shown}||{Q3_1&amp;gt;=3}&lt;br /&gt;
|-&lt;br /&gt;
|1||Array (Flexible Labels) Dual Scale||Q4||sq1-sq5||0:a1-a3||1:b1-b3||{Q4_sq1_0}||{Q4_sq1_1.shown}||{Q4_sq1_1==&#039;b2&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|H||Array (Flexible) - Column Format||Q5||1-5||s,m,t|| ||{Q5_1}||{Q5_1.shown}||{Q5_1==&#039;s&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|F||Array (Flexible) - Row Format||Q6||F1-F5||1-5|| ||{Q6_F3}||{Q6_F3.shown}||{Q6_F3==4}&lt;br /&gt;
|-&lt;br /&gt;
|E||Array (Increase/Same/Decrease) Radio-Buttons||Q7||1-7||I,S,D|| ||{Q7_4}||{Q7_4.shown}||{Q7_4==&#039;D&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|:||Array (Multi Flexi) 1 To 10||Q8||ls1,todo,ls2||min,max,avg|| ||{Q8_ls1_max}||{Q8_ls2_avg.shown}||{Q8_ls2_min==7}&lt;br /&gt;
|-&lt;br /&gt;
|;||Array (Multi Flexi) Text||Q9||hp,st,sw||1st,2nd,3rd|| ||{Q9_hp_3rd}||{Q9_hp_3rd.shown}||{Q9_hp_3rd==&#039;Peter&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|C||Array (Yes/Uncertain/No) Radio-Buttons||Q10||1-5||Y,N,U|| ||{Q10_1}||{Q10_1.shown}||{Q10_3==&#039;Y&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|X||Boilerplate Question||Q11|| || || || ||{Q11.shown}||&lt;br /&gt;
|-&lt;br /&gt;
|D||Date||Q12|| || || ||{Q12}||{Q12.shown}||&lt;br /&gt;
|-&lt;br /&gt;
|*||Equation||Q13|| || || ||{Q13}||{Q13.shown}||{Q13&amp;gt;5}&lt;br /&gt;
|-&lt;br /&gt;
|~124~||File Upload (records number of files uploaded)||Q14|| || || ||{Q14}|| ||{Q14&amp;gt;0}&lt;br /&gt;
|-&lt;br /&gt;
|G||Gender Drop-Down List||Q15|| ||M,F|| ||{Q15}||{Q15.shown}||{Q15==&#039;M&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|U||Huge Free Text||Q16|| || || ||{Q16}||{Q16.shown}||{strlen(Q16)&amp;gt;100}&lt;br /&gt;
|-&lt;br /&gt;
|I||Language Question||Q17|| || || ||{Q17}||{Q17.shown}||{Q17==&#039;en&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|!||List - Dropdown||Q18|| ||1-5|| ||{Q18}||{Q18.shown}||{Q18==3}&lt;br /&gt;
|-&lt;br /&gt;
|L||List Drop-Down/Radio-Button List||Q19|| ||A-Z|| ||{Q19}||{Q19.shown}||{Q19==&#039;X&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|O||List With Comment Drop-Down/Radio-Button List + Textarea||Q20|| ||A-F|| ||{Q20},{Q20comment}||{Q20.shown}||{Q20==&#039;B&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|T||Long Free Text||Q21|| || || ||{Q21}||{Q21.shown}||{strstr(Q21,&#039;hello&#039;)&amp;gt;0}&lt;br /&gt;
|-&lt;br /&gt;
|M||Multiple Choice Checkbox||Q22||A-F|| || ||{Q22_E}||{Q22_E.shown}||{Q22_E==&#039;Y&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|P||Multiple Choice With Comments Checkbox + Text||Q23||A-F|| || ||{Q23_D}, {Q23_Dcomment}||{Q23_D.shown}||{!is_empty(Q23)}&lt;br /&gt;
|-&lt;br /&gt;
|K||Multiple Numerical Question||Q24||self,mom,dad|| || ||{Q24_self}||{Q24_self.shown}||{Q24_self&amp;gt;30}&lt;br /&gt;
|-&lt;br /&gt;
|Q||Multiple Short Text||Q25||A-F|| || ||{Q25_B}||{Q25_B.shown}||{substr(Q25_B,1,1)==&#039;Q&#039;)}&lt;br /&gt;
|-&lt;br /&gt;
|N||Numerical Question Type||Q26|| || || ||{Q26}||{Q26.shown}||{Q26 &amp;gt; 30}&lt;br /&gt;
|-&lt;br /&gt;
|R||Ranking Style||Q27||1-4|| || ||{Q27_1}||{Q27_1.shown}||{Q27_1==3}&lt;br /&gt;
|-&lt;br /&gt;
|S||Short Free Text||Q28|| || || ||{Q28}||{Q28.shown}||{Q28==&#039;mine&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|Y||Yes/No Radio-Buttons||Q29|| || || ||{Q29}||{Q29.shown}||{Q29==&#039;Y&#039;}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==The reserved &#039;this&#039;, &#039;self&#039;, and &#039;that&#039; variables== &amp;lt;!--T:157--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:158--&amp;gt;&lt;br /&gt;
Quite often, you want to evalute all parts of a question, such as counting how many sub-questions have been answered, or summing the scores.  Other times, you want to process just certain rows or columns of a question (such as getting the row or column sums and storing them in the database).  These reserved variables make that process relatively painless.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:159--&amp;gt;&lt;br /&gt;
The &#039;this&#039; variable is used exclusively within the &amp;quot;Whole question validation equation&amp;quot; and &amp;quot;Sub-question validation equation&amp;quot; advanced question options.  It expands to the variable names of each of the cells within those questions.  So, if you want to make sure that each entry is greater than three, you would set the &amp;quot;Sub-question validation equation&amp;quot; to (this &amp;gt; 3).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:160--&amp;gt;&lt;br /&gt;
The &#039;self&#039; and &#039;that&#039; variable are more powerful, and serve as macros which are expanded prior to processing equations.  The syntax choices are:&lt;br /&gt;
*self&lt;br /&gt;
*self.&#039;&#039;suffix&#039;&#039;&lt;br /&gt;
*self.&#039;&#039;sub-selector&#039;&#039;&lt;br /&gt;
*self.&#039;&#039;sub-selector&#039;&#039;.&#039;&#039;suffix&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:161--&amp;gt;&lt;br /&gt;
&#039;&#039;suffix&#039;&#039; is any of the normal qcode suffixes (e.g. NAOK, value, shown)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:162--&amp;gt;&lt;br /&gt;
&#039;&#039;sub-selector&#039;&#039; is one of:&lt;br /&gt;
*comments - only subquestions that are comments (e.g. from multiple choice with comment and list with comment)&lt;br /&gt;
*nocomments - only subquestions that are not comments&lt;br /&gt;
*sq_X - where X is a row or column identifier.  Only sub-questions matching pattern X are selected.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:163--&amp;gt;&lt;br /&gt;
Examples:&lt;br /&gt;
*Has any part of a question been answered?  {count(self.NAOK)&amp;gt;0}&lt;br /&gt;
*What is the assessment score for this question?  {sum(self.value)}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:164--&amp;gt;&lt;br /&gt;
You can also use these to get row and column totals.  Say you have a array of numbers with rows A-E and columns 1-5.&lt;br /&gt;
*What is the grand total?  {sum(self.NAOK)}&lt;br /&gt;
*What is the total of row B?  {sum(self.sq_B.NAOK)}&lt;br /&gt;
*What is the total of column 3? {sum(self.sq_3.NAOK)}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:165--&amp;gt;&lt;br /&gt;
The &#039;that&#039; variable is like the &#039;self&#039; variable, but lets you refer to other questions.  Its syntax is:&lt;br /&gt;
*that.&#039;&#039;qname&#039;&#039;&lt;br /&gt;
*that.&#039;&#039;qname&#039;&#039;.&#039;&#039;suffix&#039;&#039;&lt;br /&gt;
*that.&#039;&#039;qname&#039;&#039;.&#039;&#039;sub-selector&#039;&#039;&lt;br /&gt;
*that.&#039;&#039;qname&#039;&#039;.&#039;&#039;sub-selector&#039;&#039;.&#039;&#039;suffix&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:166--&amp;gt;&lt;br /&gt;
&#039;&#039;qname&#039;&#039; is the question name without any sub-question extensions.  So, say you create a question &#039;q1&#039;, that is its &#039;&#039;qname&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:167--&amp;gt;&lt;br /&gt;
Examples:&lt;br /&gt;
*Has any part of question q1 been answered?  {count(that.q1.NAOK)&amp;gt;0}&lt;br /&gt;
*What is the assessment score for q2?  (sum(that.q2.NAOK)}&lt;br /&gt;
*What is the grand total of q3? {sum(that.q3.NAOK)}&lt;br /&gt;
*What is the total of row C in q4?  {sum(that.q4.sq_C.NAOK)}&lt;br /&gt;
*What is the total of column 2 in q4? {sum(that.q4.sq_2.NAOK)}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:168--&amp;gt;&lt;br /&gt;
The &#039;self&#039; and &#039;that&#039; variables can be used in any relevance,  validation, or tailoring.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:169--&amp;gt;&lt;br /&gt;
The one caveat is that when you use the [[Show Logic File|Show Logic File]] feature, it will show you the expanded value of &#039;self&#039; and &#039;that&#039;.  This lets you see the actual equation that will be generated so that you (and Expression Manager) can validate that the variables exist.  This may seem confusing since you may see quite lenghty equations.  However, if you edit the question, you will see the original equation using &#039;self&#039; and/or &#039;that&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:170--&amp;gt;&lt;br /&gt;
Also note that you should not use these variables if (a) you want to explicitly name each variable used in an equation, or (b) use variables that do not have sub-questions (e.g. single response questions).  In those cases, prefixing a variable with &#039;that&#039; is overkill, and you run the risk of getting unexpected results.&lt;br /&gt;
&lt;br /&gt;
==Access to Functions== &amp;lt;!--T:171--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:172--&amp;gt;&lt;br /&gt;
Expression Manager provides access to mathematical, string, and user-defined functions, as shown below.  It has PHP and JavaScript equivalents for these functions so that they work identically on server-side (PHP) and client-side (JavaScript).  It is easy to add new functions.&lt;br /&gt;
&lt;br /&gt;
===Implemented Functions=== &amp;lt;!--T:173--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:174--&amp;gt;&lt;br /&gt;
The following functions are currently available:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:175--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Function!!Meaning!!Syntax&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.abs.php abs]||Absolute value||number abs(number)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.acos.php acos]||Arc cosine||number acos(number)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.addslashes.php addslashes]||Quote string with slashes||string addslashes(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.asin.php asin]||Arc sine||number asin(number)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.atan.php atan]||Arc tangent||number atan(number)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.atan2.php atan2]||Arc tangent of two variables||number atan2(number, number)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.ceil.php ceil]||Round fractions up||number ceil(number)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.checkdate.php checkdate]||Returns true(1) if it is a valid date in gregorian calendar||bool checkdate(month,day,year)&lt;br /&gt;
|-&lt;br /&gt;
|convert_value||Convert a numerical value using a inputTable and outputTable of numerical values||number convert_value(fValue, iStrict, sTranslateFromList, sTranslateToList)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.cos.php cos]||Cosine||number cos(number)&lt;br /&gt;
|-&lt;br /&gt;
|count||count the number of answered (non-blank)questions in the list||number count(arg1, arg12, ..., argN)&lt;br /&gt;
|-&lt;br /&gt;
|countif||Count the number of answered questions in the list equal the first argument||number countif(matches, arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|countifop||Count the number of answered questions in the list which pass the criteria (arg op value)||number countifop(op, value, arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.date.php date]||Format a local date/time||string date(format &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, timestamp=time()])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.exp.php exp]||Calculates the exponent of e||number exp(number)&lt;br /&gt;
|-&lt;br /&gt;
|fixnum||Display numbers with comma as radix separator, if needed||string fixnum(number)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.floor.php floor]||Round fractions down||number floor(number)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.gmdate.php gmdate]||Format a GMT date/time||string gmdate(format &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, timestamp=time()])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.html-entity-decode.php html_entity_decode]||Convert all HTML entities to their applicable characters (always uses ENT_QUOTES and UTF-8)||string html_entity_decode(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.htmlentities.php htmlentities]||Convert all applicable characters to HTML entities (always uses ENT_QUOTES and UTF-8)||string htmlentities(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.htmlspecialchars.php expr_mgr_htmlspecialchars]||Convert special characters to HTML entities (always uses ENT_QUOTES and UTF-8)||string htmlspecialchars(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.htmlspecialchars-decode.php expr_mgr_htmlspecialchars_decode]||Convert special HTML entities back to characters (always uses ENT_QUOTES and UTF-8)||string htmlspecialchars_decode(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.idate.php idate]||Format a local time/date as integer||string idate(string &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, timestamp=time()])&lt;br /&gt;
|-&lt;br /&gt;
|if||Excel-style if(test,result_if_true,result_if_false)||if(test,result_if_true,result_if_false)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.implode.php implode]||Join array elements with a string||string implode(glue,arg1,arg2,...,argN)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.intval.php intval]||Get the integer value of a variable||int intval(number &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, base=10])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.empty.php is_empty]||Determine whether a variable is considered to be empty||bool is_empty(var)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.is-float.php is_float]||Finds whether the type of a variable is float||bool is_float(var)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.is-int.php is_int]||Find whether the type of a variable is integer||bool is_int(var)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.is-nan.php is_nan]||Finds whether a value is not a number||bool is_nan(var)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.is-null.php is_null]||Finds whether a variable is NULL||bool is_null(var)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.is-numeric.php is_numeric]||Finds whether a variable is a number or a numeric string||bool is_numeric(var)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.is-string.php is_string]||Find whether the type of a variable is string||bool is_string(var)&lt;br /&gt;
|-&lt;br /&gt;
|join (in last 2.0 version)||Join elements as a new string||join(arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|list||Return comma-separated list of non-blank values||string list(arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.log.php log]|| The logarithm of number to base, if given, or the natural logarithm. ||number log(number,base=e)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.ltrim.php ltrim]||Strip whitespace (or other characters) from the beginning of a string||string ltrim(string &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, charlist])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.max.php max]||Find highest value||number max(arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.min.php min]||Find lowest value||number min(arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.mktime.php mktime]||Get UNIX timestamp for a date (each of the 6 arguments are optional)||number mktime([hour [, minute [, second [, month [, day [, year ]]]]]])&lt;br /&gt;
|-&lt;br /&gt;
|modulo-function||The modulo function is &#039;&#039;&#039;not supported&#039;&#039;&#039; yet. You can use the floor() function instead||floor(x/y)==(x/y)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.nl2br.php nl2br]||Inserts HTML line breaks before all newlines in a string||string nl2br(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.number-format.php number_format]||Format a number with grouped thousands||string number_format(number)&lt;br /&gt;
|-&lt;br /&gt;
|pi||Get value of pi||number pi()&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.pow.php pow]||Exponential expression||number pow(base, exp)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.quoted-printable-decode.php quoted_printable_decode]||Convert a quoted-printable string to an 8 bit string||string quoted_printable_decode(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.quoted-printable-encode.php quoted_printable_encode]||Convert a 8 bit string to a quoted-printable string||string quoted_printable_encode(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.quotemeta.php quotemeta]||Quote meta characters||string quotemeta(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.rand.php rand]||Generate a random integer, see [[Expression Manager Sample Surveys#Randomly Ask One Question Per Group|this example]]||int rand() OR int rand(min, max)&lt;br /&gt;
|-&lt;br /&gt;
|regexMatch||compare a string to a [[Using regular expressions|regular expression]]||bool regexMatch(pattern,input)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.round.php round]||Rounds a number to an optional precision||number round(val &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, precision])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.rtrim.php rtrim]||Strip whitespace (or other characters) from the end of a string||string rtrim(string &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, charlist])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.sin.php sin]||Sine||number sin(arg)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.sprintf.php sprintf]||Return a formatted string||string sprintf(format, arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.sqrt.php sqrt]||Square root||number sqrt(arg)&lt;br /&gt;
|-&lt;br /&gt;
|stddev||Calculate the Sample Standard Deviation for the list of numbers||number stddev(arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.str-pad.php str_pad]||Pad a string to a certain length with another string||string str_pad(input, pad_length &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, pad_string])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.str-repeat.php str_repeat]||Repeat a string||string str_repeat(input, multiplier)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.str-replace.php str_replace]||Replace all occurrences of the search string with the replacement string||string str_replace(search, replace, subject)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strcasecmp.php strcasecmp]||Binary safe case-insensitive string comparison||int strcasecmp(str1, str2)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strcmp.php strcmp]||Binary safe string comparison||int strcmp(str1, str2)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strip-tags.php strip_tags]||Strip HTML and PHP tags from a string||string strip_tags(str, allowable_tags)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.stripos.php stripos]||Find position of first occurrence of a case-insensitive string||int stripos(haystack, needle &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, offset=0])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.stripslashes.php stripslashes]||Un-quotes a quoted string||string stripslashes(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.stristr.php stristr]||Case-insensitive strstr||string stristr(haystack, needle &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, before_needle=false])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strlen.php strlen]||Get string length||int strlen(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strpos.php strpos]||Find position of first occurrence of a string||int strpos(haystack, needle &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt; offset=0])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strrev.php strrev]||Reverse a string||string strrev(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strstr.php strstr]||Find first occurrence of a string||string strstr(haystack, needle)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strtolower.php strtolower]||Make a string lowercase||string strtolower(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strtotime.php strtotime]||Parse about any English textual datetime description into a Unix timestamp||int strtotime(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.strtoupper.php strtoupper]||Make a string uppercase||string strtoupper(string)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.substr.php substr]||Return part of a string||string substr(string, start &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, length])&lt;br /&gt;
|-&lt;br /&gt;
|sum||Calculate the sum of values in an array||number sum(arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|sumifop||Sum the values of answered questions in the list which pass the criteria (arg op value)||number sumifop(op, value, arg1, arg2, ... argN)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.tan.php tan]||Tangent||number tan(arg)&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.time.php time]||Return current UNIX timestamp||number time()&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.trim.php trim]||Strip whitespace (or other characters) from the beginning and end of a string||string trim(string &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, charlist])&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.php.net/manual/en/function.ucwords.php ucwords]||Uppercase the first character of each word in a string||string ucwords(string)&lt;br /&gt;
|-&lt;br /&gt;
|unique||Returns true if all non-empty responses are unique||boolean unique(arg1, ..., argN)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Functions that are Planned or Being Considered=== &amp;lt;!--T:176--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:177--&amp;gt;&lt;br /&gt;
Other functions that are planned (or being considered) but which are not implemented yet include the following.  Some of these are for backwards compatability with another survey tool.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:178--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Syntax!!Meaning!!Comments&lt;br /&gt;
|-&lt;br /&gt;
|e()||returns the value of e||&lt;br /&gt;
|-&lt;br /&gt;
|formatDate(X,PAT)||return the string value of date X formatted according to Java data format pattern PAT||&lt;br /&gt;
|-&lt;br /&gt;
|formatNumber(X,PAT)||return the string value of number X formatted according to Java number format pattern PAT||&lt;br /&gt;
|-&lt;br /&gt;
|getAnsOption(X)||returns the text corresponding to the selected option for answer X||this is the same as X.shown&lt;br /&gt;
|-&lt;br /&gt;
|getAnsOption(X,Y)||returns the text corresponding to the option at index Y of node X||&lt;br /&gt;
|-&lt;br /&gt;
|getRelevance(X)||returns the relevance equation for question X||&lt;br /&gt;
|-&lt;br /&gt;
|getStartTime()||returns the date corresponding to the system time when the interview was started||&lt;br /&gt;
|-&lt;br /&gt;
|getType(X)||returns the string name of the datatype - e.g. *NA* if isNA()||&lt;br /&gt;
|-&lt;br /&gt;
|gotoFirst()||jumps to the first relevant set of questions - this violates the normal flow of the system||&lt;br /&gt;
|-&lt;br /&gt;
|gotoNext()||jumps to the next set of relevant questions - this violates the normal flow of the system||&lt;br /&gt;
|-&lt;br /&gt;
|gotoPrevious()||jumps to the previous set of relevant questions - this violates the normal flow of the system||&lt;br /&gt;
|-&lt;br /&gt;
|isAsked(X)||returns true if the answer is neither *NA*, *INVALID*, nor *UNASKED*||&lt;br /&gt;
|-&lt;br /&gt;
|isInvalid(X)||returns true if the answer is of type *INVALID*||&lt;br /&gt;
|-&lt;br /&gt;
|isNA(X)||returns true if the answer is of type *NA*||&lt;br /&gt;
|-&lt;br /&gt;
|isNotUnderstood(X)||returns true if the answer if of type *HUH*||&lt;br /&gt;
|-&lt;br /&gt;
|isRefused(X)||returns true if the answer is of type *REFUSED*||&lt;br /&gt;
|-&lt;br /&gt;
|isSpecial(X)||returns true if the answer is of type *UNASKED*, *NA*, *REFUSED*, *INVALID*, *UNKNOWN*, or *HUH*||&lt;br /&gt;
|-&lt;br /&gt;
|isUnknown(X)||returns true if the answer is of type *UNKNOWN*||&lt;br /&gt;
|-&lt;br /&gt;
|jumpTo(X)||jump to the group containing the named question -- this violates the normal flow of the system||&lt;br /&gt;
|-&lt;br /&gt;
|jumpToFirstUnasked()||jump to the first unasked question &amp;lt;strike&amp;gt; thus bypassing previous answered questions &amp;lt;/strike&amp;gt; this violates the normal flow of the system||&lt;br /&gt;
|-&lt;br /&gt;
|lastIndexOf(X,Y)||returns the last index (base 0) of string Y in string X. Returns -1 if Y is not contained within X||&lt;br /&gt;
|-&lt;br /&gt;
|list(X,...)||a string containing a comma separated list of the positive values with &amp;quot;and&amp;quot; separating the last two||&lt;br /&gt;
|-&lt;br /&gt;
|mean(X,...)||returns the mean of a list of values||&lt;br /&gt;
|-&lt;br /&gt;
|numAnsOptions(X)||returns the number of answer options that question X has||&lt;br /&gt;
|-&lt;br /&gt;
|orlist(X,...)||a string containing a comma separated list of the positive values, with &amp;quot;or&amp;quot; separting the last two||&lt;br /&gt;
|-&lt;br /&gt;
|parseDate(X,PAT)||returns the date value of string X parsed with Java date format pattern PAT||&lt;br /&gt;
|-&lt;br /&gt;
|parseNumber(X,PAT)||returns the numerical value of string X parsed with Java number format pattern PAT||&lt;br /&gt;
|-&lt;br /&gt;
|showAllResponsesExcept(questionList,attributeList,attributeTitleList)||questionList = pipe-delimited list of question identifiers; attributeList = pipe-delimited list of attributes (like question#, title, text, type - so you can decide what to show); attributeTitleList = pipe-delimited list of table headers, so can internationalize the report.||&lt;br /&gt;
|-&lt;br /&gt;
|showTheseResponses(questionList,attributeList,attributeTitleList)||questionList = pipe-delimited list of question identifiers; attributeList = pipe-delimited list of attributes (like question#, title, text, type - so you can decide what to show); attributeTitleList = pipe-delimited list of table headers, so can internationalize the report.|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Expression Manager Knows Which Variables are Local== &amp;lt;!--T:179--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:180--&amp;gt;&lt;br /&gt;
In order to properly build the JavaScript for page, Expression Manager needs to know which variables are set on the page, and what their JavaScript ID is (e.g. for document.getElementById(x)).  It also must know which variables are set on other pages (so that it can ensure that the needed &amp;lt;input type=&#039;hidden&#039; value=&#039;x&#039;&amp;gt; fields are present and populated).&lt;br /&gt;
&lt;br /&gt;
==Cascading Conditions== &amp;lt;!--T:181--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:182--&amp;gt;&lt;br /&gt;
If any of the variables are irrelevant, the whole equation will be irrelevant (false).  For example, in the following table, N/A means that one of the variables was not relevant&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:183--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Operator!!Example!!a!!b!!Result&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;+ (unary)&amp;lt;/nowiki&amp;gt;||&amp;lt;nowiki&amp;gt;+a&amp;lt;/nowiki&amp;gt;||N/A|| ||false&lt;br /&gt;
|-&lt;br /&gt;
|- (unary)||-a||N/A|| ||false&lt;br /&gt;
|-&lt;br /&gt;
|!||!a||N/A|| ||false&lt;br /&gt;
|-&lt;br /&gt;
|== (or eq)||a == b||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|== (or eq)||a == b||N/A||0||false&lt;br /&gt;
|-&lt;br /&gt;
|== (or eq)||a == b||N/A||N/A||false&lt;br /&gt;
|-&lt;br /&gt;
|!= (or ne)||a != b||N/A||5|| false&lt;br /&gt;
|-&lt;br /&gt;
|!= (or ne)||a != b||N/A||N/A|| false&lt;br /&gt;
|-&lt;br /&gt;
|!= (or ne)||a != b||N/A||0||false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt; (or gt)||a &amp;gt; b||N/A||5|| false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt;= (or ge)||a &amp;gt;= b||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt; (or lt)||a &amp;lt; b||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;= (or le)||a &amp;lt;= b||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|and||a and b||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|and||a and b||N/A||N/A||false&lt;br /&gt;
|-&lt;br /&gt;
|or||a or b||N/A||N/A||false&lt;br /&gt;
|-&lt;br /&gt;
|or||a or b||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;+&amp;lt;/nowiki&amp;gt;||a + b||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|-||a - b||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|*||a * b||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|/||a / b||5||N/A||false&lt;br /&gt;
|-&lt;br /&gt;
|()||(a)||N/A|| ||false&lt;br /&gt;
|-&lt;br /&gt;
|(exp)||(a &amp;amp;&amp;amp; b)||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|(exp) op (exp)||(b + b) &amp;gt; (a &amp;amp;&amp;amp; b)||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|function||sum(a,b,b)||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|function||max(a,b)||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|function||min(a,b)||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|function||implode(&#039;, &#039;,a,b,a,b)||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|function||if(a,a,b)||N/A||5||false&lt;br /&gt;
|-&lt;br /&gt;
|function||is_empty(a)||N/A|| ||false&lt;br /&gt;
|-&lt;br /&gt;
|function||is_empty(a)||0 (or blank)|| ||true&lt;br /&gt;
|-&lt;br /&gt;
|function||!is_empty(a)||N/A|| ||false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Overriding Cascading Conditions=== &amp;lt;!--T:184--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:185--&amp;gt;&lt;br /&gt;
Say you want to show a running total of all relevant answers.  You might try to use the equation {sum(q1,q2,q3,...,qN)}.  However, this gets translated internally to LEMif(LEManyNA(&#039;q1&#039;,&#039;q2&#039;,&#039;q3&#039;,...,&#039;qN&#039;),&#039;&#039;,sum(LEMval(&#039;q1&#039;),LEMval(&#039;q2&#039;),LEMval(&#039;q3&#039;),...,LEMval(&#039;qN&#039;)).  So, if any of the values q1-qN are irrelevant, the equation will always return false.  In this case, the sum() will show 0 until all questions are answered.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:186--&amp;gt;&lt;br /&gt;
To get around this, each variable can have a &amp;quot;.NAOK&amp;quot; suffix (meaning that Not Applicable is OK) added to it.  In such cases, the following behavior occurs.  Say you have a variable q1.NAOK&lt;br /&gt;
#q1 is not added to the LEManyNA() clause&lt;br /&gt;
#LEMval(&#039;q1&#039;) will  continue to check whether the response is relevant, and will return &#039;&#039; if it is not (so individual irrelevant responses will be ignored, but they will not void the entire expression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:187--&amp;gt;&lt;br /&gt;
So, the solution to the running total problem is to use the equation sum(q1.NAOK,q2.NAOK,q3.NAOK,...,qN.NAOK).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:188--&amp;gt;&lt;br /&gt;
The use of the .NAOK suffix also lets authors design surveys that have several possible paths but then converage on common paths later.  For example, say subjects answer a survey in a way that is outside the normal range of responses.  The author could alert the subjects that they may not get valid results, and ask them whether they really want to  continue with the survey.  If they say Yes, then the rest of the questions will be shown.  The condition for the &amp;quot;rest of the questions&amp;quot; would check whether the initial responses were answered within the normal range OR whether the subject said Yes to the question that is only relevant if they answered outside the normal range.&lt;br /&gt;
&lt;br /&gt;
==How does Expression Manager Support Conditional Micro-Tailoring?== &amp;lt;!--T:189--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:190--&amp;gt;&lt;br /&gt;
Here is an example of micro-tailoring (where Question Type==&#039;expr&#039; means an Equation):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:191--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Question Code!!Relevance!!Question Type!!Question&lt;br /&gt;
|-&lt;br /&gt;
|name||1||text||What is your name?&lt;br /&gt;
|-&lt;br /&gt;
|age||1||text||How old are you?&lt;br /&gt;
|-&lt;br /&gt;
|badage||!is_empty(age)||expr||{(age&amp;lt;16) or (age&amp;gt;80)}&lt;br /&gt;
|-&lt;br /&gt;
|agestop||badage||message||Sorry, {name}, you are too {if( (age&amp;lt;16),&#039;young&#039;,if( (age&amp;gt;80),&#039;old&#039;,&#039;middle-aged&#039;) ) } for this test.&lt;br /&gt;
|-&lt;br /&gt;
|kids||!badage||yesno||Do you have children?&lt;br /&gt;
|-&lt;br /&gt;
|parents||1||expr||{!badage &amp;amp;&amp;amp; kids==&#039;Y&#039;}&lt;br /&gt;
|-&lt;br /&gt;
|numKids||parents||text||How many children do you have?&lt;br /&gt;
|-&lt;br /&gt;
|kid1||parents &amp;amp;&amp;amp; numKids &amp;gt;= 1||text||How old is your first child?&lt;br /&gt;
|-&lt;br /&gt;
|kid2||parents &amp;amp;&amp;amp; numKids &amp;gt;= 2||text||How old is your second child?&lt;br /&gt;
|-&lt;br /&gt;
|kid3||parents &amp;amp;&amp;amp; numKids &amp;gt;= 3||text||How old is your third child?&lt;br /&gt;
|-&lt;br /&gt;
|kid4||parents &amp;amp;&amp;amp; numKids &amp;gt;= 4||text||How old is your fourth child?&lt;br /&gt;
|-&lt;br /&gt;
|kid5||parents &amp;amp;&amp;amp; numKids &amp;gt;= 5||text||How old is your fifth child?&lt;br /&gt;
|-&lt;br /&gt;
|sumage||1||expr||{sum(kid1.NAOK,kid2.NAOK,kid3.NAOK,kid4.NAOK,kid5.NAOK)}&lt;br /&gt;
|-&lt;br /&gt;
|report||parents||yesno||{name}, you said you are {age} and that you have {numKids}.  The sum of ages of your first {min(numKids,5)} kids is {sumage}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:192--&amp;gt;&lt;br /&gt;
All of these questions can be on a single page (e.g. in the same group), and only the relevant questions will display.  Moreover, as you enter the ages of children, the sum() expression in the last question will dynamically update on the page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:193--&amp;gt;&lt;br /&gt;
Expression Manager provides this functionality by surrounding each expression with a named &amp;lt;span&amp;gt; element.  Every time a value changes, it recomputes the expression that should appear in that &amp;lt;span&amp;gt; element and regenerates the display.  You can have dozens, or even hundreds, of such tailored expressions on the same page, and the page will re-display all of them in a single screen refresh.&lt;br /&gt;
&lt;br /&gt;
==Mapping of LimeSurvey 1.91+ to Expression Manager Functionality== &amp;lt;!--T:194--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:195--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Old Feature!!New Feature!!Comments&lt;br /&gt;
|-&lt;br /&gt;
|Conditions||Relevance||You can use very complex conditional equations, and access a broader range of variables&lt;br /&gt;
|-&lt;br /&gt;
|Assessments||Equation||Any assessment scores can be re-structured into an Equation. This both ensures that the score is written to the database, and also lets you see dynamic changes to the score value on the current page&lt;br /&gt;
|-&lt;br /&gt;
|Replacements||Expression Manager||The core engine takes the input string and treats everything within curly braces as an Expression - so it handles all historical replacements types.  To avoid messing up embedded JavaScript, Expression Manager only processes content between curly braces as long as (a)  there is no leading or trailing whitespace within the curly braces - e.g. {expr} is an expression, but { expr}, {expr }, and { expr } are not expressions.  Furthermore, Expression Manager does not process content within its own strings (e.g. {list(&#039;hi&#039;,&#039;there {braces}&#039;} generates &amp;quot;hi there {braces}&amp;quot;).  It also ignores escaped curly braces (e.g. \{this is not an expression\})&lt;br /&gt;
|-&lt;br /&gt;
|Validation||Expression Manager||The plan is to take the current min/max Question Attributes and have Expression Manager process them.  That way the min/max values can be expressions themselves&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Syntax Highlighting= &amp;lt;!--T:196--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:197--&amp;gt;&lt;br /&gt;
To help with entering and validating expressions, EM provides syntax highlighting with the following features:&lt;br /&gt;
&lt;br /&gt;
==Types and Meanings of Syntax Highlighting== &amp;lt;!--T:198--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:199--&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Color!!Sample!!Meaning!!Tooltip!!Comments&lt;br /&gt;
|-&lt;br /&gt;
|tan background||style=&#039;background-color: #eee8aa&#039;|Sample||the whole equation||none||Anything within curly braces that is recognized as an equation (e.g. there is no leading or trailing whitepace) will be color-coded with a tan background to help distinguish it from surrounding text&lt;br /&gt;
|-&lt;br /&gt;
|blue bold text||style=&#039;color:blue; background-color:#eee8aa&#039;|&#039;&#039;&#039;Sample&#039;&#039;&#039;||function name||meaning and allowable syntax||function names, or things that should be functions since they are followed by an opening parenthesis, are presented in bold blue text.  Tooltips show the meaning and allowable syntax for the function.&lt;br /&gt;
|-&lt;br /&gt;
|grey text||style=&#039;color:grey; background-color:#eee8aa&#039;|Sample||string||none||single and double-quoted strings are shown in grey text&lt;br /&gt;
|-&lt;br /&gt;
|bold maroon text||style=&#039;color:maroon; background-color:#eee8aa&#039;|&#039;&#039;&#039;Sample&#039;&#039;&#039;||variable set on the same page, but after the current question||&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;name or SGQA code]: question; value; answerList showing codes for each value||Any variable that is set on the same page but after the current question is shown in bold maroon text.  This color coding should alert authors to possible errors in question sequencing; but it is allowed since some authors may want this sequence of variables a page, especially for dynamic reports.  The tooltip shows its name (if you used INSERTANS:xxx) or SGQA code (if you used the new naming system), the actual question, and its current value (or blank if not set).  If the question type expects responses from an enumerated value set, the mapping of the codes to display values is show.&lt;br /&gt;
|-&lt;br /&gt;
|bold cyan text||style=&#039;color:#4C88BE; background-color:#eee8aa&#039;|&#039;&#039;&#039;Sample&#039;&#039;&#039;||variable set on the same page, prior to the current question||&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;name or SGQA code]: question; value; answerList showing codes for each value||Any variable that is set on the same page and prior to the current question is shown in bold cyan text.  The tooltip shows its name (if you used INSERTANS:xxx) or SGQA code (if you used the new naming system), the actual question, and its current value (or blank if not set).  If the question type expects responses from an enumerated value set, the mapping of the codes to display values is show.&lt;br /&gt;
|-&lt;br /&gt;
|bold green text||style=&#039;color:green; background-color:#eee8aa&#039;|&#039;&#039;&#039;Sample&#039;&#039;&#039;||variable set on a prior page||&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;name or SGQA code]: question; value; answerList showing codes for each value||Any variable that is set on a prior pageis shown in bold green text.  The tooltip shows its name (if you used INSERTANS:xxx) or SGQA code (if you used the new naming system), the actual question, and its current value (or blank if not set).  If the question type expects responses from an enumerated value set, the mapping of the codes to display values is show.&lt;br /&gt;
|-&lt;br /&gt;
|bold pink text||style=&#039;color:#FF00FF; background-color:#eee8aa&#039;|&#039;&#039;&#039;Sample&#039;&#039;&#039;||variable set on a later page||&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;name or SGQA code]: question; value; answerList showing codes for each value||Any variable that is set on a prior pageis shown in bold pink text.  These are erorrs since the variable is  being used before it is declareed.  The tooltip shows its name (if you used INSERTANS:xxx) or SGQA code (if you used the new naming system), the actual question, and its current value (or blank if not set).  If the question type expects responses from an enumerated value set, the mapping of the codes to display values is show.&lt;br /&gt;
|-&lt;br /&gt;
|bold tan text||style=&#039;color:#996600; background-color:#eee8aa&#039;|&#039;&#039;&#039;Sample&#039;&#039;&#039;||a lime relacement value||the value||Lime Replacement Strings (like {TOKEN:xxx}, {PRIVACY_MESSAGE} are shown in bold tan text.  The tooltip shows the current value.&lt;br /&gt;
|-&lt;br /&gt;
|red text||style=&#039;color:red; background-color:#eee8aa&#039;|Sample||assignment operator||warning message||If you use one of the assignment operator (=) that operator will be displayed in red text.  This is meant to help prevent accidental re-assignment of values when you really meant to check whether a == b instead of  setting the value of a = b.&lt;br /&gt;
|-&lt;br /&gt;
|normal black text||style=&#039;color:black; background-color:#eee8aa&#039;|Sample||punctuation||none||All other punctuation within the expression is shown as normal black text.&lt;br /&gt;
|-&lt;br /&gt;
|red-boxed text||a bold red line surrounds the error||syntax error||description of the error||Any detected syntax errors are shown by surrounding the error with a red box.  The tooltip shows the error.  Examples include unmatched parentheses, use of undefined functions, passing the wrong number of arguments to functions, poorly structured expressions (e.g. missing operators between variables), trying to assign a new value to a read-only variable, trying to assign values to non-variables, or using unsupported syntax.  Note that the syntax error dectection system may only report one error in an expression even if there are multiple errors; however, if any errors are detected, at least one error will be shown.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Relationship to LimeSurvey Ideas / Feature Requests= &amp;lt;!--T:200--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:201--&amp;gt;&lt;br /&gt;
Expression Manager provides complete or partial solutions to each of the following:&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/1 Conditions]&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/3/ Answercounts]&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/5 Advanced reporting for assessments]&lt;br /&gt;
**partial: Equations let one store the Assessment value in the database, and micro-tailoring can generate simple formatted reports.  Authors can access those Equation values if they have more complex reporting needs.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/6 Assessment reports]&lt;br /&gt;
**partial:  Since Equations store the Assessment score, it should be possible to use Statistics to show distributions of those scores, and Quotas to limit the number of responses with those scores.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/7 Store assessment results for further evaluation]&lt;br /&gt;
**Equations let one store the Assessment value in the database, completely solving this problem&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/22/ More advanced condition rules]&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/28 Open Answertable up so that we can alter formatting]&lt;br /&gt;
**partial:  All of the question attributes are available, so authors can create custom AnswerTable equivalents as a Question.  Once implatemented, they can also use the showTheseResponses() or showAllResponsesExecpt() functions&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/37 Export survey results with full questions to include images]&lt;br /&gt;
**since Tailoring has access to the full question text, it can include images in the export&lt;br /&gt;
**if subjects choose Print Your Answers after finishing the survey, those printouts will be fully tailored&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/63 List of question codes and SGQA identifiers]&lt;br /&gt;
**The Show Survey Logic view shows that mapping (plus much more information)&lt;br /&gt;
**In addition, you no longer have to use SGQA codes to refer to variables - you can use the Question code/title.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/69 Branch/jump to another question (earlier or later) based on current question]&lt;br /&gt;
**You can use the Navigation Index for this in most cases&lt;br /&gt;
**Once implemented, you can use the JumpTo() function.  Like the Navigation Index, if you try to jump forward, it will stop on an intervening page if there are any of the relevant mandatory questions are unanswered, or if any relevant questions fail validation tests.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/86 set quota for total responses]&lt;br /&gt;
**If the final question is an Equation that flags a survey as completed (so is NULL if a respondant does not get to that page), you can use Quotas on that question to control the number of completed responses.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/101 Review all conditions]&lt;br /&gt;
**The [[Show Logic File|Show Logic File]] view shows this (and much more)&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/105 Review all questions + Review all groups]&lt;br /&gt;
**The [[Show Logic File|Show Logic File]] view shows this (and much more)&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/107 How to visualize questions, logic &amp;amp; conditions]&lt;br /&gt;
**The [[Show Logic File|Show Logic File]] view shows this (and much more)&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/113 Offline Surveys]&lt;br /&gt;
**Running a survey with all of the questions on the same page would let you do off-line data collection  (e.g. email the html page and associated JavaScript).  However, you would still want a way to submit the results so that they did not get lost.  It may be possible to use Save As HTML to save partially completed responses.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/120 Remove INSERTANS from question text at survey results]&lt;br /&gt;
**INSERTANS is no longer needed.  You can refer to a variable by its SGQA code (without prefixing it with INSERTANS:), or by its question code.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/137 Informed Consent and Authorization Functionality]&lt;br /&gt;
**You can show show the informed consent on the welcome page, then ask any additional questions needed (to ensure they meet the study inclusion/exclusion criteria), and ask them a Yes/No question whether they give their consent.  Then, make all of the remaining questions conditional on that yesNo.  For example, if the question is named &#039;&#039;consent&#039;&#039;, you would set the relevance to the remaining questions to &#039;&#039;consent == &amp;quot;Y&amp;quot;&#039;&#039; (possibly &#039;&#039;and&#039;&#039;ing that with whatever additional conditions you needed to support your branching needs.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/199 Show codes instead of of answers using INSERTANS]&lt;br /&gt;
**{Qcode} returns the code instead of the response text (which you can get via {INSERTANS:SGQA}, or {Qcode.shown}&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/204 Need group mean or calculations for assessments]&lt;br /&gt;
**Say you have N variables of which N-X were answered, you could compute the mean of the answered variables as {sum(var1, var2, ..., varN) / count(var1, var2, ..., varN)}&lt;br /&gt;
**Computing the mean across a set of respondants would require extension of the Quota functionality.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/222 To insert a language dependent text]&lt;br /&gt;
**Tailoring lets you conjugate verbs and decline nouns in each language&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/225 Surveyors should approve their answers]&lt;br /&gt;
**Custom Questions with tailoring, or the showAllResponsesExcept() function will let Surveyors see all of the questions and responses before clicking Submit. If the Navigation Menu option is enabled, it is easy to go back and correct answers.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/1.92 Suppliment to #answernnXnnXnnn method of targetting form elements]&lt;br /&gt;
**You can now refer to questions and answers by their Question Code, so there is no longer a need to modify SGQA values.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/262 More flexibility with hidden questions]&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/265 Remove specific conditions from multiple questions]&lt;br /&gt;
**You can now use Relevance, which is easier to manage than Conditions.  If  needed, they can all be exported from the database, edited in a spreadsheet, and re-imported.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/268 Cross Survey Reporting]&lt;br /&gt;
**By using question codes that are unique across your surveys and versions, you can consolidate data from multiple surveys and/or compare them&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/275 Simplifying integration with other tools]&lt;br /&gt;
**Expression Manager uses Question Codes instead of SGQA, making it easier to integrate with other tools.&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/1.92 Expose assessment score to 3rd party app processing]&lt;br /&gt;
**This can be done with Equation question type&lt;br /&gt;
*[http://ideas.limesurvey.org/ideatorrent/idea/309 Multiple thank you pages]&lt;br /&gt;
**This can be supported via conditional relevance branching and tailoring&lt;br /&gt;
&lt;br /&gt;
=Additional Reading= &amp;lt;!--T:202--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==[[Expression Manager Sample Surveys|Expression Manager Sample Surveys]]== &amp;lt;!--T:203--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==[[Expression Manager HowTos|Use Cases and HowTos]]== &amp;lt;!--T:204--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==[[Expression Manager Examples|Step-by-Step Examples]].== &amp;lt;!--T:205--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==[[Expression Manager for developers|Reference for Developers]]== &amp;lt;!--T:206--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==[[Expression Manager Roadmap|RoadMap/Status/ToDo List]]== &amp;lt;!--T:207--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Standard_for_Git_commit_messages&amp;diff=38142</id>
		<title>Standard for Git commit messages</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Standard_for_Git_commit_messages&amp;diff=38142"/>
		<updated>2013-06-10T08:53:12Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: added category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
~tc~(alias(Standard for subversion commit messages))~/tc~&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=General overview=&lt;br /&gt;
&lt;br /&gt;
This page describes the standard format of commit messages. Indeed, standard commit messages will ease the automatic generation of releases change logs.&lt;br /&gt;
&lt;br /&gt;
=Rules=&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
* Each commit message is made up of one or more commit blocks&lt;br /&gt;
* A commit block:&lt;br /&gt;
** The first line is the &#039;Commit Summary&#039; and describes the committed patch in a user friendly way&lt;br /&gt;
** the following lines begin with the Keyword &#039;&#039;&#039;Dev&#039;&#039;&#039; and are intended to the developpers team&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;Commit type&amp;gt; &amp;lt;commit description&amp;gt; &amp;lt;NEWLINE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[ Dev &amp;lt;development details&amp;gt; &amp;lt;NEWLINE&amp;gt; ]&lt;br /&gt;
&lt;br /&gt;
[ Dev &amp;lt;development details&amp;gt; &amp;lt;NEWLINE&amp;gt; ]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Commit type&amp;gt; &amp;lt;commit description&amp;gt; &amp;lt;NEWLINE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[ Dev &amp;lt;development details&amp;gt; &amp;lt;NEWLINE&amp;gt; ]&lt;br /&gt;
&lt;br /&gt;
[ Dev &amp;lt;development details&amp;gt; &amp;lt;NEWLINE&amp;gt; ]&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The commit type==&lt;br /&gt;
&lt;br /&gt;
The first word in the commit message gives the commit type:&lt;br /&gt;
* If the commit is about a fix, the commit message must begin with the keyword &#039;&#039;&#039;&#039;Fixed issue&#039;&#039;&#039;&#039;&lt;br /&gt;
* If the commit is about a change in LS feature, the commit message must begin with the keyword &#039;&#039;&#039;&#039;Updated feature&#039;&#039;&#039;&#039;&lt;br /&gt;
* If the commit is about a change in a translation, the commit message must begin with the keyword &#039;&#039;&#039;&#039;Updated translation&#039;&#039;&#039;&#039;&lt;br /&gt;
* If the commit is about a new feature, the commit message must begin with the keyword &#039;&#039;&#039;&#039;New feature&#039;&#039;&#039;&#039;&lt;br /&gt;
* If the commit is about a new translation, the commit message must begin with the keyword &#039;&#039;&#039;&#039;New translation&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==The commit description==&lt;br /&gt;
&lt;br /&gt;
Following the commit type is the commit description.&lt;br /&gt;
&lt;br /&gt;
This must be a single line (no newline character), and is intended to be used in the generated changelog.&lt;br /&gt;
&lt;br /&gt;
Ideally it is a text readable by end-users: for instance if you&#039;re resolving a bug ticket which has a very technical description, please use a &amp;quot;end-user friendly description&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==The development details==&lt;br /&gt;
&lt;br /&gt;
Develoment details are added in extra optionnal lines, each one beginning with the keyword &#039;&#039;&#039;&#039;Dev&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Patches which require multiple commits==&lt;br /&gt;
&lt;br /&gt;
When multiple commits are linked to the same topic (same new feature, same fix, ...), the &#039;Commit Summary&#039; line of subsequent commits must be the same as the one provided for the first commit.&lt;br /&gt;
&lt;br /&gt;
Of course the development details can differ.&lt;br /&gt;
&lt;br /&gt;
== Examples==&lt;br /&gt;
&lt;br /&gt;
Example of a simple language file update:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Updated translation: German&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example of a single bug which is fixed in several commits:&lt;br /&gt;
&lt;br /&gt;
Commit 1:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Fixed issue #2565: Can&#039;t access survey more than once on the same browser window&lt;br /&gt;
&lt;br /&gt;
Dev this fixes this bug for survey with tokens.&lt;br /&gt;
&lt;br /&gt;
Dev When showing a new token (different from the one in session), the previous session is destroyed.&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Commit 2:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fixed issue #2565: Can&#039;t access survey more than once on the same browser window&lt;br /&gt;
&lt;br /&gt;
Dev this fixes this bug for survey without tokens and without answer preview.&lt;br /&gt;
&lt;br /&gt;
Dev Session is destroyed at submit time.&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Commit 3:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Fixed issue #2565: Can&#039;t access survey more than once on the same browser window&lt;br /&gt;
&lt;br /&gt;
Dev this fixes this bug for survey without tokens and with answer preview.&lt;br /&gt;
&lt;br /&gt;
Dev Session is destroyed when closing the answer preview window or closing the Submit confirmation page.&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example of a single commit containing several fixes each with a Dev comment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Fixed issue #1234: fixed some untranslated strings&lt;br /&gt;
&lt;br /&gt;
Dev missing call to clang-gT in admin.php&lt;br /&gt;
&lt;br /&gt;
Fixed issue #2345: fixed a small layout issue in condition editor&lt;br /&gt;
&lt;br /&gt;
Dev fixed div HTML elements&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Coding_guidelines&amp;diff=38141</id>
		<title>Coding guidelines</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Coding_guidelines&amp;diff=38141"/>
		<updated>2013-06-10T08:52:30Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: added category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Contents:__TOC__&lt;br /&gt;
&lt;br /&gt;
=General=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This is a free development, everything you do can be useful for others. If the feature is very personal there is a way to turn it into a universal solution. This is the challenge!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;quot;The difficulty within a solution is to solve it in a simple way&amp;quot;&lt;br /&gt;
&lt;br /&gt;
(Lance Burton, magician)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some general rules:&lt;br /&gt;
*Be efficient and save resources (memory and runtime). Things might work for a small survey but also try out your new feature with a survey that has 400 question, 5 languages and 20,000 responses (Yes, there are surveys like this out there).&lt;br /&gt;
*Keep a fluid dialog with the others coders, they have their own thoughts about what you are doing.&lt;br /&gt;
*Ask if you are in doubt.&lt;br /&gt;
&lt;br /&gt;
=Naming convention=&lt;br /&gt;
*Use the Hungarian Rule for variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[t]NameOfVariable&lt;br /&gt;
&lt;br /&gt;
 | &amp;lt;strike&amp;gt;-&amp;lt;/strike&amp;gt;&amp;lt;strike&amp;gt;+&amp;lt;/strike&amp;gt;----&lt;br /&gt;
&lt;br /&gt;
 |        +--&amp;gt; Descriptive name&lt;br /&gt;
&lt;br /&gt;
 +--&amp;gt; Datatype stored (for example start with &amp;quot;a&amp;quot; if it is an array)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
aQuestionAttributes: Array to store the questions attributes, Mixed values&lt;br /&gt;
&lt;br /&gt;
dSurveyEnds: Date when the survey ends&lt;br /&gt;
&lt;br /&gt;
sContditionsOutput: String used to create the JS for conditions&lt;br /&gt;
*In case a function is declared &#039;&#039;&#039;do not&#039;&#039;&#039; use the Hungarian rule for the function name, instead use &amp;quot;Lower CamelCase&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
function questionsRetrieve( $iQID, $iSurvey)&lt;br /&gt;
*What about files? Unless Yii requires it in some way always name your files in lowercase - this prevents problems on systems using case-aware filesystems&lt;br /&gt;
&lt;br /&gt;
Here a list of prefixes:&lt;br /&gt;
*o=Object&lt;br /&gt;
*a=Array&lt;br /&gt;
*i=Integer&lt;br /&gt;
*f=Float&lt;br /&gt;
*s=String&lt;br /&gt;
&lt;br /&gt;
=Documentation=&lt;br /&gt;
&lt;br /&gt;
Please refer to this introduction: [[How to document your source code]].&lt;br /&gt;
&lt;br /&gt;
=Structures=&lt;br /&gt;
*Indent using spaces instead of TAB, or be gentle to announce how many spaces are your TABs long. There is wide ranging debate about tabs vs. spaces, many people prefer using tabs, others prefer spaces, others are happy with a mix of tabs and spaces. Because LimeSurvey is developed collaboratively, we ask that you leave your preference and follow this standard.&lt;br /&gt;
*The opening curly brace must be below the structure opening:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (condition)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   ...&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Using one line for a simple condition is very &amp;quot;fashionable&amp;quot;, a taste of &amp;quot;hacker&amp;quot;, but it is not clear at all:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 WRONG: if (condition) {do true} else {do false}&lt;br /&gt;
&lt;br /&gt;
 WRONG: if (condition) {do true}&lt;br /&gt;
&lt;br /&gt;
        else {do false}&lt;br /&gt;
&lt;br /&gt;
 RIGHT: if (condition)&lt;br /&gt;
&lt;br /&gt;
        {&lt;br /&gt;
&lt;br /&gt;
           do true&lt;br /&gt;
&lt;br /&gt;
        } else&lt;br /&gt;
&lt;br /&gt;
        {&lt;br /&gt;
&lt;br /&gt;
           do false&lt;br /&gt;
&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
 RIGHT: swith $sSelector&lt;br /&gt;
&lt;br /&gt;
        {&lt;br /&gt;
&lt;br /&gt;
              case X:&lt;br /&gt;
&lt;br /&gt;
                   ...&lt;br /&gt;
&lt;br /&gt;
                   break;&lt;br /&gt;
&lt;br /&gt;
              case Y:&lt;br /&gt;
&lt;br /&gt;
                   ...&lt;br /&gt;
&lt;br /&gt;
              default:&lt;br /&gt;
&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: It&amp;amp;acute;s true that sometimes the &amp;quot;WRONG&amp;quot; way can be useful, but if it makes the straight reading difficult, please use the &amp;quot;RIGHT&amp;quot; way instead. Be gentle with your fellow developers.&lt;br /&gt;
*SQL sentences must respect the same rule:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $sSQL = &amp;quot;SELECT field1, field2, field3 &amp;quot;&lt;br /&gt;
&lt;br /&gt;
        .&amp;quot;WHERE condition &amp;quot;&lt;br /&gt;
&lt;br /&gt;
        .&amp;quot;AND condition &amp;quot;&lt;br /&gt;
&lt;br /&gt;
        .&amp;quot;OR condition &amp;quot;&lt;br /&gt;
&lt;br /&gt;
        .&amp;quot;ORDER BY field1, field2&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*The same for HTML in views tags:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;td colspan=&#039;2&#039;&lt;br /&gt;
&lt;br /&gt;
     height=&#039;4&#039;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Some Text&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=HTML=&lt;br /&gt;
*As you will notice, a very customized HTML element can take a lot of lines (very expensive if you paid each one (:wink:) ) to avoid that, use &#039;CSS classes&#039;. In general, use classes to aesthetic related stuff: color, borders, backgrounds, font faces, sizes, etc.&lt;br /&gt;
*Respect W3C standards, and try to use the HTML understandable for all browsers. If one of them has a special feature, think if this feature is so special to break down the HTML in other browsers.&lt;br /&gt;
*Do not use PHP short tags &amp;lt;? ?&amp;gt;. Always use full PHP tags &amp;lt;?php ?&amp;gt;&lt;br /&gt;
*Any rules of the mentioned before: about CSS, well closed HTML tags and JS respect XHTML standards. Give it a try!.&lt;br /&gt;
&lt;br /&gt;
=Localization=&lt;br /&gt;
&lt;br /&gt;
Currently we are using the gT(),eT(),ngT() and neT() functions of the limesurvey_lang object for translations.&lt;br /&gt;
&lt;br /&gt;
Since LimeSurvey is available in 60 languages it is very important that your original English string (which will be picked up automatically for translation by our translators) is done right from the start. Imagine if we have to correct only one string at a later time - then 60 strings become invalid across the project and need to be re-translated by the poor translator souls.&lt;br /&gt;
* gT() is the original translation function. It will return a translated version of the string in the currently selected language. ie: echo &#039;&#039;$clang-&amp;gt;gT(&amp;quot;Hello&amp;quot;);&#039;&#039;&lt;br /&gt;
* ngT() returns multiple translations of a sentence or phrase for which alternate plural forms may apply. ie: &#039;&#039;echo sprintf($clang-&amp;gt;ngT(&#039;Please select at least %s answer&#039;,&#039;Please select at least %s answers&#039;,iMinimumAnswers),$iMinimumAnswers)&#039;&#039;;&lt;br /&gt;
* eT() echos the translation directly. (ie: instead of &#039;&#039;echo $clang-&amp;gt;gT(&amp;quot;Hello&amp;quot;);&#039;&#039; you can use &#039;&#039;$clang-&amp;gt;eT(&amp;quot;Hello&amp;quot;);&#039;&#039;&lt;br /&gt;
* neT() echos the multiple translations of the sentence or phrase for which alternate plural forms may apply directly.&lt;br /&gt;
&lt;br /&gt;
Please follow these important rules:&lt;br /&gt;
*&#039;&#039;&#039;Do not embed margin spaces&#039;&#039;&#039; in your translation. Instead use proper CSS formatting&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;Wrong&amp;lt;/span&amp;gt;: $clang-&amp;gt;eT(&#039;Visible? &#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&#039;color:#060&#039;&amp;gt;Right&amp;lt;/span&amp;gt;: $clang-&amp;gt;eT(&#039;Visible?&#039;);&lt;br /&gt;
*&#039;&#039;&#039;Do not capitalize words&#039;&#039;&#039; except where grammatically correct (like at the beginning of a sentence or for a brand name). LimeSurvey is not a newspaper.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;Wrong&amp;lt;/span&amp;gt;: $clang-&amp;gt;eT(&#039;Create A New Label Set&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&#039;color:#060&#039;&amp;gt;Right&amp;lt;/span&amp;gt;: $clang-&amp;gt;eT(&#039;Create a new label set&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;Wrong&amp;lt;/span&amp;gt;: $clang-&amp;gt;eT(&#039;Google Maps API Key&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&#039;color:#060&#039;&amp;gt;Right&amp;lt;/span&amp;gt;: $clang-&amp;gt;eT(&#039;Google Maps API key&#039;);&lt;br /&gt;
*&#039;&#039;&#039;Do not concatenate&#039;&#039;&#039; several translations to form a sentence or concatenate to an additional information (like a number or string). Instead use the sprint() or sprintf() function with placeholders.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;Wrong&amp;lt;/span&amp;gt;: echo $clang-&amp;gt;gT(&#039;The sum must not be bigger than&#039;).$iMaxSum;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&#039;color:#060&#039;&amp;gt;Right&amp;lt;/span&amp;gt;: echo sprintf($clang-&amp;gt;gT(&#039;The sum must not be bigger than %s&#039;),$iMaxSum);&lt;br /&gt;
&lt;br /&gt;
This comes from the problem that in other languages the setting of a sentence can be much different and the information $iMaxSum from the example above might be needed in the middle of the sentence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;Wrong&amp;lt;/span&amp;gt;: echo $clang-&amp;gt;gT(&#039;The user&#039;).$sUsername.$clang-&amp;gt;gT(&#039;was deleted.&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&#039;color:#060&#039;&amp;gt;Right&amp;lt;/span&amp;gt;: echo sprintf($clang-&amp;gt;gT(&#039;The user %s was deleted.&#039;),$sUsername);&lt;br /&gt;
*&#039;&#039;&#039;Use the n*T functions where applicable&#039;&#039;&#039;. These functions show a different translation depending the number of items. Currently LimeSurvey only supports the numbers/situations 1 and &amp;gt;1.&lt;br /&gt;
&lt;br /&gt;
+Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;Wrong&amp;lt;/span&amp;gt;: echo sprintf($clang-&amp;gt;gT(&#039;Please select at least %s answer(s).&#039;),$iMinimumAnswers);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&#039;color:#060&#039;&amp;gt;Right&amp;lt;/span&amp;gt;: echo sprintf($clang-&amp;gt;ngT(&#039;Please select at least %s answer&#039;,&#039;Please select at least %s answers&#039;,iMinimumAnswers),$iMinimumAnswers);&lt;br /&gt;
&lt;br /&gt;
=Bug tracker=&lt;br /&gt;
#First consider if the reported issue is really a bug. If it is a feature request please point the reporter to http://ideas.limesurvey.org and set the issue status to &#039;Closed&#039;.&lt;br /&gt;
#If you would like to work on a bug assign it to yourself.&lt;br /&gt;
#Try to reproduce the issue.&lt;br /&gt;
##If you cannot reproduce ask the user to provide a small example survey to demonstrate the issue. Then set the issue to &#039;Feedback&#039;. After the user added the necessary information it will automatically be set to &#039;Assigned&#039; again.&lt;br /&gt;
##If the user does not responds for more than a week ask once again for feedback by adding a comment. After a further week without feedback close the issue.&lt;br /&gt;
#After you resolved the issue set the status to resolved AND provide the &#039;Fixed in version&#039; information.&lt;br /&gt;
#After you committed your fix add a comment to the resolved issue &#039;Fixed in rev. &amp;lt;Subversion revision number&amp;gt;&#039;&lt;br /&gt;
#After a release the release technician will set all issues to &#039;Closed&#039; that were fixed for this release. That signals to the reporter that a fix is available in the version and it was just released.&lt;br /&gt;
&lt;br /&gt;
=Cross-DB compatibility=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey targets several database types it can run on: MySQL, Postgres and Microsoft SQL Server. This demands certain precautions when coding&lt;br /&gt;
&lt;br /&gt;
==Parameter binding==&lt;br /&gt;
&lt;br /&gt;
Yii/PDO supports parameter binding - use it. Don&#039;t inject variables directly into the query or into conditions because this might create a security issue.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
$oResult = Yii::app()-&amp;gt;db&lt;br /&gt;
&lt;br /&gt;
                    -&amp;gt;createCommand()&lt;br /&gt;
&lt;br /&gt;
                    -&amp;gt;select(&#039;somefield&#039;)&lt;br /&gt;
&lt;br /&gt;
                    -&amp;gt;where(&amp;quot;sid = :sid&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
                    -&amp;gt;from(&#039;{{sometable}}&#039;)&lt;br /&gt;
&lt;br /&gt;
                    -&amp;gt;bindParam(&amp;quot;:sid&amp;quot;, $surveyid, PDO::PARAM_INT);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you bind the same value several times do NOT use the same parameter name, instead use a different named parameter for each bind:&lt;br /&gt;
&lt;br /&gt;
WRONG:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
$oResult = Yii::app()-&amp;gt;db&lt;br /&gt;
&lt;br /&gt;
                    -&amp;gt;createCommand()&lt;br /&gt;
&lt;br /&gt;
                    -&amp;gt;select(&#039;somefield&#039;)&lt;br /&gt;
&lt;br /&gt;
                    -&amp;gt;where(&amp;quot;sid = :sid and parent_sid= :sid &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
                    -&amp;gt;from(&#039;{{sometable}}&#039;)&lt;br /&gt;
&lt;br /&gt;
                    -&amp;gt;bindParam(&amp;quot;:sid&amp;quot;, $surveyid, PDO::PARAM_INT);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RIGHT:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
$oResult = Yii::app()-&amp;gt;db&lt;br /&gt;
&lt;br /&gt;
                    -&amp;gt;createCommand()&lt;br /&gt;
&lt;br /&gt;
                    -&amp;gt;select(&#039;somefield&#039;)&lt;br /&gt;
&lt;br /&gt;
                    -&amp;gt;where(&amp;quot;sid = :sid1 and parent_sid= :sid2 &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
                    -&amp;gt;from(&#039;{{sometable}}&#039;)&lt;br /&gt;
&lt;br /&gt;
                    -&amp;gt;bindParam(&amp;quot;:sid1&amp;quot;, $surveyid, PDO::PARAM_INT)&lt;br /&gt;
&lt;br /&gt;
                    -&amp;gt;bindParam(&amp;quot;:sid2&amp;quot;, $surveyid, PDO::PARAM_INT);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Miscellaneous=&lt;br /&gt;
*Do not use &amp;quot;global&amp;quot; to access to a declared variable in another process. Pass variables or arrays by reference, use the session or the configuration object.&lt;br /&gt;
*If using an auxiliary variable makes clear the code or process, just do it. If you are coding a very complex expression, calling to functions with parameters that are other functions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
WRONG:&lt;br /&gt;
&lt;br /&gt;
iAResult= fa(fb(p1,p2),fc(fd(p3),p4),p5)&lt;br /&gt;
&lt;br /&gt;
It will be more readable:&lt;br /&gt;
&lt;br /&gt;
iAuxB = fb(p1,p2)&lt;br /&gt;
&lt;br /&gt;
iAuxD = fd(p3)&lt;br /&gt;
&lt;br /&gt;
iAuxC = fc(iAuxD,p4)&lt;br /&gt;
&lt;br /&gt;
iAResult = fa(iAuxB, iAuxC, p5)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Anyway, if you are in doubt about someone missing the point or you are afraid that your expression is obscure, take the chance of writing it in a more simple way, even if that involves the use of one or more auxiliary variables.&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=ExpressionScript_for_developers&amp;diff=25904</id>
		<title>ExpressionScript for developers</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=ExpressionScript_for_developers&amp;diff=25904"/>
		<updated>2013-05-17T08:32:51Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: restructured text, make it more readable&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
This wiki page is meant for the LimeSurvey development team and others wishing to contribute to LimeSurvey.  It provides details about how to work with, test, and extend Expression Manager (EM).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note, this document is currently incomplete.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Started==&lt;br /&gt;
&lt;br /&gt;
The best way to get started with EM is to:&lt;br /&gt;
*Install [http://www.limesurvey.org/en/download LimeSurvey 1.92]&lt;br /&gt;
*Load and play with the Expression Manager demos (located in /docs/demosurveys of the distribution)&lt;br /&gt;
*Navigate through all of the test cases&lt;br /&gt;
**Select a survey, click Tools, then Expression Manager&lt;br /&gt;
*Read the documentation&lt;br /&gt;
**Main user documentation for [[Expression Manager|Expression Manager]]&lt;br /&gt;
**Expression Manager [[Expression Manager HowTos|How Tos]]&lt;br /&gt;
&lt;br /&gt;
==EM Source Code Organization and Purpose==&lt;br /&gt;
=== ExpressionManager (EM) ===&lt;br /&gt;
&lt;br /&gt;
Implements a [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser] in PHP and JavaScript which let you create variables and securely expose a specified set of pre-defined functions.&lt;br /&gt;
&lt;br /&gt;
==== Location ==== &lt;br /&gt;
&lt;br /&gt;
* Version 1.92:  /classes/expressions/ExpressionManager.php&lt;br /&gt;
* Version 2.0:  /application/helpers/expressions/em_core_helper.php&lt;br /&gt;
&lt;br /&gt;
==== Recursive Descent Parser (all variables and functions starting with &#039;&#039;RDP_&#039;&#039;) ====&lt;br /&gt;
&lt;br /&gt;
* This is the core of EM, a compiler which builds and evaluates the parse tree for the expression&lt;br /&gt;
* Unless you are an expert in compiler theory, you should not touch the RDP_ code.&lt;br /&gt;
&lt;br /&gt;
==== API Functions to the RDP ====&lt;br /&gt;
&lt;br /&gt;
* RegisterFunctions - an interface to add external functions to EM&lt;br /&gt;
* sProcessStringContainingExpressions() - splits string on expressions, evaluates each, then joins together the parts&lt;br /&gt;
* ProcessBooleanExpression() - evaluates whether an equation (not surrounded by curly braces) is true&lt;br /&gt;
* Get*() - returns information about the most recently processed expressions&lt;br /&gt;
&lt;br /&gt;
=== LimeExpressionManager (LEM) ===&lt;br /&gt;
&lt;br /&gt;
This centralizes the integration of LimeSurvey with EM&lt;br /&gt;
&lt;br /&gt;
==== Location ====&lt;br /&gt;
* Version 1.92:  /classes/expressions/LimeExpressionManager.php&lt;br /&gt;
* Version 2.0:  /application/helpers/expressions/em_manager_helper.php&lt;br /&gt;
&lt;br /&gt;
==== Navigation Functions ====&lt;br /&gt;
These process the current responses, update the database, find the next relevant set of questions, and create the metadata needed to render those questions&lt;br /&gt;
&lt;br /&gt;
* NavigateForwards()&lt;br /&gt;
* NavigateBackwards()&lt;br /&gt;
* JumpTo()&lt;br /&gt;
* GetLastMoveResult()&lt;br /&gt;
&lt;br /&gt;
==== Initialization Functions ====&lt;br /&gt;
&lt;br /&gt;
* StartSurvey() - initializes the survey, setting all variable mappings&lt;br /&gt;
* setVariableAndTokenMappingsForExpressionManager() - post-processes CreateFieldMap() to create metadata needed for all variables and token values&lt;br /&gt;
* _CreateSubQLevelRelevanceAndValidationEquations() - processes advanced question attributes such as array_filter, min_answers, and min_value&lt;br /&gt;
* ProcessAllNeededRelevance() - computes the relevance results (and JavaScript) for all applicable questions&lt;br /&gt;
* _ProcessGroupRelevance() - computes the relevance of a group based upon its own relevance criteria and the status of the questions it contains.&lt;br /&gt;
&lt;br /&gt;
==== Functions to Generate Tailored Content ====&lt;br /&gt;
* StartProcessingPage() - called at beginning of each page&lt;br /&gt;
* StartProcessingGroup() - called for each group on a page&lt;br /&gt;
* FinishProcessingGroup() - collects all tailoring for this group so can render appropriate JavaScript&lt;br /&gt;
* FinishProcessingPage() - completes the EM-related processing, and serializes LEM into $_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;LEMsingleton&#039;]&lt;br /&gt;
* GetRelevanceAndTailoringJavaScript() - collects all relevance, validation, and tailoring logic and generates ExprMgr_process_relevance_and_tailoring() JavaScript function&lt;br /&gt;
&lt;br /&gt;
==== Response Management ====&lt;br /&gt;
*ProcessCurrentResponses() - validates and processes the $_POSTed responses&lt;br /&gt;
*_UpdateValuesInDatabase() - saves values to database, including NULLing irrelevant values&lt;br /&gt;
&lt;br /&gt;
==== Caching ====&lt;br /&gt;
LEM tries to avoid calling the Initialization functions each page, storing state in $_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;LEMsingleton&#039;]&lt;br /&gt;
* SetDirtyFlag() - when called, tells LEM to force a rebuild of the Initialization functions (e.g. of admin has added/removed/updated any questions, groups, conditions, or defaults)&lt;br /&gt;
* SetSurveyId()- calls SetDirtyFlag if the user wants to work with a different survey from the one that is cached&lt;br /&gt;
* SetEMLanguage() - calls SetDirtyFlag() if the user starts  to use a language different from the cached one&lt;br /&gt;
&lt;br /&gt;
==== Validation Functions ====&lt;br /&gt;
* _ValidateSurvey() - validates the entire survey by calling _ValidateGroup()&lt;br /&gt;
* _ValidatGroup() - validates a group and returns its status by calling _ValidateQuestion() on all of its questions&lt;br /&gt;
* _ValidateQuestion() - validates a question, determining whether it is relevant, hidden, or fails any validation and/or mandatory criteria&lt;br /&gt;
&lt;br /&gt;
===EM-related JavaScript===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92: /classes/expressions/em_javascript.js&lt;br /&gt;
**Version 2.0: /scripts/admin/expressions/em_javascript.js&lt;br /&gt;
*Purpose - contains all of the custom javascript needed for EM&lt;br /&gt;
====JavaScript equivalents of PHP functions====&lt;br /&gt;
About 20 functions from phpjs.org&lt;br /&gt;
====Core Functions====&lt;br /&gt;
*LEManyNA() - checks whether any of the variables are irrelevant&lt;br /&gt;
*LEMval() - retrieves the value for any variable, or its metadata (via the dot notation syntax)&lt;br /&gt;
*LEMsetTabIndexes() - ensures that the tab sequence will act as expected even if input elements change visibility.&lt;br /&gt;
===EM-related Test Cases===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92: /classes/expressions/test/*.php&lt;br /&gt;
**Version 2.0:  /application/views/admin/expressions/*&lt;br /&gt;
*Purpose&lt;br /&gt;
**&#039;&#039;&#039;Available Functions&#039;&#039;&#039; - runs EM::ShowAllowableFunctions to display functions and syntax from EM-&amp;gt;RDP_ValidFunctions&lt;br /&gt;
**&#039;&#039;&#039;String Splitter&#039;&#039;&#039; - runs EM::UnitTestStringSplitter() to show how it parses strings with curly braces&lt;br /&gt;
**&#039;&#039;&#039;Tokenizer&#039;&#039;&#039; - runs EM::UnitTestTokenizer() to show how EM detects and categorizes tokens (e.g. variables, string, functions, operators)&lt;br /&gt;
**&#039;&#039;&#039;Unit Tests of Isolated Expressions&#039;&#039;&#039; - runs EM::UnitTestEvaluator() for unit tests of each of Expression Manager&#039;s features (e.g. all operators and functions). Color coding shows whether any tests fail. Syntax highlighting shows cases where Expression Manager properly detects bad syntax.&lt;br /&gt;
**&#039;&#039;&#039;Unit Tests of Expressions Within Strings&#039;&#039;&#039; - runs LEM::UnitTestProcessStringContainingExpressions() to show how Expression Manager can process strings containing one or more variable, token, or expression replacements surrounded by curly braces.&lt;br /&gt;
**&#039;&#039;&#039;Unit Test Dynamic Relevance Processing&#039;&#039;&#039; - runs LEM::UnitTestRelevance() to show how questions and substitutions should dynamically change based upon values entered.&lt;br /&gt;
**&#039;&#039;&#039;Preview Conversion of Conditions to Relevance&#039;&#039;&#039; - runs LEM::UnitTestConvertConditionsToRelevance() to show relevance equations for all conditions in the database, grouped by question id&lt;br /&gt;
**&#039;&#039;&#039;Bulk Convert Conditions to Relevance&#039;&#039;&#039; - actually performs the conversion, saving the generated relevance  equations (while retaining the original conditions)&lt;br /&gt;
**&#039;&#039;&#039;Test Navigation&#039;&#039;&#039; - unit tests LEM::NavigateForwards() for the selected survey, generating the following information based upon the selected debugging options:&lt;br /&gt;
***Detailed Timing - shows low-level timing information for each part of EM (e.g. to examine duration of database calls)&lt;br /&gt;
***Validation Summary - shows one line per group and question, showing its relevance equation, and indicating whether it was irrelevant, hidden, mandatory and/or failed validation criteria.  Also shows the generated SQL per navigation step to update the database&lt;br /&gt;
***Validation Detail - shows extra details per question, including&lt;br /&gt;
****Validation Tip, Equation, JavaScript equivalent of the Equation&lt;br /&gt;
****Lists of sub-questions; which are relevant; and which are unanswered&lt;br /&gt;
****List of array filters applied, by sub-question&lt;br /&gt;
***Pretty Print Syntax - syntax highlights all of the equations so that you can see errors, and also click on variable names to jump to those questions and edit them.&lt;br /&gt;
**&#039;&#039;&#039;Show Survey Logic File&#039;&#039;&#039; - generates the logic file which is available via the &amp;quot;QA&amp;quot; buttons in the admin console.&lt;br /&gt;
&lt;br /&gt;
==How EM Works==&lt;br /&gt;
&lt;br /&gt;
===What is an Expression?===&lt;br /&gt;
&lt;br /&gt;
Anything surrounded by curly braces is an Expression, with two exceptions:&lt;br /&gt;
If there is whitespace after the opening brace or before the closing brace, it is ignored.&lt;br /&gt;
*This is so that EM can ignore embedded JavaScript.&lt;br /&gt;
*So, if you have JavaScript that might be parsed by EM, make sure to add a space or newline  after the opening brace.&lt;br /&gt;
#Escaped curly braces are ignored (e.g. &amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;\{&#039;&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;\}&#039;&#039;&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Note that EM does support Expressions within strings.  Moreover, Expressions can contain nested strings, but not nested expressions.  So, the following red sections are valid Expressions and will cause substitions to occur within the containing strings.&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{Q1}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{if(Q1==&amp;quot;Y&amp;quot;,&#039;yes&#039;,&#039;no&#039;)}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{if(Q1==&amp;quot;Y&amp;quot;,&#039;single quote with {nested braces}&#039;,&amp;quot;double quote with {nested braces}&amp;quot;)}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===What does EM do with text containing expressions?===&lt;br /&gt;
#A regular expression divides the source line into STRING and EXPRESSION tokens&lt;br /&gt;
#Each EXPRESSION is parsed by ExpressionManager, a [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser].&lt;br /&gt;
##If there are syntax errors, EM returns an HTML string that syntax-highlights the equation and puts red-lined boxes around syntax errors&lt;br /&gt;
##If there are no syntax errors, EM returns the result of evaluating the expression&lt;br /&gt;
#EM re-joins the STRING and EM-evaluated EXPRESSION parts.&lt;br /&gt;
#EM optionally appends the translation activity to structures used by GetRelevanceAndTailoringJavaScript()&lt;br /&gt;
&lt;br /&gt;
===How can we be sure that EM accurately parses the equations?===&lt;br /&gt;
&lt;br /&gt;
EM was originally written in 1999-2000 by Dr. Tom White (TMSWhite) for a different project (Dialogix) in Java, using [http://en.wikipedia.org/wiki/JavaCC JavaCC], an open source compiler compiler (parser generator).  That Java-based project has been in production for over a decade, and has been fully vetted for unit and integration tests.&lt;br /&gt;
&lt;br /&gt;
Since there is no production-grade parser generator for PHP and JavaScript (although [http://www.antlr.org/ Antlr] is coming close), TMSWhite created a custom [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser] for LimeSurvey.  To ensure its accuracy, EM&#039;s logic is based upon the JavaCC source code for Dialogix.  The JavaCC syntax mirrors the functionality needed for a recursive descent parser.  JavaCC happens to build a state-based compiler, which is a little more efficient than a recusive descent parser.  However, state-based compilers are impossible to read, understand,  or expand without JavaCC-like source code, so it did not make sense to try to port the JavaCC output directly to PHP.&lt;br /&gt;
&lt;br /&gt;
Futhermore, there are comprehensive unit and integration test suites for EM. These make it easy to validate the accuracy of the EM system.  Each test suite includes dozens to hundreds of test cases, and it is trivial to add addition test cases.&lt;br /&gt;
&lt;br /&gt;
===How does the Recursive Descent Parser work?===&lt;br /&gt;
&lt;br /&gt;
EM must do the following:&lt;br /&gt;
#Tokenize the expression - separating strings, words (variable names vs. functions), and punctuation; and categorizing the types of each.&lt;br /&gt;
#Analyze the tokens to build a parse tree, checking for syntax errors along the way.&lt;br /&gt;
#Return the result of evaluating the expression (using PHP) (or return syntax-highlighted HTML if there are syntax errors).&lt;br /&gt;
#Create a safe JavaScript equivalent of the expression so that expressions can be  dynamically re-computed client-side.&lt;br /&gt;
#Determine which variables are used in each expression (so can make sure they are available client-side).&lt;br /&gt;
&lt;br /&gt;
===How does EM integrate into LimeSurvey?===&lt;br /&gt;
&lt;br /&gt;
The LimeExpressionManager (LEM) class manages the integration of EM into LimeSurvey.  LEM must:&lt;br /&gt;
#Initialize all of the variables needed by LimeSurvey (e.g. for TOKENS, INSERTANS, and templatereplace())&lt;br /&gt;
#Know which Group and Question are being processed&lt;br /&gt;
#Record the results and metadata about all of the text that LimeSurvey asks it to process&lt;br /&gt;
#Output static HTML that reflects the results of that processing&lt;br /&gt;
#Output JavaScript that lets those results be dynamically re-computed if values on the page change.&lt;br /&gt;
&lt;br /&gt;
==Extending EM==&lt;br /&gt;
&lt;br /&gt;
=== Adding Functions ===&lt;br /&gt;
&lt;br /&gt;
When you add a function that does not exist in PHP, then add it to the body of &#039;&#039;&#039;em_core_helper.php&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;FIXME&#039;&#039;:  Eventually we should separate out such add-on functions into their own php file.&lt;br /&gt;
&lt;br /&gt;
Functions are stored in LimeExpressionManager::amValidFunctions[]. Some existing examples are:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=PHP&amp;gt;&lt;br /&gt;
&#039;abs&#039; =&amp;gt; array(&#039;abs&#039;, &#039;Math.abs&#039;, &#039;Absolute value&#039;, &#039;number abs(number)&#039;, &#039;http://www.php.net/manual/en/function.checkdate.php&#039;, 1),&lt;br /&gt;
&#039;if&#039; =&amp;gt; array(&#039;exprmgr_if&#039;, &#039;LEMif&#039;, &#039;Excel-style if(test,result_if_true,result_if_false)&#039;, &#039;if(test,result_if_true,result_if_false)&#039;, &#039;&#039;, 3),&lt;br /&gt;
&#039;max&#039; =&amp;gt; array(&#039;max&#039;, &#039;Math.max&#039;, &#039;Find highest value&#039;, &#039;number max(arg1, arg2, ... argN)&#039;, &#039;http://www.php.net/manual/en/function.max.php&#039;, -2),&lt;br /&gt;
&#039;substr&#039; =&amp;gt; array(&#039;substr&#039;, &#039;substr&#039;, &#039;Return part of a string&#039;, &#039;string substr(string, start &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, length])&#039;, &#039;http://www.php.net/manual/en/function.substr.php&#039;, 2,3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The syntax for each function is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=PHP&amp;gt;&lt;br /&gt;
function =&amp;gt; array( detail_1, detail_2, detail_3, detail_4, detail_5, detail_6 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;details&#039;&#039; which must be included in the array are:&lt;br /&gt;
&lt;br /&gt;
# PHP function name - this is the PHP function that will be called for that func.&lt;br /&gt;
# JavaScript function name - this is the JavaScript function that will be called for that function&lt;br /&gt;
# Meaning - this is a short description of what the function does&lt;br /&gt;
# Syntax - this shows the valid syntax for the function&lt;br /&gt;
# Reference - this is an optional URL showing more details about the syntax (e.g. a link to the PHP documentation)&lt;br /&gt;
# Number of required arguments&lt;br /&gt;
#* Multiple values are allowed at the end of the array.  For example, substr() above can take 2 or 3 arguments&lt;br /&gt;
#* Negative values mean that the function accepts a variable number of arguments&lt;br /&gt;
#* Negative values less than -1 mean that the function requires at least abs(N)-1 arguments (so -2 means it requires at least 1 argument)&lt;br /&gt;
&lt;br /&gt;
If you add a function that does not exist in JavaScript, then add it to the body of &#039;&#039;&#039;em_javascript.js&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Adding Test Cases===&lt;br /&gt;
&lt;br /&gt;
Please do!  The testing frameworks are solid. You just need to add more tests following the examples in the code.&lt;br /&gt;
&lt;br /&gt;
Make sure to add Unit tests for new functions to UnitTestEvaluator&lt;br /&gt;
&lt;br /&gt;
* Syntax is ExpectedResult~Expression, such as:&lt;br /&gt;
* 212~5 + max(1,(2+3),(4 + (5 + 6)),[[]],[[7 + 8) + 9),( (10 + 11), 12),(13 + (14 * 15) - 16) )&lt;br /&gt;
&lt;br /&gt;
When your test case should return an error, use NULL as the expected value, like this:&lt;br /&gt;
&lt;br /&gt;
* NULL~four * / seven&lt;br /&gt;
* NULL~(5 + 7) = 8&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=How_to_document_your_source_code&amp;diff=25891</id>
		<title>How to document your source code</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=How_to_document_your_source_code&amp;diff=25891"/>
		<updated>2013-05-17T08:27:16Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: reformatted&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
You can see the current LimeSurvey source code documentation on http://api.limesurvey.org&lt;br /&gt;
&lt;br /&gt;
This documentation is created on an hourly base by phpDocumentor.&lt;br /&gt;
&lt;br /&gt;
The LimeSurvey project is using [http://www.phpdoc.org/ phpDocumentor] to easily create source code documentation. phpDocumentor is an easy way to markup your source-code with specially formatted comments and let the software phpDocumentor afterwards extract this information about your classes/methods/function/variable and show it as a nice documentation.&lt;br /&gt;
&lt;br /&gt;
==phpDocumentor Quick-Start==&lt;br /&gt;
&lt;br /&gt;
However, the work to create the comments comes first. So here is how it works:&lt;br /&gt;
#Go to [http://2tbsp.com/content/phpdoc_cheatsheet,_because_documenting_code_fun! 2tbsp.com] and download the PHPDoc cheatsheet in your preferred format.&lt;br /&gt;
#Print it out as a poster and pin it to your wall above your PC monitor.&lt;br /&gt;
#Since the knowledge is not magically transferred from the cheatsheet to your brain, here is the short form instruction to give you a &#039;head&#039; start (:biggrin:):&lt;br /&gt;
A PHPDoc comment always starts with /** (slash and two asterisks), every following line inside the comment has to start with an * (asterisk), and it is close with */ (single asterisk and slash), like this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
* Global variable declaration docBlock&lt;br /&gt;
* @global integer $GLOBALS[&#039;_myvar&#039;]&lt;br /&gt;
* @name $_myvar&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*A PHPDoc comment has always to &#039;&#039;&#039;precede&#039;&#039;&#039; the code it is made for (except for the File comment, which documents the file itself and cannot be placed outside the PHP tags)&lt;br /&gt;
*Inside the comment you can use the phpDocumentor tags as described on the cheat sheet. A typical PHPDoc comment for a function would look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
* CleanLanguagesFromSurvey() removes any languages from survey tables that are not in the passed list&lt;br /&gt;
* Please use carefully as the data is permanently deleted&lt;br /&gt;
*&lt;br /&gt;
* @param string $sid - the currently selected survey&lt;br /&gt;
* @param string $availlangs - space separated list of additional languages in survey (IANA code)&lt;br /&gt;
* @global string $connect- the database connection object&lt;br /&gt;
* @return bool - always returns true&lt;br /&gt;
*&lt;br /&gt;
* @since 1.5.0.1642 (2007-01-02)&lt;br /&gt;
* @author David Olivier&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
function CleanLanguagesFromSurvey($sid, $availlangs)&lt;br /&gt;
{&lt;br /&gt;
   global $connect;&lt;br /&gt;
   $sid=sanitize_int($sid);&lt;br /&gt;
   $baselang = GetBaseLanguageFromSurveyID($sid);&lt;br /&gt;
       [....]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example code block demonstrates nicely how it is done:&lt;br /&gt;
* First thing in the comment is a natural description of the functions purpose. Be as descriptive as possible. You can use several lines of description.&lt;br /&gt;
* The &#039;&#039;&#039;@param&#039;&#039;&#039; tags are describing the parameters of the function in the form &#039;@param datatype variablename  description&#039;&lt;br /&gt;
* &#039;&#039;&#039;@global&#039;&#039;&#039; describes any global variable used in the function - same form as the @param tag&lt;br /&gt;
* &#039;&#039;&#039;@return&#039;&#039;&#039; describes the value the function returns&lt;br /&gt;
* &#039;&#039;&#039;@since&#039;&#039;&#039; is an optional parameter - it documents when a function was first added to the code - please name at least the subversion build number&lt;br /&gt;
* &#039;&#039;&#039;@author&#039;&#039;&#039; is pretty self-explaining&lt;br /&gt;
&lt;br /&gt;
That&#039;s it. The examples on the cheat sheet for the File, Class, and Variable documentation are self-explaining.&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
&lt;br /&gt;
==Errors on documentation generation==&lt;br /&gt;
&lt;br /&gt;
When phpDocumentor is creating the documentation it might stumble over errors in the source code documentation you wrote. All errors generated by the last documentation run can be seen on http://api.limesurvey.org/errors.html .&lt;br /&gt;
&lt;br /&gt;
Be sure to visit this page regularly to check if your documentation is parsing right.&lt;br /&gt;
&lt;br /&gt;
Still if you have comments or questions do not hesitate to contact [[UserPage c_schmitz|me]] or change this document accordingly.&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Development_overview&amp;diff=25854</id>
		<title>Development overview</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Development_overview&amp;diff=25854"/>
		<updated>2013-05-17T08:06:02Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: added category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Table of contents:&lt;br /&gt;
&lt;br /&gt;
*[[LimeSurvey roadmap]]&lt;br /&gt;
*[[The LimeSurvey project team]]&lt;br /&gt;
*[[How to join the LimeSurvey project team]]&lt;br /&gt;
**[[How to become a LimeSurvey Developer]]&lt;br /&gt;
*[[Accessing the source code]]&lt;br /&gt;
**[[Switch from Subversion to Git]]&lt;br /&gt;
*[[Coding guidelines]]&lt;br /&gt;
*[[How to document your source code]]&lt;br /&gt;
*[[Standard for Git commit messages]]&lt;br /&gt;
*[[Updating FCKEditor]]&lt;br /&gt;
*[[Release process]]&lt;br /&gt;
*[[Help us: Tasks]]&lt;br /&gt;
*[[How can I support LimeSurvey?]]&lt;br /&gt;
*[[Developer user pages]]&lt;br /&gt;
**[[UserPage c_schmitz]]&lt;br /&gt;
**[[UserPage jcleeland]]&lt;br /&gt;
**[[UserPage kadejo]]&lt;br /&gt;
**[[UserPage Mazi]]&lt;br /&gt;
**[[UserPage Shnoulle]]&lt;br /&gt;
**[[UserPage magiclko]]&lt;br /&gt;
***[[SurveyPress]]&lt;br /&gt;
*[[How to contribute new features]]&lt;br /&gt;
*[[Database versioning]]&lt;br /&gt;
*[[The bugtracker and git]]&lt;br /&gt;
*[[Plugin system architecture]]&lt;br /&gt;
**[[Question plugins]]&lt;br /&gt;
***[[Creating a question plugin]]&lt;br /&gt;
****[[Question signature]]&lt;br /&gt;
**[[Defining attributes]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=25853</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=25853"/>
		<updated>2013-05-17T08:02:15Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: added category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of Limesurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC version 1 specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
==get_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure:  for protocol-level errors (invalid format etc), an error message.  For invalid username and password, returns a null error and the result body contains a &#039;status&#039; name-value pair with the error message.&lt;br /&gt;
&lt;br /&gt;
==release_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
==get_site_settings==&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
==add_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==import_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
==get_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|properties not allowed to be modified|| Properties not allowed to be modified when survey active&lt;br /&gt;
|-&lt;br /&gt;
|sid||anonymized&lt;br /&gt;
|-&lt;br /&gt;
|language||datestamp&lt;br /&gt;
|-&lt;br /&gt;
|additional_languages||savetimings&lt;br /&gt;
|-&lt;br /&gt;
|active||ipaddr&lt;br /&gt;
|-&lt;br /&gt;
|||refurl&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_surveys==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==activate_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==export_statistics==&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==get_summary==&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||tokens_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==add_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==delete_survey_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
==get_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
==add_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
==import_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
==get_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_groups==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==delete_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
==import_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
==get_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_questions==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
Activate tokens&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
surveyid (string) The survey ID&lt;br /&gt;
&lt;br /&gt;
additional_attributes (array of integers) Any additional attribute fields to create. Just give the attribute IDs&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) status OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
&lt;br /&gt;
==add_participants==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a token key is automatically created. Please note that this function does not check for duplicate content in any of the fields, except for token keys created by the function itself.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sessionkey (string) - The session key&lt;br /&gt;
*surveyID (string) - The survey id&lt;br /&gt;
*participantData (array) -  2-dimensional array/structure containing your participants data&lt;br /&gt;
*createTokenKey (boolean) - Set this to true if you want a token key create automatically for each entry - if your participant data included a [token] field it will be overwritten&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success:  participant data (struct) -  structure containing your participants data plus the token ID and (if applicable) the new token&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
&lt;br /&gt;
JSON-RPC example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;method&amp;quot;:&amp;quot;add_participants&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;sessionkey&amp;quot;:&amp;quot;73e8rx864rnxmk64gp67bah44u2igivm&amp;quot;,&amp;quot;surveyID&amp;quot;:&amp;quot;668138&amp;quot;,&amp;quot;participantData&amp;quot;:[{&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;}]}}&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;id&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;result&amp;quot;:[{&amp;quot;email&amp;quot;:&amp;quot;me@example.com&amp;quot;,&amp;quot;lastname&amp;quot;:&amp;quot;Bond&amp;quot;,&amp;quot;firstname&amp;quot;:&amp;quot;James&amp;quot;,&amp;quot;tid&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;token&amp;quot;:&amp;quot;auc82gar58dpcg6&amp;quot;}],&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==delete_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
==get_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|tid||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_participants==&lt;br /&gt;
&lt;br /&gt;
RPC routine to return the IDs and info of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
   sSessionKey (string) -  Auth credentials&lt;br /&gt;
   iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
   iStart (int) - Start id of the token list&lt;br /&gt;
   iLimit (int) - Number of participants to return&lt;br /&gt;
   bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
   aAttributes(bool|array) An array of extended attributes that can be requested, besides the default ones (default value to false)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
==invite_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==remind_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==add_response==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new responses to your survey response table.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sSessionKey (string) - The session key&lt;br /&gt;
*iSurveyID (integer) - The survey id&lt;br /&gt;
*aResponseData (array) -  array/structure containing your response data&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: response_id (integer) -  Returns the id of the inserted survey response&lt;br /&gt;
*On failure: (array) with error description&lt;br /&gt;
&lt;br /&gt;
==export_responses==&lt;br /&gt;
&lt;br /&gt;
Export response data to pdf,csv,xls,doc&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (int) - Id of the Survey&lt;br /&gt;
&lt;br /&gt;
DocumentType (string) - pdf,csv,xls,doc&lt;br /&gt;
&lt;br /&gt;
sLanguageCode (string) - Optional The language to be used - if not given then the base language will be used&lt;br /&gt;
&lt;br /&gt;
CompletionStatus (string) - Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; selection of responses - defaults to complete&lt;br /&gt;
&lt;br /&gt;
HeadingType (string) - &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039;. type of question heading. Optional defaults to &#039;code&#039;&lt;br /&gt;
&lt;br /&gt;
ResponseType (string) - &#039;short&#039; or &#039;long&#039; response type.Optional defaults to &#039;short&#039;&lt;br /&gt;
&lt;br /&gt;
FromResponse (int) - Optional start number of response&lt;br /&gt;
&lt;br /&gt;
ToResponse (int) - Optional end number of responses&lt;br /&gt;
&lt;br /&gt;
Return:&lt;br /&gt;
&lt;br /&gt;
On success: Requested file as base 64-encoded string.&lt;br /&gt;
&lt;br /&gt;
On failure: Array with error information&lt;br /&gt;
&lt;br /&gt;
Note: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=Ruby Example=&lt;br /&gt;
&lt;br /&gt;
==Load Requirements and Declare Values==&lt;br /&gt;
You will first need to require the dependencies needed to establish communication with the API. Also, note that there is a username and password field that requires to be stored in plain text. I have a separate API User within my Limesurvey to handle these calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require &#039;net/https&#039;&lt;br /&gt;
require &#039;uri&#039;&lt;br /&gt;
require &#039;json&#039;&lt;br /&gt;
&lt;br /&gt;
username = &amp;quot;api_user&amp;quot;&lt;br /&gt;
password = &amp;quot;api_user&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module==&lt;br /&gt;
&lt;br /&gt;
The below code is used to define the module Limesurvey. Within this module is an API class. We will use this to create an instance of this module and then call on the API call wherever needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
module Limesurvey&lt;br /&gt;
  class API&lt;br /&gt;
    def initialize(service_url)&lt;br /&gt;
      @uri = URI.parse(service_url)&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def method_missing(name, *args)&lt;br /&gt;
      post_body = { &#039;method&#039; =&amp;gt; name, &#039;params&#039; =&amp;gt; args, &#039;id&#039; =&amp;gt; &#039;jsonrpc&#039; }.to_json&lt;br /&gt;
      resp = JSON.parse( http_post_request(post_body) )&lt;br /&gt;
      raise JSONRPCError, resp[&#039;error&#039;] if resp[&#039;error&#039;]&lt;br /&gt;
      resp[&#039;result&#039;]&lt;br /&gt;
    end&lt;br /&gt;
   &lt;br /&gt;
    def http_post_request(post_body)&lt;br /&gt;
      http    = Net::HTTP.new(@uri.host, @uri.port)&lt;br /&gt;
      request = Net::HTTP::Post.new(@uri.request_uri)&lt;br /&gt;
      request.content_type = &#039;application/json&#039;&lt;br /&gt;
      request.body = post_body&lt;br /&gt;
      http.request(request).body&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class JSONRPCError &amp;lt; RuntimeError; end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==API Call==&lt;br /&gt;
This code is used to create the instance of the Limesurvey::API module and class. You will want to change the URL to that of your RemoteControl2 URL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
survey = Limesurvey::API.new(&#039;http://localhost/limesurvey/index.php?r=admin/remotecontrol&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This example takes the above code and puts it into play. I create a new session with the RemoteControl2 API and store the session in the variable session_key. You will want to change the ID numbers to the appropriate Survey ID in the examples.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
system(&amp;quot;cls&amp;quot;)&lt;br /&gt;
session_key = survey.get_session_key(username,password)&lt;br /&gt;
puts &amp;quot;Session Key: #{session_key}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
response = survey.get_survey_properties(session_key, &amp;quot;863224&amp;quot;, [&amp;quot;owner_id&amp;quot;])&lt;br /&gt;
puts &amp;quot;Properties:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.list_surveys(sSessionKey: session_key, sUser: &amp;quot;dkimura&amp;quot;)&lt;br /&gt;
puts &amp;quot;Survey List:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.add_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;,&lt;br /&gt;
    [email:&amp;quot;james.bond@example.com&amp;quot;,lastname:&amp;quot;Bond&amp;quot;,firstname:&amp;quot;James&amp;quot;]&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Add Participant:  #{response}&amp;quot;&lt;br /&gt;
puts &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
response = survey.invite_participants(&lt;br /&gt;
    session_key, &lt;br /&gt;
    &amp;quot;863224&amp;quot;&lt;br /&gt;
  )&lt;br /&gt;
puts &amp;quot;Invite Participant:  #{response}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example Return==&lt;br /&gt;
&lt;br /&gt;
From the above example, here is the return that I receive. Some of the items are returned as a hash and some items returned as an array of hashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
Session Key: piadscbc94vyanxwkdy8f3xii4av2b2w&lt;br /&gt;
&lt;br /&gt;
Properties:  {&amp;quot;owner_id&amp;quot;=&amp;gt;&amp;quot;1&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Survey List:  [{&amp;quot;sid&amp;quot;=&amp;gt;&amp;quot;863224&amp;quot;, &amp;quot;surveyls_title&amp;quot;=&amp;gt;&amp;quot;Statement of Work v0.12&amp;quot;, &amp;quot;startdate&amp;quot;=&amp;gt;nil, &amp;quot;expires&amp;quot;=&amp;gt;nil, &amp;quot;active&amp;quot;=&amp;gt;&amp;quot;Y&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Add Participant:  [{&amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;lastname&amp;quot;=&amp;gt;&amp;quot;Bond&amp;quot;, &amp;quot;firstname&amp;quot;=&amp;gt;&amp;quot;James&amp;quot;, &amp;quot;tid&amp;quot;=&amp;gt;&amp;quot;7&amp;quot;, &amp;quot;token&amp;quot;=&amp;gt;&amp;quot;pt5ztzxndibkz4j&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
Invite Participant:  {&amp;quot;7&amp;quot;=&amp;gt;{&amp;quot;name&amp;quot;=&amp;gt;&amp;quot;James Bond&amp;quot;, &amp;quot;email&amp;quot;=&amp;gt;&amp;quot;james.bond@example.com&amp;quot;, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;OK&amp;quot;}, &amp;quot;status&amp;quot;=&amp;gt;&amp;quot;0 left to send&amp;quot;}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application based on the tiny jsonRPCClient from [http://jsonrpcphp.org/ | jsonrpcphp.org]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
&lt;br /&gt;
$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=JSON-RPC notes=&lt;br /&gt;
&lt;br /&gt;
The content-type of the HTTP request must be application/json.  Most formatting errors or a failure to set the content-type header will result in a null response from the server (not a JSON response).  Below is an example of a valid request and response pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Request:&lt;br /&gt;
&lt;br /&gt;
 HTTP headers:&lt;br /&gt;
&lt;br /&gt;
   content-type=application/json&lt;br /&gt;
&lt;br /&gt;
   connection=Keep-Alive&lt;br /&gt;
&lt;br /&gt;
   host=mylimesurveyhost.com&lt;br /&gt;
&lt;br /&gt;
   content-length=65&lt;br /&gt;
&lt;br /&gt;
   user-agent=Apache-HttpClient/4.2.2 (java 1.5)&lt;br /&gt;
&lt;br /&gt;
 Post body:&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;method&amp;quot;:&amp;quot;get_session_key&amp;quot;,&amp;quot;params&amp;quot;:{&amp;quot;username&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;},&amp;quot;id&amp;quot;:1}&lt;br /&gt;
&lt;br /&gt;
Response body:&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;id&amp;quot;:1,&amp;quot;result&amp;quot;:&amp;quot;6htqat38fyr4v7iu72nqgv7xgavkvfcz&amp;quot;,&amp;quot;error&amp;quot;:null}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Changes=&lt;br /&gt;
&lt;br /&gt;
2.0a Only three functions are supported right now: getSessionKey, releaseSessionKey, deleteSurvey&lt;br /&gt;
&lt;br /&gt;
2.0b Added function add_participants&lt;br /&gt;
&lt;br /&gt;
2.0RC5 Added import_survey, activate_survey, activate_tokens&lt;br /&gt;
&lt;br /&gt;
2.0 (build 121030) Added subquestions, attributes, attributes_lang and answeroptions properties for get_question_properties&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=ExpressionScript_for_developers&amp;diff=25852</id>
		<title>ExpressionScript for developers</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=ExpressionScript_for_developers&amp;diff=25852"/>
		<updated>2013-05-17T08:01:22Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: added category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
This wiki page is meant for the LimeSurvey development team and others wishing to contribute to LimeSurvey.  It provides details about how to work with, test, and extend Expression Manager (EM).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note, this document is currently incomplete.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Started==&lt;br /&gt;
&lt;br /&gt;
The best way to get started with EM is to:&lt;br /&gt;
*Install [http://www.limesurvey.org/en/download LimeSurvey 1.92]&lt;br /&gt;
*Load and play with the Expression Manager demos (located in /docs/demosurveys of the distribution)&lt;br /&gt;
*Navigate through all of the test cases&lt;br /&gt;
**Select a survey, click Tools, then Expression Manager&lt;br /&gt;
*Read the documentation&lt;br /&gt;
**Main user documentation for [[Expression Manager|Expression Manager]]&lt;br /&gt;
**Expression Manager [[Expression Manager HowTos|How Tos]]&lt;br /&gt;
&lt;br /&gt;
==EM Source Code Organization and Purpose==&lt;br /&gt;
=== ExpressionManager (EM) ===&lt;br /&gt;
&lt;br /&gt;
Implements a [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser] in PHP and JavaScript which let you create variables and securely expose a specified set of pre-defined functions.&lt;br /&gt;
&lt;br /&gt;
==== Location ==== &lt;br /&gt;
&lt;br /&gt;
* Version 1.92:  /classes/expressions/ExpressionManager.php&lt;br /&gt;
* Version 2.0:  /application/helpers/expressions/em_core_helper.php&lt;br /&gt;
&lt;br /&gt;
==== Recursive Descent Parser (all variables and functions starting with &#039;&#039;RDP_&#039;&#039;) ====&lt;br /&gt;
&lt;br /&gt;
* This is the core of EM, a compiler which builds and evaluates the parse tree for the expression&lt;br /&gt;
* Unless you are an expert in compiler theory, you should not touch the RDP_ code.&lt;br /&gt;
&lt;br /&gt;
==== API Functions to the RDP ====&lt;br /&gt;
&lt;br /&gt;
* RegisterFunctions - an interface to add external functions to EM&lt;br /&gt;
* sProcessStringContainingExpressions() - splits string on expressions, evaluates each, then joins together the parts&lt;br /&gt;
* ProcessBooleanExpression() - evaluates whether an equation (not surrounded by curly braces) is true&lt;br /&gt;
* Get*() - returns information about the most recently processed expressions&lt;br /&gt;
&lt;br /&gt;
=== LimeExpressionManager (LEM) ===&lt;br /&gt;
&lt;br /&gt;
This centralizes the integration of LimeSurvey with EM&lt;br /&gt;
&lt;br /&gt;
==== Location ====&lt;br /&gt;
* Version 1.92:  /classes/expressions/LimeExpressionManager.php&lt;br /&gt;
* Version 2.0:  /application/helpers/expressions/em_manager_helper.php&lt;br /&gt;
&lt;br /&gt;
==== Navigation Functions ====&lt;br /&gt;
These process the current responses, update the database, find the next relevant set of questions, and create the metadata needed to render those questions&lt;br /&gt;
&lt;br /&gt;
* NavigateForwards()&lt;br /&gt;
* NavigateBackwards()&lt;br /&gt;
* JumpTo()&lt;br /&gt;
* GetLastMoveResult()&lt;br /&gt;
&lt;br /&gt;
==== Initialization Functions ====&lt;br /&gt;
&lt;br /&gt;
* StartSurvey() - initializes the survey, setting all variable mappings&lt;br /&gt;
* setVariableAndTokenMappingsForExpressionManager() - post-processes CreateFieldMap() to create metadata needed for all variables and token values&lt;br /&gt;
* _CreateSubQLevelRelevanceAndValidationEquations() - processes advanced question attributes such as array_filter, min_answers, and min_value&lt;br /&gt;
* ProcessAllNeededRelevance() - computes the relevance results (and JavaScript) for all applicable questions&lt;br /&gt;
* _ProcessGroupRelevance() - computes the relevance of a group based upon its own relevance criteria and the status of the questions it contains.&lt;br /&gt;
&lt;br /&gt;
==== Functions to Generate Tailored Content ====&lt;br /&gt;
* StartProcessingPage() - called at beginning of each page&lt;br /&gt;
* StartProcessingGroup() - called for each group on a page&lt;br /&gt;
* FinishProcessingGroup() - collects all tailoring for this group so can render appropriate JavaScript&lt;br /&gt;
* FinishProcessingPage() - completes the EM-related processing, and serializes LEM into $_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;LEMsingleton&#039;]&lt;br /&gt;
* GetRelevanceAndTailoringJavaScript() - collects all relevance, validation, and tailoring logic and generates ExprMgr_process_relevance_and_tailoring() JavaScript function&lt;br /&gt;
&lt;br /&gt;
==== Response Management ====&lt;br /&gt;
*ProcessCurrentResponses() - validates and processes the $_POSTed responses&lt;br /&gt;
*_UpdateValuesInDatabase() - saves values to database, including NULLing irrelevant values&lt;br /&gt;
&lt;br /&gt;
==== Caching ====&lt;br /&gt;
LEM tries to avoid calling the Initialization functions each page, storing state in $_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;LEMsingleton&#039;]&lt;br /&gt;
* SetDirtyFlag() - when called, tells LEM to force a rebuild of the Initialization functions (e.g. of admin has added/removed/updated any questions, groups, conditions, or defaults)&lt;br /&gt;
* SetSurveyId()- calls SetDirtyFlag if the user wants to work with a different survey from the one that is cached&lt;br /&gt;
* SetEMLanguage() - calls SetDirtyFlag() if the user starts  to use a language different from the cached one&lt;br /&gt;
&lt;br /&gt;
==== Validation Functions ====&lt;br /&gt;
* _ValidateSurvey() - validates the entire survey by calling _ValidateGroup()&lt;br /&gt;
* _ValidatGroup() - validates a group and returns its status by calling _ValidateQuestion() on all of its questions&lt;br /&gt;
* _ValidateQuestion() - validates a question, determining whether it is relevant, hidden, or fails any validation and/or mandatory criteria&lt;br /&gt;
&lt;br /&gt;
===EM-related JavaScript===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92: /classes/expressions/em_javascript.js&lt;br /&gt;
**Version 2.0: /scripts/admin/expressions/em_javascript.js&lt;br /&gt;
*Purpose - contains all of the custom javascript needed for EM&lt;br /&gt;
====JavaScript equivalents of PHP functions====&lt;br /&gt;
About 20 functions from phpjs.org&lt;br /&gt;
====Core Functions====&lt;br /&gt;
*LEManyNA() - checks whether any of the variables are irrelevant&lt;br /&gt;
*LEMval() - retrieves the value for any variable, or its metadata (via the dot notation syntax)&lt;br /&gt;
*LEMsetTabIndexes() - ensures that the tab sequence will act as expected even if input elements change visibility.&lt;br /&gt;
===EM-related Test Cases===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92: /classes/expressions/test/*.php&lt;br /&gt;
**Version 2.0:  /application/views/admin/expressions/*&lt;br /&gt;
*Purpose&lt;br /&gt;
**&#039;&#039;&#039;Available Functions&#039;&#039;&#039; - runs EM::ShowAllowableFunctions to display functions and syntax from EM-&amp;gt;RDP_ValidFunctions&lt;br /&gt;
**&#039;&#039;&#039;String Splitter&#039;&#039;&#039; - runs EM::UnitTestStringSplitter() to show how it parses strings with curly braces&lt;br /&gt;
**&#039;&#039;&#039;Tokenizer&#039;&#039;&#039; - runs EM::UnitTestTokenizer() to show how EM detects and categorizes tokens (e.g. variables, string, functions, operators)&lt;br /&gt;
**&#039;&#039;&#039;Unit Tests of Isolated Expressions&#039;&#039;&#039; - runs EM::UnitTestEvaluator() for unit tests of each of Expression Manager&#039;s features (e.g. all operators and functions). Color coding shows whether any tests fail. Syntax highlighting shows cases where Expression Manager properly detects bad syntax.&lt;br /&gt;
**&#039;&#039;&#039;Unit Tests of Expressions Within Strings&#039;&#039;&#039; - runs LEM::UnitTestProcessStringContainingExpressions() to show how Expression Manager can process strings containing one or more variable, token, or expression replacements surrounded by curly braces.&lt;br /&gt;
**&#039;&#039;&#039;Unit Test Dynamic Relevance Processing&#039;&#039;&#039; - runs LEM::UnitTestRelevance() to show how questions and substitutions should dynamically change based upon values entered.&lt;br /&gt;
**&#039;&#039;&#039;Preview Conversion of Conditions to Relevance&#039;&#039;&#039; - runs LEM::UnitTestConvertConditionsToRelevance() to show relevance equations for all conditions in the database, grouped by question id&lt;br /&gt;
**&#039;&#039;&#039;Bulk Convert Conditions to Relevance&#039;&#039;&#039; - actually performs the conversion, saving the generated relevance  equations (while retaining the original conditions)&lt;br /&gt;
**&#039;&#039;&#039;Test Navigation&#039;&#039;&#039; - unit tests LEM::NavigateForwards() for the selected survey, generating the following information based upon the selected debugging options:&lt;br /&gt;
***Detailed Timing - shows low-level timing information for each part of EM (e.g. to examine duration of database calls)&lt;br /&gt;
***Validation Summary - shows one line per group and question, showing its relevance equation, and indicating whether it was irrelevant, hidden, mandatory and/or failed validation criteria.  Also shows the generated SQL per navigation step to update the database&lt;br /&gt;
***Validation Detail - shows extra details per question, including&lt;br /&gt;
****Validation Tip, Equation, JavaScript equivalent of the Equation&lt;br /&gt;
****Lists of sub-questions; which are relevant; and which are unanswered&lt;br /&gt;
****List of array filters applied, by sub-question&lt;br /&gt;
***Pretty Print Syntax - syntax highlights all of the equations so that you can see errors, and also click on variable names to jump to those questions and edit them.&lt;br /&gt;
**&#039;&#039;&#039;Show Survey Logic File&#039;&#039;&#039; - generates the logic file which is available via the &amp;quot;QA&amp;quot; buttons in the admin console.&lt;br /&gt;
&lt;br /&gt;
==How EM Works==&lt;br /&gt;
&lt;br /&gt;
===What is an Expression?===&lt;br /&gt;
&lt;br /&gt;
Anything surrounded by curly braces is an Expression, with two exceptions:&lt;br /&gt;
If there is whitespace after the opening brace or before the closing brace, it is ignored.&lt;br /&gt;
*This is so that EM can ignore embedded JavaScript.&lt;br /&gt;
*So, if you have JavaScript that might be parsed by EM, make sure to add a space or newline  after the opening brace.&lt;br /&gt;
#Escaped curly braces are ignored (e.g. &amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;\{&#039;&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;\}&#039;&#039;&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Note that EM does support Expressions within strings.  Moreover, Expressions can contain nested strings, but not nested expressions.  So, the following red sections are valid Expressions and will cause substitions to occur within the containing strings.&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{Q1}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{if(Q1==&amp;quot;Y&amp;quot;,&#039;yes&#039;,&#039;no&#039;)}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{if(Q1==&amp;quot;Y&amp;quot;,&#039;single quote with {nested braces}&#039;,&amp;quot;double quote with {nested braces}&amp;quot;)}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===What does EM do with text containing expressions?===&lt;br /&gt;
#A regular expression divides the source line into STRING and EXPRESSION tokens&lt;br /&gt;
#Each EXPRESSION is parsed by ExpressionManager, a [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser].&lt;br /&gt;
##If there are syntax errors, EM returns an HTML string that syntax-highlights the equation and puts red-lined boxes around syntax errors&lt;br /&gt;
##If there are no syntax errors, EM returns the result of evaluating the expression&lt;br /&gt;
#EM re-joins the STRING and EM-evaluated EXPRESSION parts.&lt;br /&gt;
#EM optionally appends the translation activity to structures used by GetRelevanceAndTailoringJavaScript()&lt;br /&gt;
&lt;br /&gt;
===How can we be sure that EM accurately parses the equations?===&lt;br /&gt;
&lt;br /&gt;
EM was originally written in 1999-2000 by Dr. Tom White (TMSWhite) for a different project (Dialogix) in Java, using [http://en.wikipedia.org/wiki/JavaCC JavaCC], an open source compiler compiler (parser generator).  That Java-based project has been in production for over a decade, and has been fully vetted for unit and integration tests.&lt;br /&gt;
&lt;br /&gt;
Since there is no production-grade parser generator for PHP and JavaScript (although [http://www.antlr.org/ Antlr] is coming close), TMSWhite created a custom [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser] for LimeSurvey.  To ensure its accuracy, EM&#039;s logic is based upon the JavaCC source code for Dialogix.  The JavaCC syntax mirrors the functionality needed for a recursive descent parser.  JavaCC happens to build a state-based compiler, which is a little more efficient than a recusive descent parser.  However, state-based compilers are impossible to read, understand,  or expand without JavaCC-like source code, so it did not make sense to try to port the JavaCC output directly to PHP.&lt;br /&gt;
&lt;br /&gt;
Futhermore, there are comprehensive unit and integration test suites for EM. These make it easy to validate the accuracy of the EM system.  Each test suite includes dozens to hundreds of test cases, and it is trivial to add addition test cases.&lt;br /&gt;
&lt;br /&gt;
===How does the Recursive Descent Parser work?===&lt;br /&gt;
&lt;br /&gt;
EM must do the following:&lt;br /&gt;
#Tokenize the expression - separating strings, words (variable names vs. functions), and punctuation; and categorizing the types of each.&lt;br /&gt;
#Analyze the tokens to build a parse tree, checking for syntax errors along the way.&lt;br /&gt;
#Return the result of evaluating the expression (using PHP) (or return syntax-highlighted HTML if there are syntax errors).&lt;br /&gt;
#Create a safe JavaScript equivalent of the expression so that expressions can be  dynamically re-computed client-side.&lt;br /&gt;
#Determine which variables are used in each expression (so can make sure they are available client-side).&lt;br /&gt;
&lt;br /&gt;
===How does EM integrate into LimeSurvey?===&lt;br /&gt;
&lt;br /&gt;
The LimeExpressionManager (LEM) class manages the integration of EM into LimeSurvey.  LEM must:&lt;br /&gt;
#Initialize all of the variables needed by LimeSurvey (e.g. for TOKENS, INSERTANS, and templatereplace())&lt;br /&gt;
#Know which Group and Question are being processed&lt;br /&gt;
#Record the results and metadata about all of the text that LimeSurvey asks it to process&lt;br /&gt;
#Output static HTML that reflects the results of that processing&lt;br /&gt;
#Output JavaScript that lets those results be dynamically re-computed if values on the page change.&lt;br /&gt;
&lt;br /&gt;
==Extending EM==&lt;br /&gt;
&lt;br /&gt;
===Adding Test Cases===&lt;br /&gt;
&lt;br /&gt;
Please do!  The testing frameworks are solid. You just need to add more tests following the examples in the code.&lt;br /&gt;
&lt;br /&gt;
=== Adding Functions ===&lt;br /&gt;
&lt;br /&gt;
When you add a function that does not exist in PHP, then add it to the body of &#039;&#039;&#039;em_core_helper.php&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;FIXME&#039;&#039;:  Eventually we should separate out such add-on functions into their own php file.&lt;br /&gt;
&lt;br /&gt;
Functions are stored in LimeExpressionManager::amValidFunctions[]. Some existing examples are:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=PHP&amp;gt;&lt;br /&gt;
&#039;abs&#039; =&amp;gt; array(&#039;abs&#039;, &#039;Math.abs&#039;, &#039;Absolute value&#039;, &#039;number abs(number)&#039;, &#039;http://www.php.net/manual/en/function.checkdate.php&#039;, 1),&lt;br /&gt;
&#039;if&#039; =&amp;gt; array(&#039;exprmgr_if&#039;, &#039;LEMif&#039;, &#039;Excel-style if(test,result_if_true,result_if_false)&#039;, &#039;if(test,result_if_true,result_if_false)&#039;, &#039;&#039;, 3),&lt;br /&gt;
&#039;max&#039; =&amp;gt; array(&#039;max&#039;, &#039;Math.max&#039;, &#039;Find highest value&#039;, &#039;number max(arg1, arg2, ... argN)&#039;, &#039;http://www.php.net/manual/en/function.max.php&#039;, -2),&lt;br /&gt;
&#039;substr&#039; =&amp;gt; array(&#039;substr&#039;, &#039;substr&#039;, &#039;Return part of a string&#039;, &#039;string substr(string, start &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, length])&#039;, &#039;http://www.php.net/manual/en/function.substr.php&#039;, 2,3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The syntax for each function is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=PHP&amp;gt;&lt;br /&gt;
function =&amp;gt; array( detail_1, detail_2, detail_3, detail_4, detail_5, detail_6 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;details&#039;&#039; which must be included in the array are:&lt;br /&gt;
&lt;br /&gt;
# PHP function name - this is the PHP function that will be called for that func.&lt;br /&gt;
# JavaScript function name - this is the JavaScript function that will be called for that function&lt;br /&gt;
# Meaning - this is a short description of what the function does&lt;br /&gt;
# Syntax - this shows the valid syntax for the function&lt;br /&gt;
# Reference - this is an optional URL showing more details about the syntax (e.g. a link to the PHP documentation)&lt;br /&gt;
# Number of required arguments&lt;br /&gt;
#* Multiple values are allowed at the end of the array.  For example, substr() above can take 2 or 3 arguments&lt;br /&gt;
#* Negative values mean that the function accepts a variable number of arguments&lt;br /&gt;
#* Negative values less than -1 mean that the function requires at least abs(N)-1 arguments (so -2 means it requires at least 1 argument)&lt;br /&gt;
&lt;br /&gt;
If you add a function that does not exist in JavaScript, then add it to the body of &#039;&#039;&#039;em_javascript.js&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Make sure to add Unit tests for new functions to UnitTestEvaluator&lt;br /&gt;
&lt;br /&gt;
* Syntax is ExpectedResult~Expression, such as:&lt;br /&gt;
* 212~5 + max(1,(2+3),(4 + (5 + 6)),[[]],[[7 + 8) + 9),( (10 + 11), 12),(13 + (14 * 15) - 16) )&lt;br /&gt;
&lt;br /&gt;
When your test case should return an error, use NULL as the expected value, like this:&lt;br /&gt;
&lt;br /&gt;
* NULL~four * / seven&lt;br /&gt;
* NULL~(5 + 7) = 8&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Plugins_-_advanced&amp;diff=25851</id>
		<title>Plugins - advanced</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Plugins_-_advanced&amp;diff=25851"/>
		<updated>2013-05-17T08:00:45Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: Improved markup, added category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Starting from Limesurvey 2.05, Limesurvey will officially support plugins.&lt;br /&gt;
&lt;br /&gt;
Plugins allow users to customize the functionality of their installation while still being able to benefit from regular software updates.&lt;br /&gt;
&lt;br /&gt;
This documentation is meant for developers that are extending Limesurvey for their own use or for their clients; end users will not be helped by this documentation.&lt;br /&gt;
&lt;br /&gt;
Plugins must implement the [https://github.com/LimeSurvey/LimeSurvey/blob/2.05/application/libraries/PluginManager/iPlugin.php iPlugin] interface. We recommend&lt;br /&gt;
&lt;br /&gt;
extending your plugin class from the [https://github.com/LimeSurvey/LimeSurvey/blob/2.05/application/libraries/PluginManager/PluginBase.php PluginBase] class.&lt;br /&gt;
&lt;br /&gt;
By extending you benefit from common functionality required by plugins that we already have implemented for you. One of these function is the implementation of the getPluginSettings function. This function must return an array describing the configuration options for the user.&lt;br /&gt;
&lt;br /&gt;
The example plugin exposes just 1 configurable setting, the message it&#039;ll show.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
protected $settings = array(&lt;br /&gt;
    &#039;logo&#039; =&amp;gt; array(&lt;br /&gt;
          &#039;type&#039; =&amp;gt; &#039;logo&#039;,&lt;br /&gt;
          &#039;path&#039; =&amp;gt; &#039;assets/logo.png&#039;&lt;br /&gt;
     ),&lt;br /&gt;
&lt;br /&gt;
     &#039;message&#039; =&amp;gt; array(&lt;br /&gt;
          &#039;type&#039; =&amp;gt; &#039;string&#039;,&lt;br /&gt;
          &#039;label&#039; =&amp;gt; &#039;Message&#039;&lt;br /&gt;
     )&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The array contains a name for each setting as a key. The values are arrays containing the required meta data.&lt;br /&gt;
&lt;br /&gt;
Supported types are:&lt;br /&gt;
&lt;br /&gt;
* logo&lt;br /&gt;
* string&lt;br /&gt;
* html&lt;br /&gt;
* choice&lt;br /&gt;
* relevance&lt;br /&gt;
&lt;br /&gt;
Besides type a number of other keys are available:&lt;br /&gt;
&lt;br /&gt;
* label, defines a label (use English, the label specified here will be passed through the translation functions)&lt;br /&gt;
* default, defines a value to show if no value is specified.&lt;br /&gt;
* current, defines the current value.&lt;br /&gt;
* readOnly, specifies the setting is read only.&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=ExpressionScript_for_developers&amp;diff=25848</id>
		<title>ExpressionScript for developers</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=ExpressionScript_for_developers&amp;diff=25848"/>
		<updated>2013-05-17T07:47:27Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: restructured text, make it more readable&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
This wiki page is meant for the LimeSurvey development team and others wishing to contribute to LimeSurvey.  It provides details about how to work with, test, and extend Expression Manager (EM).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note, this document is currently incomplete.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Started==&lt;br /&gt;
&lt;br /&gt;
The best way to get started with EM is to:&lt;br /&gt;
*Install [http://www.limesurvey.org/en/download LimeSurvey 1.92]&lt;br /&gt;
*Load and play with the Expression Manager demos (located in /docs/demosurveys of the distribution)&lt;br /&gt;
*Navigate through all of the test cases&lt;br /&gt;
**Select a survey, click Tools, then Expression Manager&lt;br /&gt;
*Read the documentation&lt;br /&gt;
**Main user documentation for [[Expression Manager|Expression Manager]]&lt;br /&gt;
**Expression Manager [[Expression Manager HowTos|How Tos]]&lt;br /&gt;
&lt;br /&gt;
==EM Source Code Organization and Purpose==&lt;br /&gt;
=== ExpressionManager (EM) ===&lt;br /&gt;
&lt;br /&gt;
Implements a [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser] in PHP and JavaScript which let you create variables and securely expose a specified set of pre-defined functions.&lt;br /&gt;
&lt;br /&gt;
==== Location ==== &lt;br /&gt;
&lt;br /&gt;
* Version 1.92:  /classes/expressions/ExpressionManager.php&lt;br /&gt;
* Version 2.0:  /application/helpers/expressions/em_core_helper.php&lt;br /&gt;
&lt;br /&gt;
==== Recursive Descent Parser (all variables and functions starting with &#039;&#039;RDP_&#039;&#039;) ====&lt;br /&gt;
&lt;br /&gt;
* This is the core of EM, a compiler which builds and evaluates the parse tree for the expression&lt;br /&gt;
* Unless you are an expert in compiler theory, you should not touch the RDP_ code.&lt;br /&gt;
&lt;br /&gt;
==== API Functions to the RDP ====&lt;br /&gt;
&lt;br /&gt;
* RegisterFunctions - an interface to add external functions to EM&lt;br /&gt;
* sProcessStringContainingExpressions() - splits string on expressions, evaluates each, then joins together the parts&lt;br /&gt;
* ProcessBooleanExpression() - evaluates whether an equation (not surrounded by curly braces) is true&lt;br /&gt;
* Get*() - returns information about the most recently processed expressions&lt;br /&gt;
&lt;br /&gt;
=== LimeExpressionManager (LEM) ===&lt;br /&gt;
&lt;br /&gt;
This centralizes the integration of LimeSurvey with EM&lt;br /&gt;
&lt;br /&gt;
==== Location ====&lt;br /&gt;
* Version 1.92:  /classes/expressions/LimeExpressionManager.php&lt;br /&gt;
* Version 2.0:  /application/helpers/expressions/em_manager_helper.php&lt;br /&gt;
&lt;br /&gt;
==== Navigation Functions ====&lt;br /&gt;
These process the current responses, update the database, find the next relevant set of questions, and create the metadata needed to render those questions&lt;br /&gt;
&lt;br /&gt;
* NavigateForwards()&lt;br /&gt;
* NavigateBackwards()&lt;br /&gt;
* JumpTo()&lt;br /&gt;
* GetLastMoveResult()&lt;br /&gt;
&lt;br /&gt;
==== Initialization Functions ====&lt;br /&gt;
&lt;br /&gt;
* StartSurvey() - initializes the survey, setting all variable mappings&lt;br /&gt;
* setVariableAndTokenMappingsForExpressionManager() - post-processes CreateFieldMap() to create metadata needed for all variables and token values&lt;br /&gt;
* _CreateSubQLevelRelevanceAndValidationEquations() - processes advanced question attributes such as array_filter, min_answers, and min_value&lt;br /&gt;
* ProcessAllNeededRelevance() - computes the relevance results (and JavaScript) for all applicable questions&lt;br /&gt;
* _ProcessGroupRelevance() - computes the relevance of a group based upon its own relevance criteria and the status of the questions it contains.&lt;br /&gt;
&lt;br /&gt;
==== Functions to Generate Tailored Content ====&lt;br /&gt;
* StartProcessingPage() - called at beginning of each page&lt;br /&gt;
* StartProcessingGroup() - called for each group on a page&lt;br /&gt;
* FinishProcessingGroup() - collects all tailoring for this group so can render appropriate JavaScript&lt;br /&gt;
* FinishProcessingPage() - completes the EM-related processing, and serializes LEM into $_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;LEMsingleton&#039;]&lt;br /&gt;
* GetRelevanceAndTailoringJavaScript() - collects all relevance, validation, and tailoring logic and generates ExprMgr_process_relevance_and_tailoring() JavaScript function&lt;br /&gt;
&lt;br /&gt;
==== Response Management ====&lt;br /&gt;
*ProcessCurrentResponses() - validates and processes the $_POSTed responses&lt;br /&gt;
*_UpdateValuesInDatabase() - saves values to database, including NULLing irrelevant values&lt;br /&gt;
&lt;br /&gt;
==== Caching ====&lt;br /&gt;
LEM tries to avoid calling the Initialization functions each page, storing state in $_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;LEMsingleton&#039;]&lt;br /&gt;
* SetDirtyFlag() - when called, tells LEM to force a rebuild of the Initialization functions (e.g. of admin has added/removed/updated any questions, groups, conditions, or defaults)&lt;br /&gt;
* SetSurveyId()- calls SetDirtyFlag if the user wants to work with a different survey from the one that is cached&lt;br /&gt;
* SetEMLanguage() - calls SetDirtyFlag() if the user starts  to use a language different from the cached one&lt;br /&gt;
&lt;br /&gt;
==== Validation Functions ====&lt;br /&gt;
* _ValidateSurvey() - validates the entire survey by calling _ValidateGroup()&lt;br /&gt;
* _ValidatGroup() - validates a group and returns its status by calling _ValidateQuestion() on all of its questions&lt;br /&gt;
* _ValidateQuestion() - validates a question, determining whether it is relevant, hidden, or fails any validation and/or mandatory criteria&lt;br /&gt;
&lt;br /&gt;
===EM-related JavaScript===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92: /classes/expressions/em_javascript.js&lt;br /&gt;
**Version 2.0: /scripts/admin/expressions/em_javascript.js&lt;br /&gt;
*Purpose - contains all of the custom javascript needed for EM&lt;br /&gt;
====JavaScript equivalents of PHP functions====&lt;br /&gt;
About 20 functions from phpjs.org&lt;br /&gt;
====Core Functions====&lt;br /&gt;
*LEManyNA() - checks whether any of the variables are irrelevant&lt;br /&gt;
*LEMval() - retrieves the value for any variable, or its metadata (via the dot notation syntax)&lt;br /&gt;
*LEMsetTabIndexes() - ensures that the tab sequence will act as expected even if input elements change visibility.&lt;br /&gt;
===EM-related Test Cases===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92: /classes/expressions/test/*.php&lt;br /&gt;
**Version 2.0:  /application/views/admin/expressions/*&lt;br /&gt;
*Purpose&lt;br /&gt;
**&#039;&#039;&#039;Available Functions&#039;&#039;&#039; - runs EM::ShowAllowableFunctions to display functions and syntax from EM-&amp;gt;RDP_ValidFunctions&lt;br /&gt;
**&#039;&#039;&#039;String Splitter&#039;&#039;&#039; - runs EM::UnitTestStringSplitter() to show how it parses strings with curly braces&lt;br /&gt;
**&#039;&#039;&#039;Tokenizer&#039;&#039;&#039; - runs EM::UnitTestTokenizer() to show how EM detects and categorizes tokens (e.g. variables, string, functions, operators)&lt;br /&gt;
**&#039;&#039;&#039;Unit Tests of Isolated Expressions&#039;&#039;&#039; - runs EM::UnitTestEvaluator() for unit tests of each of Expression Manager&#039;s features (e.g. all operators and functions). Color coding shows whether any tests fail. Syntax highlighting shows cases where Expression Manager properly detects bad syntax.&lt;br /&gt;
**&#039;&#039;&#039;Unit Tests of Expressions Within Strings&#039;&#039;&#039; - runs LEM::UnitTestProcessStringContainingExpressions() to show how Expression Manager can process strings containing one or more variable, token, or expression replacements surrounded by curly braces.&lt;br /&gt;
**&#039;&#039;&#039;Unit Test Dynamic Relevance Processing&#039;&#039;&#039; - runs LEM::UnitTestRelevance() to show how questions and substitutions should dynamically change based upon values entered.&lt;br /&gt;
**&#039;&#039;&#039;Preview Conversion of Conditions to Relevance&#039;&#039;&#039; - runs LEM::UnitTestConvertConditionsToRelevance() to show relevance equations for all conditions in the database, grouped by question id&lt;br /&gt;
**&#039;&#039;&#039;Bulk Convert Conditions to Relevance&#039;&#039;&#039; - actually performs the conversion, saving the generated relevance  equations (while retaining the original conditions)&lt;br /&gt;
**&#039;&#039;&#039;Test Navigation&#039;&#039;&#039; - unit tests LEM::NavigateForwards() for the selected survey, generating the following information based upon the selected debugging options:&lt;br /&gt;
***Detailed Timing - shows low-level timing information for each part of EM (e.g. to examine duration of database calls)&lt;br /&gt;
***Validation Summary - shows one line per group and question, showing its relevance equation, and indicating whether it was irrelevant, hidden, mandatory and/or failed validation criteria.  Also shows the generated SQL per navigation step to update the database&lt;br /&gt;
***Validation Detail - shows extra details per question, including&lt;br /&gt;
****Validation Tip, Equation, JavaScript equivalent of the Equation&lt;br /&gt;
****Lists of sub-questions; which are relevant; and which are unanswered&lt;br /&gt;
****List of array filters applied, by sub-question&lt;br /&gt;
***Pretty Print Syntax - syntax highlights all of the equations so that you can see errors, and also click on variable names to jump to those questions and edit them.&lt;br /&gt;
**&#039;&#039;&#039;Show Survey Logic File&#039;&#039;&#039; - generates the logic file which is available via the &amp;quot;QA&amp;quot; buttons in the admin console.&lt;br /&gt;
&lt;br /&gt;
==How EM Works==&lt;br /&gt;
&lt;br /&gt;
===What is an Expression?===&lt;br /&gt;
&lt;br /&gt;
Anything surrounded by curly braces is an Expression, with two exceptions:&lt;br /&gt;
If there is whitespace after the opening brace or before the closing brace, it is ignored.&lt;br /&gt;
*This is so that EM can ignore embedded JavaScript.&lt;br /&gt;
*So, if you have JavaScript that might be parsed by EM, make sure to add a space or newline  after the opening brace.&lt;br /&gt;
#Escaped curly braces are ignored (e.g. &amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;\{&#039;&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;\}&#039;&#039;&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Note that EM does support Expressions within strings.  Moreover, Expressions can contain nested strings, but not nested expressions.  So, the following red sections are valid Expressions and will cause substitions to occur within the containing strings.&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{Q1}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{if(Q1==&amp;quot;Y&amp;quot;,&#039;yes&#039;,&#039;no&#039;)}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{if(Q1==&amp;quot;Y&amp;quot;,&#039;single quote with {nested braces}&#039;,&amp;quot;double quote with {nested braces}&amp;quot;)}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===What does EM do with text containing expressions?===&lt;br /&gt;
#A regular expression divides the source line into STRING and EXPRESSION tokens&lt;br /&gt;
#Each EXPRESSION is parsed by ExpressionManager, a [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser].&lt;br /&gt;
##If there are syntax errors, EM returns an HTML string that syntax-highlights the equation and puts red-lined boxes around syntax errors&lt;br /&gt;
##If there are no syntax errors, EM returns the result of evaluating the expression&lt;br /&gt;
#EM re-joins the STRING and EM-evaluated EXPRESSION parts.&lt;br /&gt;
#EM optionally appends the translation activity to structures used by GetRelevanceAndTailoringJavaScript()&lt;br /&gt;
&lt;br /&gt;
===How can we be sure that EM accurately parses the equations?===&lt;br /&gt;
&lt;br /&gt;
EM was originally written in 1999-2000 by Dr. Tom White (TMSWhite) for a different project (Dialogix) in Java, using [http://en.wikipedia.org/wiki/JavaCC JavaCC], an open source compiler compiler (parser generator).  That Java-based project has been in production for over a decade, and has been fully vetted for unit and integration tests.&lt;br /&gt;
&lt;br /&gt;
Since there is no production-grade parser generator for PHP and JavaScript (although [http://www.antlr.org/ Antlr] is coming close), TMSWhite created a custom [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser] for LimeSurvey.  To ensure its accuracy, EM&#039;s logic is based upon the JavaCC source code for Dialogix.  The JavaCC syntax mirrors the functionality needed for a recursive descent parser.  JavaCC happens to build a state-based compiler, which is a little more efficient than a recusive descent parser.  However, state-based compilers are impossible to read, understand,  or expand without JavaCC-like source code, so it did not make sense to try to port the JavaCC output directly to PHP.&lt;br /&gt;
&lt;br /&gt;
Futhermore, there are comprehensive unit and integration test suites for EM. These make it easy to validate the accuracy of the EM system.  Each test suite includes dozens to hundreds of test cases, and it is trivial to add addition test cases.&lt;br /&gt;
&lt;br /&gt;
===How does the Recursive Descent Parser work?===&lt;br /&gt;
&lt;br /&gt;
EM must do the following:&lt;br /&gt;
#Tokenize the expression - separating strings, words (variable names vs. functions), and punctuation; and categorizing the types of each.&lt;br /&gt;
#Analyze the tokens to build a parse tree, checking for syntax errors along the way.&lt;br /&gt;
#Return the result of evaluating the expression (using PHP) (or return syntax-highlighted HTML if there are syntax errors).&lt;br /&gt;
#Create a safe JavaScript equivalent of the expression so that expressions can be  dynamically re-computed client-side.&lt;br /&gt;
#Determine which variables are used in each expression (so can make sure they are available client-side).&lt;br /&gt;
&lt;br /&gt;
===How does EM integrate into LimeSurvey?===&lt;br /&gt;
&lt;br /&gt;
The LimeExpressionManager (LEM) class manages the integration of EM into LimeSurvey.  LEM must:&lt;br /&gt;
#Initialize all of the variables needed by LimeSurvey (e.g. for TOKENS, INSERTANS, and templatereplace())&lt;br /&gt;
#Know which Group and Question are being processed&lt;br /&gt;
#Record the results and metadata about all of the text that LimeSurvey asks it to process&lt;br /&gt;
#Output static HTML that reflects the results of that processing&lt;br /&gt;
#Output JavaScript that lets those results be dynamically re-computed if values on the page change.&lt;br /&gt;
&lt;br /&gt;
==Extending EM==&lt;br /&gt;
&lt;br /&gt;
===Adding Test Cases===&lt;br /&gt;
&lt;br /&gt;
Please do!  The testing frameworks are solid. You just need to add more tests following the examples in the code.&lt;br /&gt;
&lt;br /&gt;
=== Adding Functions ===&lt;br /&gt;
&lt;br /&gt;
When you add a function that does not exist in PHP, then add it to the body of &#039;&#039;&#039;em_core_helper.php&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;FIXME&#039;&#039;:  Eventually we should separate out such add-on functions into their own php file.&lt;br /&gt;
&lt;br /&gt;
Functions are stored in LimeExpressionManager::amValidFunctions[]. Some existing examples are:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=PHP&amp;gt;&lt;br /&gt;
&#039;abs&#039; =&amp;gt; array(&#039;abs&#039;, &#039;Math.abs&#039;, &#039;Absolute value&#039;, &#039;number abs(number)&#039;, &#039;http://www.php.net/manual/en/function.checkdate.php&#039;, 1),&lt;br /&gt;
&#039;if&#039; =&amp;gt; array(&#039;exprmgr_if&#039;, &#039;LEMif&#039;, &#039;Excel-style if(test,result_if_true,result_if_false)&#039;, &#039;if(test,result_if_true,result_if_false)&#039;, &#039;&#039;, 3),&lt;br /&gt;
&#039;max&#039; =&amp;gt; array(&#039;max&#039;, &#039;Math.max&#039;, &#039;Find highest value&#039;, &#039;number max(arg1, arg2, ... argN)&#039;, &#039;http://www.php.net/manual/en/function.max.php&#039;, -2),&lt;br /&gt;
&#039;substr&#039; =&amp;gt; array(&#039;substr&#039;, &#039;substr&#039;, &#039;Return part of a string&#039;, &#039;string substr(string, start &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, length])&#039;, &#039;http://www.php.net/manual/en/function.substr.php&#039;, 2,3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The syntax for each function is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=PHP&amp;gt;&lt;br /&gt;
function =&amp;gt; array( detail_1, detail_2, detail_3, detail_4, detail_5, detail_6 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;details&#039;&#039; which must be included in the array are:&lt;br /&gt;
&lt;br /&gt;
# PHP function name - this is the PHP function that will be called for that func.&lt;br /&gt;
# JavaScript function name - this is the JavaScript function that will be called for that function&lt;br /&gt;
# Meaning - this is a short description of what the function does&lt;br /&gt;
# Syntax - this shows the valid syntax for the function&lt;br /&gt;
# Reference - this is an optional URL showing more details about the syntax (e.g. a link to the PHP documentation)&lt;br /&gt;
# Number of required arguments&lt;br /&gt;
#* Multiple values are allowed at the end of the array.  For example, substr() above can take 2 or 3 arguments&lt;br /&gt;
#* Negative values mean that the function accepts a variable number of arguments&lt;br /&gt;
#* Negative values less than -1 mean that the function requires at least abs(N)-1 arguments (so -2 means it requires at least 1 argument)&lt;br /&gt;
&lt;br /&gt;
If you add a function that does not exist in JavaScript, then add it to the body of &#039;&#039;&#039;em_javascript.js&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Make sure to add Unit tests for new functions to UnitTestEvaluator&lt;br /&gt;
&lt;br /&gt;
* Syntax is ExpectedResult~Expression, such as:&lt;br /&gt;
* 212~5 + max(1,(2+3),(4 + (5 + 6)),[[]],[[7 + 8) + 9),( (10 + 11), 12),(13 + (14 * 15) - 16) )&lt;br /&gt;
&lt;br /&gt;
When your test case should return an error, use NULL as the expected value, like this:&lt;br /&gt;
&lt;br /&gt;
* NULL~four * / seven&lt;br /&gt;
* NULL~(5 + 7) = 8&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=ExpressionScript_for_developers&amp;diff=25826</id>
		<title>ExpressionScript for developers</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=ExpressionScript_for_developers&amp;diff=25826"/>
		<updated>2013-05-16T14:42:05Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: reformatted markup&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
This wiki page is meant for the LimeSurvey development team and others wishing to contribute to LimeSurvey.  It provides details about how to work with, test, and extend Expression Manager (EM).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note, this document is currently incomplete.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Started==&lt;br /&gt;
&lt;br /&gt;
The best way to get started with EM is to:&lt;br /&gt;
*Install [http://www.limesurvey.org/en/download LimeSurvey 1.92]&lt;br /&gt;
*Load and play with the Expression Manager demos (located in /docs/demosurveys of the distribution)&lt;br /&gt;
*Navigate through all of the test cases&lt;br /&gt;
**Select a survey, click Tools, then Expression Manager&lt;br /&gt;
*Read the documentation&lt;br /&gt;
**Main user documentation for [[Expression Manager|Expression Manager]]&lt;br /&gt;
**Expression Manager [[Expression Manager HowTos|How Tos]]&lt;br /&gt;
&lt;br /&gt;
==EM Source Code Organization and Purpose==&lt;br /&gt;
=== ExpressionManager (EM) ===&lt;br /&gt;
&lt;br /&gt;
Implements a [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser] in PHP and JavaScript which let you create variables and securely expose a specified set of pre-defined functions.&lt;br /&gt;
&lt;br /&gt;
==== Location ==== &lt;br /&gt;
&lt;br /&gt;
* Version 1.92:  /classes/expressions/ExpressionManager.php&lt;br /&gt;
* Version 2.0:  /application/helpers/expressions/em_core_helper.php&lt;br /&gt;
&lt;br /&gt;
==== Recursive Descent Parser (all variables and functions starting with &#039;&#039;RDP_&#039;&#039;) ====&lt;br /&gt;
&lt;br /&gt;
* This is the core of EM, a compiler which builds and evaluates the parse tree for the expression&lt;br /&gt;
* Unless you are an expert in compiler theory, you should not touch the RDP_ code.&lt;br /&gt;
&lt;br /&gt;
==== API Functions to the RDP ====&lt;br /&gt;
&lt;br /&gt;
* RegisterFunctions - an interface to add external functions to EM&lt;br /&gt;
* sProcessStringContainingExpressions() - splits string on expressions, evaluates each, then joins together the parts&lt;br /&gt;
* ProcessBooleanExpression() - evaluates whether an equation (not surrounded by curly braces) is true&lt;br /&gt;
* Get*() - returns information about the most recently processed expressions&lt;br /&gt;
&lt;br /&gt;
=== LimeExpressionManager (LEM) ===&lt;br /&gt;
&lt;br /&gt;
This centralizes the integration of LimeSurvey with EM&lt;br /&gt;
&lt;br /&gt;
==== Location ====&lt;br /&gt;
* Version 1.92:  /classes/expressions/LimeExpressionManager.php&lt;br /&gt;
* Version 2.0:  /application/helpers/expressions/em_manager_helper.php&lt;br /&gt;
&lt;br /&gt;
==== Navigation Functions ====&lt;br /&gt;
These process the current responses, update the database, find the next relevant set of questions, and create the metadata needed to render those questions&lt;br /&gt;
&lt;br /&gt;
* NavigateForwards()&lt;br /&gt;
* NavigateBackwards()&lt;br /&gt;
* JumpTo()&lt;br /&gt;
* GetLastMoveResult()&lt;br /&gt;
&lt;br /&gt;
==== Initialization Functions ====&lt;br /&gt;
&lt;br /&gt;
* StartSurvey() - initializes the survey, setting all variable mappings&lt;br /&gt;
* setVariableAndTokenMappingsForExpressionManager() - post-processes CreateFieldMap() to create metadata needed for all variables and token values&lt;br /&gt;
* _CreateSubQLevelRelevanceAndValidationEquations() - processes advanced question attributes such as array_filter, min_answers, and min_value&lt;br /&gt;
* ProcessAllNeededRelevance() - computes the relevance results (and JavaScript) for all applicable questions&lt;br /&gt;
* _ProcessGroupRelevance() - computes the relevance of a group based upon its own relevance criteria and the status of the questions it contains.&lt;br /&gt;
&lt;br /&gt;
==== Functions to Generate Tailored Content ====&lt;br /&gt;
* StartProcessingPage() - called at beginning of each page&lt;br /&gt;
* StartProcessingGroup() - called for each group on a page&lt;br /&gt;
* FinishProcessingGroup() - collects all tailoring for this group so can render appropriate JavaScript&lt;br /&gt;
* FinishProcessingPage() - completes the EM-related processing, and serializes LEM into $_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;LEMsingleton&#039;]&lt;br /&gt;
* GetRelevanceAndTailoringJavaScript() - collects all relevance, validation, and tailoring logic and generates ExprMgr_process_relevance_and_tailoring() JavaScript function&lt;br /&gt;
&lt;br /&gt;
==== Response Management ====&lt;br /&gt;
*ProcessCurrentResponses() - validates and processes the $_POSTed responses&lt;br /&gt;
*_UpdateValuesInDatabase() - saves values to database, including NULLing irrelevant values&lt;br /&gt;
&lt;br /&gt;
==== Caching ====&lt;br /&gt;
LEM tries to avoid calling the Initialization functions each page, storing state in $_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;LEMsingleton&#039;]&lt;br /&gt;
* SetDirtyFlag() - when called, tells LEM to force a rebuild of the Initialization functions (e.g. of admin has added/removed/updated any questions, groups, conditions, or defaults)&lt;br /&gt;
* SetSurveyId()- calls SetDirtyFlag if the user wants to work with a different survey from the one that is cached&lt;br /&gt;
* SetEMLanguage() - calls SetDirtyFlag() if the user starts  to use a language different from the cached one&lt;br /&gt;
&lt;br /&gt;
==== Validation Functions ====&lt;br /&gt;
* _ValidateSurvey() - validates the entire survey by calling _ValidateGroup()&lt;br /&gt;
* _ValidatGroup() - validates a group and returns its status by calling _ValidateQuestion() on all of its questions&lt;br /&gt;
* _ValidateQuestion() - validates a question, determining whether it is relevant, hidden, or fails any validation and/or mandatory criteria&lt;br /&gt;
&lt;br /&gt;
===EM-related JavaScript===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92: /classes/expressions/em_javascript.js&lt;br /&gt;
**Version 2.0: /scripts/admin/expressions/em_javascript.js&lt;br /&gt;
*Purpose - contains all of the custom javascript needed for EM&lt;br /&gt;
====JavaScript equivalents of PHP functions====&lt;br /&gt;
About 20 functions from phpjs.org&lt;br /&gt;
====Core Functions====&lt;br /&gt;
*LEManyNA() - checks whether any of the variables are irrelevant&lt;br /&gt;
*LEMval() - retrieves the value for any variable, or its metadata (via the dot notation syntax)&lt;br /&gt;
*LEMsetTabIndexes() - ensures that the tab sequence will act as expected even if input elements change visibility.&lt;br /&gt;
===EM-related Test Cases===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92: /classes/expressions/test/*.php&lt;br /&gt;
**Version 2.0:  /application/views/admin/expressions/*&lt;br /&gt;
*Purpose&lt;br /&gt;
**&#039;&#039;&#039;Available Functions&#039;&#039;&#039; - runs EM::ShowAllowableFunctions to display functions and syntax from EM-&amp;gt;RDP_ValidFunctions&lt;br /&gt;
**&#039;&#039;&#039;String Splitter&#039;&#039;&#039; - runs EM::UnitTestStringSplitter() to show how it parses strings with curly braces&lt;br /&gt;
**&#039;&#039;&#039;Tokenizer&#039;&#039;&#039; - runs EM::UnitTestTokenizer() to show how EM detects and categorizes tokens (e.g. variables, string, functions, operators)&lt;br /&gt;
**&#039;&#039;&#039;Unit Tests of Isolated Expressions&#039;&#039;&#039; - runs EM::UnitTestEvaluator() for unit tests of each of Expression Manager&#039;s features (e.g. all operators and functions). Color coding shows whether any tests fail. Syntax highlighting shows cases where Expression Manager properly detects bad syntax.&lt;br /&gt;
**&#039;&#039;&#039;Unit Tests of Expressions Within Strings&#039;&#039;&#039; - runs LEM::UnitTestProcessStringContainingExpressions() to show how Expression Manager can process strings containing one or more variable, token, or expression replacements surrounded by curly braces.&lt;br /&gt;
**&#039;&#039;&#039;Unit Test Dynamic Relevance Processing&#039;&#039;&#039; - runs LEM::UnitTestRelevance() to show how questions and substitutions should dynamically change based upon values entered.&lt;br /&gt;
**&#039;&#039;&#039;Preview Conversion of Conditions to Relevance&#039;&#039;&#039; - runs LEM::UnitTestConvertConditionsToRelevance() to show relevance equations for all conditions in the database, grouped by question id&lt;br /&gt;
**&#039;&#039;&#039;Bulk Convert Conditions to Relevance&#039;&#039;&#039; - actually performs the conversion, saving the generated relevance  equations (while retaining the original conditions)&lt;br /&gt;
**&#039;&#039;&#039;Test Navigation&#039;&#039;&#039; - unit tests LEM::NavigateForwards() for the selected survey, generating the following information based upon the selected debugging options:&lt;br /&gt;
***Detailed Timing - shows low-level timing information for each part of EM (e.g. to examine duration of database calls)&lt;br /&gt;
***Validation Summary - shows one line per group and question, showing its relevance equation, and indicating whether it was irrelevant, hidden, mandatory and/or failed validation criteria.  Also shows the generated SQL per navigation step to update the database&lt;br /&gt;
***Validation Detail - shows extra details per question, including&lt;br /&gt;
****Validation Tip, Equation, JavaScript equivalent of the Equation&lt;br /&gt;
****Lists of sub-questions; which are relevant; and which are unanswered&lt;br /&gt;
****List of array filters applied, by sub-question&lt;br /&gt;
***Pretty Print Syntax - syntax highlights all of the equations so that you can see errors, and also click on variable names to jump to those questions and edit them.&lt;br /&gt;
**&#039;&#039;&#039;Show Survey Logic File&#039;&#039;&#039; - generates the logic file which is available via the &amp;quot;QA&amp;quot; buttons in the admin console.&lt;br /&gt;
&lt;br /&gt;
==How EM Works==&lt;br /&gt;
&lt;br /&gt;
===What is an Expression?===&lt;br /&gt;
&lt;br /&gt;
Anything surrounded by curly braces is an Expression, with two exceptions:&lt;br /&gt;
If there is whitespace after the opening brace or before the closing brace, it is ignored.&lt;br /&gt;
*This is so that EM can ignore embedded JavaScript.&lt;br /&gt;
*So, if you have JavaScript that might be parsed by EM, make sure to add a space or newline  after the opening brace.&lt;br /&gt;
#Escaped curly braces are ignored (e.g. &amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;\{&#039;&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;\}&#039;&#039;&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Note that EM does support Expressions within strings.  Moreover, Expressions can contain nested strings, but not nested expressions.  So, the following red sections are valid Expressions and will cause substitions to occur within the containing strings.&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{Q1}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{if(Q1==&amp;quot;Y&amp;quot;,&#039;yes&#039;,&#039;no&#039;)}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{if(Q1==&amp;quot;Y&amp;quot;,&#039;single quote with {nested braces}&#039;,&amp;quot;double quote with {nested braces}&amp;quot;)}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===What does EM do with text containing expressions?===&lt;br /&gt;
#A regular expression divides the source line into STRING and EXPRESSION tokens&lt;br /&gt;
#Each EXPRESSION is parsed by ExpressionManager, a [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser].&lt;br /&gt;
##If there are syntax errors, EM returns an HTML string that syntax-highlights the equation and puts red-lined boxes around syntax errors&lt;br /&gt;
##If there are no syntax errors, EM returns the result of evaluating the expression&lt;br /&gt;
#EM re-joins the STRING and EM-evaluated EXPRESSION parts.&lt;br /&gt;
#EM optionally appends the translation activity to structures used by GetRelevanceAndTailoringJavaScript()&lt;br /&gt;
&lt;br /&gt;
===How can we be sure that EM accurately parses the equations?===&lt;br /&gt;
&lt;br /&gt;
EM was originally written in 1999-2000 by Dr. Tom White (TMSWhite) for a different project (Dialogix) in Java, using [http://en.wikipedia.org/wiki/JavaCC JavaCC], an open source compiler compiler (parser generator).  That Java-based project has been in production for over a decade, and has been fully vetted for unit and integration tests.&lt;br /&gt;
&lt;br /&gt;
Since there is no production-grade parser generator for PHP and JavaScript (although [http://www.antlr.org/ Antlr] is coming close), TMSWhite created a custom [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser] for LimeSurvey.  To ensure its accuracy, EM&#039;s logic is based upon the JavaCC source code for Dialogix.  The JavaCC syntax mirrors the functionality needed for a recursive descent parser.  JavaCC happens to build a state-based compiler, which is a little more efficient than a recusive descent parser.  However, state-based compilers are impossible to read, understand,  or expand without JavaCC-like source code, so it did not make sense to try to port the JavaCC output directly to PHP.&lt;br /&gt;
&lt;br /&gt;
Futhermore, there are comprehensive unit and integration test suites for EM. These make it easy to validate the accuracy of the EM system.  Each test suite includes dozens to hundreds of test cases, and it is trivial to add addition test cases.&lt;br /&gt;
&lt;br /&gt;
===How does the Recursive Descent Parser work?===&lt;br /&gt;
&lt;br /&gt;
EM must do the following:&lt;br /&gt;
#Tokenize the expression - separating strings, words (variable names vs. functions), and punctuation; and categorizing the types of each.&lt;br /&gt;
#Analyze the tokens to build a parse tree, checking for syntax errors along the way.&lt;br /&gt;
#Return the result of evaluating the expression (using PHP) (or return syntax-highlighted HTML if there are syntax errors).&lt;br /&gt;
#Create a safe JavaScript equivalent of the expression so that expressions can be  dynamically re-computed client-side.&lt;br /&gt;
#Determine which variables are used in each expression (so can make sure they are available client-side).&lt;br /&gt;
&lt;br /&gt;
===How does EM integrate into LimeSurvey?===&lt;br /&gt;
&lt;br /&gt;
The LimeExpressionManager (LEM) class manages the integration of EM into LimeSurvey.  LEM must:&lt;br /&gt;
#Initialize all of the variables needed by LimeSurvey (e.g. for TOKENS, INSERTANS, and templatereplace())&lt;br /&gt;
#Know which Group and Question are being processed&lt;br /&gt;
#Record the results and metadata about all of the text that LimeSurvey asks it to process&lt;br /&gt;
#Output static HTML that reflects the results of that processing&lt;br /&gt;
#Output JavaScript that lets those results be dynamically re-computed if values on the page change.&lt;br /&gt;
&lt;br /&gt;
==Extending EM==&lt;br /&gt;
&lt;br /&gt;
===Adding Test Cases===&lt;br /&gt;
&lt;br /&gt;
Please do!  The testing frameworks are solid. You just need to add more tests following the examples in the code.&lt;br /&gt;
&lt;br /&gt;
=== Adding Functions ===&lt;br /&gt;
&lt;br /&gt;
Functions are stored in LimeExpressionManager::amValidFunctions[]. Some existing examples are:&lt;br /&gt;
&lt;br /&gt;
*&#039;abs&#039; =&amp;gt; array(&#039;abs&#039;, &#039;Math.abs&#039;, &#039;Absolute value&#039;, &#039;number abs(number)&#039;, &#039;http://www.php.net/manual/en/function.checkdate.php&#039;, 1),&lt;br /&gt;
*&#039;if&#039; =&amp;gt; array(&#039;exprmgr_if&#039;, &#039;LEMif&#039;, &#039;Excel-style if(test,result_if_true,result_if_false)&#039;, &#039;if(test,result_if_true,result_if_false)&#039;, &#039;&#039;, 3),&lt;br /&gt;
*&#039;max&#039; =&amp;gt; array(&#039;max&#039;, &#039;Math.max&#039;, &#039;Find highest value&#039;, &#039;number max(arg1, arg2, ... argN)&#039;, &#039;http://www.php.net/manual/en/function.max.php&#039;, -2),&lt;br /&gt;
*&#039;substr&#039; =&amp;gt; array(&#039;substr&#039;, &#039;substr&#039;, &#039;Return part of a string&#039;, &#039;string substr(string, start &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, length])&#039;, &#039;http://www.php.net/manual/en/function.substr.php&#039;, 2,3)&lt;br /&gt;
&lt;br /&gt;
The syntax for each function (func) is:&lt;br /&gt;
&lt;br /&gt;
*&#039;&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;func&#039;&#039;&#039;&amp;lt;/span&amp;gt;&#039; =&amp;gt; array(&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;details&#039;&#039;&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
The details which must be included in the array are:&lt;br /&gt;
&lt;br /&gt;
# PHP function name - this is the PHP function that will be called for that func.&lt;br /&gt;
# JavaScript function name - this is the JavaScript function that will be called for that function&lt;br /&gt;
# Meaning - this is a short description of what the function does&lt;br /&gt;
# Syntax - this shows the valid syntax for the function&lt;br /&gt;
# Reference - this is an optional URL showing more details about the syntax (e.g. a link to the PHP documentation)&lt;br /&gt;
# Number of required arguments&lt;br /&gt;
#* Multiple values are allowed at the end of the array.  For example, substr() above can take 2 or 3 arguments&lt;br /&gt;
#* Negative values mean that the function accepts a variable number of arguments&lt;br /&gt;
#* Negative values less than -1 mean that the function requires at least abs(N)-1 arguments (so -2 means it requires at least 1 argument)&lt;br /&gt;
&lt;br /&gt;
When you add a function that does not exist in PHP, then add it to the body of &#039;&#039;&#039;em_core_helper.php&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;FIXME&#039;&#039;:  Eventually we should separate out such add-on functions into their own php file&lt;br /&gt;
&lt;br /&gt;
If you add a function that does not exist in JavaScript, then add it to the body of em_javascript.js&lt;br /&gt;
&lt;br /&gt;
Make sure to add Unit tests for new functions to UnitTestEvaluator&lt;br /&gt;
&lt;br /&gt;
* Syntax is ExpectedResult~Expression, such as:&lt;br /&gt;
* 212~5 + max(1,(2+3),(4 + (5 + 6)),[[]],[[7 + 8) + 9),( (10 + 11), 12),(13 + (14 * 15) - 16) )&lt;br /&gt;
&lt;br /&gt;
When your test case should return an error, use NULL as the expected value, like this:&lt;br /&gt;
&lt;br /&gt;
* NULL~four * / seven&lt;br /&gt;
* NULL~(5 + 7) = 8&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=ExpressionScript_for_developers&amp;diff=25431</id>
		<title>ExpressionScript for developers</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=ExpressionScript_for_developers&amp;diff=25431"/>
		<updated>2013-05-13T15:13:24Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: fixed path&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
This wiki page is meant for the LimeSurvey development team and others wishing to contribute to LimeSurvey.  It provides details about how to work with, test, and extend Expression Manager (EM).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note, this document is currently incomplete.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Started==&lt;br /&gt;
&lt;br /&gt;
The best way to get started with EM is to:&lt;br /&gt;
*Install [http://www.limesurvey.org/en/download LimeSurvey 1.92]&lt;br /&gt;
*Load and play with the Expression Manager demos (located in /docs/demosurveys of the distribution)&lt;br /&gt;
*Navigate through all of the test cases&lt;br /&gt;
**Select a survey, click Tools, then Expression Manager&lt;br /&gt;
*Read the documentation&lt;br /&gt;
**Main user documentation for [[Expression Manager|Expression Manager]]&lt;br /&gt;
**Expression Manager [[Expression Manager HowTos|How Tos]]&lt;br /&gt;
&lt;br /&gt;
==EM Source Code Organization and Purpose==&lt;br /&gt;
=== ExpressionManager (EM) ===&lt;br /&gt;
&lt;br /&gt;
Implements a [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser] in PHP and JavaScript which let you create variables and securely expose a specified set of pre-defined functions.&lt;br /&gt;
&lt;br /&gt;
==== Location ==== &lt;br /&gt;
&lt;br /&gt;
* Version 1.92:  /classes/expressions/ExpressionManager.php&lt;br /&gt;
* Version 2.0:  /application/helpers/expressions/em_core_helper.php&lt;br /&gt;
&lt;br /&gt;
==== Recursive Descent Parser (all variables and functions starting with &#039;&#039;RDP_&#039;&#039;) ====&lt;br /&gt;
&lt;br /&gt;
* This is the core of EM, a compiler which builds and evaluates the parse tree for the expression&lt;br /&gt;
* Unless you are an expert in compiler theory, you should not touch the RDP_ code.&lt;br /&gt;
&lt;br /&gt;
==== API Functions to the RDP ====&lt;br /&gt;
&lt;br /&gt;
* RegisterFunctions - an interface to add external functions to EM&lt;br /&gt;
* sProcessStringContainingExpressions() - splits string on expressions, evaluates each, then joins together the parts&lt;br /&gt;
* ProcessBooleanExpression() - evaluates whether an equation (not surrounded by curly braces) is true&lt;br /&gt;
* Get*() - returns information about the most recently processed expressions&lt;br /&gt;
&lt;br /&gt;
=== LimeExpressionManager (LEM) ===&lt;br /&gt;
&lt;br /&gt;
This centralizes the integration of LimeSurvey with EM&lt;br /&gt;
&lt;br /&gt;
==== Location ====&lt;br /&gt;
* Version 1.92:  /classes/expressions/LimeExpressionManager.php&lt;br /&gt;
* Version 2.0:  /application/helpers/expressions/em_manager_helper.php&lt;br /&gt;
&lt;br /&gt;
==== Navigation Functions ====&lt;br /&gt;
These process the current responses, update the database, find the next relevant set of questions, and create the metadata needed to render those questions&lt;br /&gt;
&lt;br /&gt;
* NavigateForwards()&lt;br /&gt;
* NavigateBackwards()&lt;br /&gt;
* JumpTo()&lt;br /&gt;
* GetLastMoveResult()&lt;br /&gt;
&lt;br /&gt;
==== Initialization Functions ====&lt;br /&gt;
&lt;br /&gt;
* StartSurvey() - initializes the survey, setting all variable mappings&lt;br /&gt;
* setVariableAndTokenMappingsForExpressionManager() - post-processes CreateFieldMap() to create metadata needed for all variables and token values&lt;br /&gt;
* _CreateSubQLevelRelevanceAndValidationEquations() - processes advanced question attributes such as array_filter, min_answers, and min_value&lt;br /&gt;
* ProcessAllNeededRelevance() - computes the relevance results (and JavaScript) for all applicable questions&lt;br /&gt;
* _ProcessGroupRelevance() - computes the relevance of a group based upon its own relevance criteria and the status of the questions it contains.&lt;br /&gt;
&lt;br /&gt;
==== Functions to Generate Tailored Content ====&lt;br /&gt;
* StartProcessingPage() - called at beginning of each page&lt;br /&gt;
* StartProcessingGroup() - called for each group on a page&lt;br /&gt;
* FinishProcessingGroup() - collects all tailoring for this group so can render appropriate JavaScript&lt;br /&gt;
* FinishProcessingPage() - completes the EM-related processing, and serializes LEM into $_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;LEMsingleton&#039;]&lt;br /&gt;
* GetRelevanceAndTailoringJavaScript() - collects all relevance, validation, and tailoring logic and generates ExprMgr_process_relevance_and_tailoring() JavaScript function&lt;br /&gt;
&lt;br /&gt;
==== Response Management ====&lt;br /&gt;
*ProcessCurrentResponses() - validates and processes the $_POSTed responses&lt;br /&gt;
*_UpdateValuesInDatabase() - saves values to database, including NULLing irrelevant values&lt;br /&gt;
&lt;br /&gt;
==== Caching ====&lt;br /&gt;
LEM tries to avoid calling the Initialization functions each page, storing state in $_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;LEMsingleton&#039;]&lt;br /&gt;
* SetDirtyFlag() - when called, tells LEM to force a rebuild of the Initialization functions (e.g. of admin has added/removed/updated any questions, groups, conditions, or defaults)&lt;br /&gt;
* SetSurveyId()- calls SetDirtyFlag if the user wants to work with a different survey from the one that is cached&lt;br /&gt;
* SetEMLanguage() - calls SetDirtyFlag() if the user starts  to use a language different from the cached one&lt;br /&gt;
&lt;br /&gt;
==== Validation Functions ====&lt;br /&gt;
* _ValidateSurvey() - validates the entire survey by calling _ValidateGroup()&lt;br /&gt;
* _ValidatGroup() - validates a group and returns its status by calling _ValidateQuestion() on all of its questions&lt;br /&gt;
* _ValidateQuestion() - validates a question, determining whether it is relevant, hidden, or fails any validation and/or mandatory criteria&lt;br /&gt;
&lt;br /&gt;
===EM-related JavaScript===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92: /classes/expressions/em_javascript.js&lt;br /&gt;
**Version 2.0: /scripts/admin/expressions/em_javascript.js&lt;br /&gt;
*Purpose - contains all of the custom javascript needed for EM&lt;br /&gt;
====JavaScript equivalents of PHP functions====&lt;br /&gt;
About 20 functions from phpjs.org&lt;br /&gt;
====Core Functions====&lt;br /&gt;
*LEManyNA() - checks whether any of the variables are irrelevant&lt;br /&gt;
*LEMval() - retrieves the value for any variable, or its metadata (via the dot notation syntax)&lt;br /&gt;
*LEMsetTabIndexes() - ensures that the tab sequence will act as expected even if input elements change visibility.&lt;br /&gt;
===EM-related Test Cases===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92: /classes/expressions/test/*.php&lt;br /&gt;
**Version 2.0:  /application/views/admin/expressions/*&lt;br /&gt;
*Purpose&lt;br /&gt;
**&#039;&#039;&#039;Available Functions&#039;&#039;&#039; - runs EM::ShowAllowableFunctions to display functions and syntax from EM-&amp;gt;RDP_ValidFunctions&lt;br /&gt;
**&#039;&#039;&#039;String Splitter&#039;&#039;&#039; - runs EM::UnitTestStringSplitter() to show how it parses strings with curly braces&lt;br /&gt;
**&#039;&#039;&#039;Tokenizer&#039;&#039;&#039; - runs EM::UnitTestTokenizer() to show how EM detects and categorizes tokens (e.g. variables, string, functions, operators)&lt;br /&gt;
**&#039;&#039;&#039;Unit Tests of Isolated Expressions&#039;&#039;&#039; - runs EM::UnitTestEvaluator() for unit tests of each of Expression Manager&#039;s features (e.g. all operators and functions). Color coding shows whether any tests fail. Syntax highlighting shows cases where Expression Manager properly detects bad syntax.&lt;br /&gt;
**&#039;&#039;&#039;Unit Tests of Expressions Within Strings&#039;&#039;&#039; - runs LEM::UnitTestProcessStringContainingExpressions() to show how Expression Manager can process strings containing one or more variable, token, or expression replacements surrounded by curly braces.&lt;br /&gt;
**&#039;&#039;&#039;Unit Test Dynamic Relevance Processing&#039;&#039;&#039; - runs LEM::UnitTestRelevance() to show how questions and substitutions should dynamically change based upon values entered.&lt;br /&gt;
**&#039;&#039;&#039;Preview Conversion of Conditions to Relevance&#039;&#039;&#039; - runs LEM::UnitTestConvertConditionsToRelevance() to show relevance equations for all conditions in the database, grouped by question id&lt;br /&gt;
**&#039;&#039;&#039;Bulk Convert Conditions to Relevance&#039;&#039;&#039; - actually performs the conversion, saving the generated relevance  equations (while retaining the original conditions)&lt;br /&gt;
**&#039;&#039;&#039;Test Navigation&#039;&#039;&#039; - unit tests LEM::NavigateForwards() for the selected survey, generating the following information based upon the selected debugging options:&lt;br /&gt;
***Detailed Timing - shows low-level timing information for each part of EM (e.g. to examine duration of database calls)&lt;br /&gt;
***Validation Summary - shows one line per group and question, showing its relevance equation, and indicating whether it was irrelevant, hidden, mandatory and/or failed validation criteria.  Also shows the generated SQL per navigation step to update the database&lt;br /&gt;
***Validation Detail - shows extra details per question, including&lt;br /&gt;
****Validation Tip, Equation, JavaScript equivalent of the Equation&lt;br /&gt;
****Lists of sub-questions; which are relevant; and which are unanswered&lt;br /&gt;
****List of array filters applied, by sub-question&lt;br /&gt;
***Pretty Print Syntax - syntax highlights all of the equations so that you can see errors, and also click on variable names to jump to those questions and edit them.&lt;br /&gt;
**&#039;&#039;&#039;Show Survey Logic File&#039;&#039;&#039; - generates the logic file which is available via the &amp;quot;QA&amp;quot; buttons in the admin console.&lt;br /&gt;
&lt;br /&gt;
==How EM Works==&lt;br /&gt;
&lt;br /&gt;
===What is an Expression?===&lt;br /&gt;
&lt;br /&gt;
Anything surrounded by curly braces is an Expression, with two exceptions:&lt;br /&gt;
If there is whitespace after the opening brace or before the closing brace, it is ignored.&lt;br /&gt;
*This is so that EM can ignore embedded JavaScript.&lt;br /&gt;
*So, if you have JavaScript that might be parsed by EM, make sure to add a space or newline  after the opening brace.&lt;br /&gt;
#Escaped curly braces are ignored (e.g. &amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;\{&#039;&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;\}&#039;&#039;&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Note that EM does support Expressions within strings.  Moreover, Expressions can contain nested strings, but not nested expressions.  So, the following red sections are valid Expressions and will cause substitions to occur within the containing strings.&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{Q1}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{if(Q1==&amp;quot;Y&amp;quot;,&#039;yes&#039;,&#039;no&#039;)}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{if(Q1==&amp;quot;Y&amp;quot;,&#039;single quote with {nested braces}&#039;,&amp;quot;double quote with {nested braces}&amp;quot;)}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===What does EM do with text containing expressions?===&lt;br /&gt;
#A regular expression divides the source line into STRING and EXPRESSION tokens&lt;br /&gt;
#Each EXPRESSION is parsed by ExpressionManager, a [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser].&lt;br /&gt;
##If there are syntax errors, EM returns an HTML string that syntax-highlights the equation and puts red-lined boxes around syntax errors&lt;br /&gt;
##If there are no syntax errors, EM returns the result of evaluating the expression&lt;br /&gt;
#EM re-joins the STRING and EM-evaluated EXPRESSION parts.&lt;br /&gt;
#EM optionally appends the translation activity to structures used by GetRelevanceAndTailoringJavaScript()&lt;br /&gt;
&lt;br /&gt;
===How can we be sure that EM accurately parses the equations?===&lt;br /&gt;
&lt;br /&gt;
EM was originally written in 1999-2000 by Dr. Tom White (TMSWhite) for a different project (Dialogix) in Java, using [http://en.wikipedia.org/wiki/JavaCC JavaCC], an open source compiler compiler (parser generator).  That Java-based project has been in production for over a decade, and has been fully vetted for unit and integration tests.&lt;br /&gt;
&lt;br /&gt;
Since there is no production-grade parser generator for PHP and JavaScript (although [http://www.antlr.org/ Antlr] is coming close), TMSWhite created a custom [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser] for LimeSurvey.  To ensure its accuracy, EM&#039;s logic is based upon the JavaCC source code for Dialogix.  The JavaCC syntax mirrors the functionality needed for a recursive descent parser.  JavaCC happens to build a state-based compiler, which is a little more efficient than a recusive descent parser.  However, state-based compilers are impossible to read, understand,  or expand without JavaCC-like source code, so it did not make sense to try to port the JavaCC output directly to PHP.&lt;br /&gt;
&lt;br /&gt;
Futhermore, there are comprehensive unit and integration test suites for EM. These make it easy to validate the accuracy of the EM system.  Each test suite includes dozens to hundreds of test cases, and it is trivial to add addition test cases.&lt;br /&gt;
&lt;br /&gt;
===How does the Recursive Descent Parser work?===&lt;br /&gt;
&lt;br /&gt;
EM must do the following:&lt;br /&gt;
#Tokenize the expression - separating strings, words (variable names vs. functions), and punctuation; and categorizing the types of each.&lt;br /&gt;
#Analyze the tokens to build a parse tree, checking for syntax errors along the way.&lt;br /&gt;
#Return the result of evaluating the expression (using PHP) (or return syntax-highlighted HTML if there are syntax errors).&lt;br /&gt;
#Create a safe JavaScript equivalent of the expression so that expressions can be  dynamically re-computed client-side.&lt;br /&gt;
#Determine which variables are used in each expression (so can make sure they are available client-side).&lt;br /&gt;
&lt;br /&gt;
===How does EM integrate into LimeSurvey?===&lt;br /&gt;
&lt;br /&gt;
The LimeExpressionManager (LEM) class manages the integration of EM into LimeSurvey.  LEM must:&lt;br /&gt;
#Initialize all of the variables needed by LimeSurvey (e.g. for TOKENS, INSERTANS, and templatereplace())&lt;br /&gt;
#Know which Group and Question are being processed&lt;br /&gt;
#Record the results and metadata about all of the text that LimeSurvey asks it to process&lt;br /&gt;
#Output static HTML that reflects the results of that processing&lt;br /&gt;
#Output JavaScript that lets those results be dynamically re-computed if values on the page change.&lt;br /&gt;
&lt;br /&gt;
==Extending EM==&lt;br /&gt;
&lt;br /&gt;
===Adding Test Cases===&lt;br /&gt;
&lt;br /&gt;
Please do!  The testing frameworks are solid. You just need to add more tests following the examples in the code.&lt;br /&gt;
&lt;br /&gt;
===Adding Functions===&lt;br /&gt;
&lt;br /&gt;
Functions are stored in LimeExpressionManager::amValidFunctions[]. Some existing examples are:&lt;br /&gt;
*&#039;abs&#039; =&amp;gt; array(&#039;abs&#039;, &#039;Math.abs&#039;, &#039;Absolute value&#039;, &#039;number abs(number)&#039;, &#039;http://www.php.net/manual/en/function.checkdate.php&#039;, 1),&lt;br /&gt;
*&#039;if&#039; =&amp;gt; array(&#039;exprmgr_if&#039;, &#039;LEMif&#039;, &#039;Excel-style if(test,result_if_true,result_if_false)&#039;, &#039;if(test,result_if_true,result_if_false)&#039;, &#039;&#039;, 3),&lt;br /&gt;
*&#039;max&#039; =&amp;gt; array(&#039;max&#039;, &#039;Math.max&#039;, &#039;Find highest value&#039;, &#039;number max(arg1, arg2, ... argN)&#039;, &#039;http://www.php.net/manual/en/function.max.php&#039;, -2),&lt;br /&gt;
*&#039;substr&#039; =&amp;gt; array(&#039;substr&#039;, &#039;substr&#039;, &#039;Return part of a string&#039;, &#039;string substr(string, start &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, length])&#039;, &#039;http://www.php.net/manual/en/function.substr.php&#039;, 2,3),&lt;br /&gt;
&lt;br /&gt;
The syntax for each function (func) is:&lt;br /&gt;
*&#039;&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;func&#039;&#039;&#039;&amp;lt;/span&amp;gt;&#039; =&amp;gt; array(&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;details&#039;&#039;&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
The details which must be included in the array are:&lt;br /&gt;
#PHP function name - this is the PHP function that will be called for that func.&lt;br /&gt;
#JavaScript function name - this is the JavaScript function that will be called for that function&lt;br /&gt;
#Meaning - this is a short description of what the function does&lt;br /&gt;
#Syntax - this shows the valid syntax for the function&lt;br /&gt;
#Reference - this is an optional URL showing more details about the syntax (e.g. a link to the PHP documentation)&lt;br /&gt;
#Number of required arguments&lt;br /&gt;
**Multiple values are allowed at the end of the array.  For example, substr() above can take 2 or 3 arguments&lt;br /&gt;
**Negative values mean that the function accepts a variable number of arguments&lt;br /&gt;
**Negative values less than -1 mean that the function requires at least abs(N)-1 arguments (so -2 means it requires at least 1 argument)&lt;br /&gt;
&lt;br /&gt;
If you add a function that does not exist in PHP, then add it to the body of em_core_helper.php&lt;br /&gt;
*FIXME:  Eventually we should separate out such add-on functions into their own php file&lt;br /&gt;
&lt;br /&gt;
If you add a function that does not exist in JavaScript, then add it to the body of em_javascript.js&lt;br /&gt;
&lt;br /&gt;
Make sure to add Unit tests for new functions to UnitTestEvaluator&lt;br /&gt;
*Syntax is ExpectedResult~Expression, such as:&lt;br /&gt;
*212~5 + max(1,(2+3),(4 + (5 + 6)),[[]],[[7 + 8) + 9),( (10 + 11), 12),(13 + (14 * 15) - 16) )&lt;br /&gt;
&lt;br /&gt;
If your test case should return an error, use NULL as the expected value, like this:&lt;br /&gt;
*NULL~four * / seven&lt;br /&gt;
*NULL~(5 + 7) = 8&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=ExpressionScript_for_developers&amp;diff=25430</id>
		<title>ExpressionScript for developers</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=ExpressionScript_for_developers&amp;diff=25430"/>
		<updated>2013-05-13T15:13:07Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: Updated path; reformatted markup&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
This wiki page is meant for the LimeSurvey development team and others wishing to contribute to LimeSurvey.  It provides details about how to work with, test, and extend Expression Manager (EM).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note, this document is currently incomplete.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Started==&lt;br /&gt;
&lt;br /&gt;
The best way to get started with EM is to:&lt;br /&gt;
*Install [http://www.limesurvey.org/en/download LimeSurvey 1.92]&lt;br /&gt;
*Load and play with the Expression Manager demos (located in /docs/demosurveys of the distribution)&lt;br /&gt;
*Navigate through all of the test cases&lt;br /&gt;
**Select a survey, click Tools, then Expression Manager&lt;br /&gt;
*Read the documentation&lt;br /&gt;
**Main user documentation for [[Expression Manager|Expression Manager]]&lt;br /&gt;
**Expression Manager [[Expression Manager HowTos|How Tos]]&lt;br /&gt;
&lt;br /&gt;
==EM Source Code Organization and Purpose==&lt;br /&gt;
=== ExpressionManager (EM) ===&lt;br /&gt;
&lt;br /&gt;
Implements a [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser] in PHP and JavaScript which let you create variables and securely expose a specified set of pre-defined functions.&lt;br /&gt;
&lt;br /&gt;
==== Location ==== &lt;br /&gt;
&lt;br /&gt;
* Version 1.92:  /classes/expressions/ExpressionManager.php&lt;br /&gt;
* Version 2.0:  /application/helpers/expressions/em_core_helper.php&lt;br /&gt;
&lt;br /&gt;
==== Recursive Descent Parser (all variables and functions starting with &#039;&#039;RDP_&#039;&#039;) ====&lt;br /&gt;
&lt;br /&gt;
* This is the core of EM, a compiler which builds and evaluates the parse tree for the expression&lt;br /&gt;
* Unless you are an expert in compiler theory, you should not touch the RDP_ code.&lt;br /&gt;
&lt;br /&gt;
==== API Functions to the RDP ====&lt;br /&gt;
&lt;br /&gt;
* RegisterFunctions - an interface to add external functions to EM&lt;br /&gt;
* sProcessStringContainingExpressions() - splits string on expressions, evaluates each, then joins together the parts&lt;br /&gt;
* ProcessBooleanExpression() - evaluates whether an equation (not surrounded by curly braces) is true&lt;br /&gt;
* Get*() - returns information about the most recently processed expressions&lt;br /&gt;
&lt;br /&gt;
=== LimeExpressionManager (LEM) ===&lt;br /&gt;
&lt;br /&gt;
This centralizes the integration of LimeSurvey with EM&lt;br /&gt;
&lt;br /&gt;
==== Location ====&lt;br /&gt;
* Version 1.92:  /classes/expressions/LimeExpressionManager.php&lt;br /&gt;
* Version 2.0:  /application/helpers/admin/expressions/em_manager_helper.php&lt;br /&gt;
&lt;br /&gt;
==== Navigation Functions ====&lt;br /&gt;
These process the current responses, update the database, find the next relevant set of questions, and create the metadata needed to render those questions&lt;br /&gt;
&lt;br /&gt;
* NavigateForwards()&lt;br /&gt;
* NavigateBackwards()&lt;br /&gt;
* JumpTo()&lt;br /&gt;
* GetLastMoveResult()&lt;br /&gt;
&lt;br /&gt;
==== Initialization Functions ====&lt;br /&gt;
&lt;br /&gt;
* StartSurvey() - initializes the survey, setting all variable mappings&lt;br /&gt;
* setVariableAndTokenMappingsForExpressionManager() - post-processes CreateFieldMap() to create metadata needed for all variables and token values&lt;br /&gt;
* _CreateSubQLevelRelevanceAndValidationEquations() - processes advanced question attributes such as array_filter, min_answers, and min_value&lt;br /&gt;
* ProcessAllNeededRelevance() - computes the relevance results (and JavaScript) for all applicable questions&lt;br /&gt;
* _ProcessGroupRelevance() - computes the relevance of a group based upon its own relevance criteria and the status of the questions it contains.&lt;br /&gt;
&lt;br /&gt;
==== Functions to Generate Tailored Content ====&lt;br /&gt;
* StartProcessingPage() - called at beginning of each page&lt;br /&gt;
* StartProcessingGroup() - called for each group on a page&lt;br /&gt;
* FinishProcessingGroup() - collects all tailoring for this group so can render appropriate JavaScript&lt;br /&gt;
* FinishProcessingPage() - completes the EM-related processing, and serializes LEM into $_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;LEMsingleton&#039;]&lt;br /&gt;
* GetRelevanceAndTailoringJavaScript() - collects all relevance, validation, and tailoring logic and generates ExprMgr_process_relevance_and_tailoring() JavaScript function&lt;br /&gt;
&lt;br /&gt;
==== Response Management ====&lt;br /&gt;
*ProcessCurrentResponses() - validates and processes the $_POSTed responses&lt;br /&gt;
*_UpdateValuesInDatabase() - saves values to database, including NULLing irrelevant values&lt;br /&gt;
&lt;br /&gt;
==== Caching ====&lt;br /&gt;
LEM tries to avoid calling the Initialization functions each page, storing state in $_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;LEMsingleton&#039;]&lt;br /&gt;
* SetDirtyFlag() - when called, tells LEM to force a rebuild of the Initialization functions (e.g. of admin has added/removed/updated any questions, groups, conditions, or defaults)&lt;br /&gt;
* SetSurveyId()- calls SetDirtyFlag if the user wants to work with a different survey from the one that is cached&lt;br /&gt;
* SetEMLanguage() - calls SetDirtyFlag() if the user starts  to use a language different from the cached one&lt;br /&gt;
&lt;br /&gt;
==== Validation Functions ====&lt;br /&gt;
* _ValidateSurvey() - validates the entire survey by calling _ValidateGroup()&lt;br /&gt;
* _ValidatGroup() - validates a group and returns its status by calling _ValidateQuestion() on all of its questions&lt;br /&gt;
* _ValidateQuestion() - validates a question, determining whether it is relevant, hidden, or fails any validation and/or mandatory criteria&lt;br /&gt;
&lt;br /&gt;
===EM-related JavaScript===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92: /classes/expressions/em_javascript.js&lt;br /&gt;
**Version 2.0: /scripts/admin/expressions/em_javascript.js&lt;br /&gt;
*Purpose - contains all of the custom javascript needed for EM&lt;br /&gt;
====JavaScript equivalents of PHP functions====&lt;br /&gt;
About 20 functions from phpjs.org&lt;br /&gt;
====Core Functions====&lt;br /&gt;
*LEManyNA() - checks whether any of the variables are irrelevant&lt;br /&gt;
*LEMval() - retrieves the value for any variable, or its metadata (via the dot notation syntax)&lt;br /&gt;
*LEMsetTabIndexes() - ensures that the tab sequence will act as expected even if input elements change visibility.&lt;br /&gt;
===EM-related Test Cases===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92: /classes/expressions/test/*.php&lt;br /&gt;
**Version 2.0:  /application/views/admin/expressions/*&lt;br /&gt;
*Purpose&lt;br /&gt;
**&#039;&#039;&#039;Available Functions&#039;&#039;&#039; - runs EM::ShowAllowableFunctions to display functions and syntax from EM-&amp;gt;RDP_ValidFunctions&lt;br /&gt;
**&#039;&#039;&#039;String Splitter&#039;&#039;&#039; - runs EM::UnitTestStringSplitter() to show how it parses strings with curly braces&lt;br /&gt;
**&#039;&#039;&#039;Tokenizer&#039;&#039;&#039; - runs EM::UnitTestTokenizer() to show how EM detects and categorizes tokens (e.g. variables, string, functions, operators)&lt;br /&gt;
**&#039;&#039;&#039;Unit Tests of Isolated Expressions&#039;&#039;&#039; - runs EM::UnitTestEvaluator() for unit tests of each of Expression Manager&#039;s features (e.g. all operators and functions). Color coding shows whether any tests fail. Syntax highlighting shows cases where Expression Manager properly detects bad syntax.&lt;br /&gt;
**&#039;&#039;&#039;Unit Tests of Expressions Within Strings&#039;&#039;&#039; - runs LEM::UnitTestProcessStringContainingExpressions() to show how Expression Manager can process strings containing one or more variable, token, or expression replacements surrounded by curly braces.&lt;br /&gt;
**&#039;&#039;&#039;Unit Test Dynamic Relevance Processing&#039;&#039;&#039; - runs LEM::UnitTestRelevance() to show how questions and substitutions should dynamically change based upon values entered.&lt;br /&gt;
**&#039;&#039;&#039;Preview Conversion of Conditions to Relevance&#039;&#039;&#039; - runs LEM::UnitTestConvertConditionsToRelevance() to show relevance equations for all conditions in the database, grouped by question id&lt;br /&gt;
**&#039;&#039;&#039;Bulk Convert Conditions to Relevance&#039;&#039;&#039; - actually performs the conversion, saving the generated relevance  equations (while retaining the original conditions)&lt;br /&gt;
**&#039;&#039;&#039;Test Navigation&#039;&#039;&#039; - unit tests LEM::NavigateForwards() for the selected survey, generating the following information based upon the selected debugging options:&lt;br /&gt;
***Detailed Timing - shows low-level timing information for each part of EM (e.g. to examine duration of database calls)&lt;br /&gt;
***Validation Summary - shows one line per group and question, showing its relevance equation, and indicating whether it was irrelevant, hidden, mandatory and/or failed validation criteria.  Also shows the generated SQL per navigation step to update the database&lt;br /&gt;
***Validation Detail - shows extra details per question, including&lt;br /&gt;
****Validation Tip, Equation, JavaScript equivalent of the Equation&lt;br /&gt;
****Lists of sub-questions; which are relevant; and which are unanswered&lt;br /&gt;
****List of array filters applied, by sub-question&lt;br /&gt;
***Pretty Print Syntax - syntax highlights all of the equations so that you can see errors, and also click on variable names to jump to those questions and edit them.&lt;br /&gt;
**&#039;&#039;&#039;Show Survey Logic File&#039;&#039;&#039; - generates the logic file which is available via the &amp;quot;QA&amp;quot; buttons in the admin console.&lt;br /&gt;
&lt;br /&gt;
==How EM Works==&lt;br /&gt;
&lt;br /&gt;
===What is an Expression?===&lt;br /&gt;
&lt;br /&gt;
Anything surrounded by curly braces is an Expression, with two exceptions:&lt;br /&gt;
If there is whitespace after the opening brace or before the closing brace, it is ignored.&lt;br /&gt;
*This is so that EM can ignore embedded JavaScript.&lt;br /&gt;
*So, if you have JavaScript that might be parsed by EM, make sure to add a space or newline  after the opening brace.&lt;br /&gt;
#Escaped curly braces are ignored (e.g. &amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;\{&#039;&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;\}&#039;&#039;&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Note that EM does support Expressions within strings.  Moreover, Expressions can contain nested strings, but not nested expressions.  So, the following red sections are valid Expressions and will cause substitions to occur within the containing strings.&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{Q1}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{if(Q1==&amp;quot;Y&amp;quot;,&#039;yes&#039;,&#039;no&#039;)}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{if(Q1==&amp;quot;Y&amp;quot;,&#039;single quote with {nested braces}&#039;,&amp;quot;double quote with {nested braces}&amp;quot;)}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===What does EM do with text containing expressions?===&lt;br /&gt;
#A regular expression divides the source line into STRING and EXPRESSION tokens&lt;br /&gt;
#Each EXPRESSION is parsed by ExpressionManager, a [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser].&lt;br /&gt;
##If there are syntax errors, EM returns an HTML string that syntax-highlights the equation and puts red-lined boxes around syntax errors&lt;br /&gt;
##If there are no syntax errors, EM returns the result of evaluating the expression&lt;br /&gt;
#EM re-joins the STRING and EM-evaluated EXPRESSION parts.&lt;br /&gt;
#EM optionally appends the translation activity to structures used by GetRelevanceAndTailoringJavaScript()&lt;br /&gt;
&lt;br /&gt;
===How can we be sure that EM accurately parses the equations?===&lt;br /&gt;
&lt;br /&gt;
EM was originally written in 1999-2000 by Dr. Tom White (TMSWhite) for a different project (Dialogix) in Java, using [http://en.wikipedia.org/wiki/JavaCC JavaCC], an open source compiler compiler (parser generator).  That Java-based project has been in production for over a decade, and has been fully vetted for unit and integration tests.&lt;br /&gt;
&lt;br /&gt;
Since there is no production-grade parser generator for PHP and JavaScript (although [http://www.antlr.org/ Antlr] is coming close), TMSWhite created a custom [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser] for LimeSurvey.  To ensure its accuracy, EM&#039;s logic is based upon the JavaCC source code for Dialogix.  The JavaCC syntax mirrors the functionality needed for a recursive descent parser.  JavaCC happens to build a state-based compiler, which is a little more efficient than a recusive descent parser.  However, state-based compilers are impossible to read, understand,  or expand without JavaCC-like source code, so it did not make sense to try to port the JavaCC output directly to PHP.&lt;br /&gt;
&lt;br /&gt;
Futhermore, there are comprehensive unit and integration test suites for EM. These make it easy to validate the accuracy of the EM system.  Each test suite includes dozens to hundreds of test cases, and it is trivial to add addition test cases.&lt;br /&gt;
&lt;br /&gt;
===How does the Recursive Descent Parser work?===&lt;br /&gt;
&lt;br /&gt;
EM must do the following:&lt;br /&gt;
#Tokenize the expression - separating strings, words (variable names vs. functions), and punctuation; and categorizing the types of each.&lt;br /&gt;
#Analyze the tokens to build a parse tree, checking for syntax errors along the way.&lt;br /&gt;
#Return the result of evaluating the expression (using PHP) (or return syntax-highlighted HTML if there are syntax errors).&lt;br /&gt;
#Create a safe JavaScript equivalent of the expression so that expressions can be  dynamically re-computed client-side.&lt;br /&gt;
#Determine which variables are used in each expression (so can make sure they are available client-side).&lt;br /&gt;
&lt;br /&gt;
===How does EM integrate into LimeSurvey?===&lt;br /&gt;
&lt;br /&gt;
The LimeExpressionManager (LEM) class manages the integration of EM into LimeSurvey.  LEM must:&lt;br /&gt;
#Initialize all of the variables needed by LimeSurvey (e.g. for TOKENS, INSERTANS, and templatereplace())&lt;br /&gt;
#Know which Group and Question are being processed&lt;br /&gt;
#Record the results and metadata about all of the text that LimeSurvey asks it to process&lt;br /&gt;
#Output static HTML that reflects the results of that processing&lt;br /&gt;
#Output JavaScript that lets those results be dynamically re-computed if values on the page change.&lt;br /&gt;
&lt;br /&gt;
==Extending EM==&lt;br /&gt;
&lt;br /&gt;
===Adding Test Cases===&lt;br /&gt;
&lt;br /&gt;
Please do!  The testing frameworks are solid. You just need to add more tests following the examples in the code.&lt;br /&gt;
&lt;br /&gt;
===Adding Functions===&lt;br /&gt;
&lt;br /&gt;
Functions are stored in LimeExpressionManager::amValidFunctions[]. Some existing examples are:&lt;br /&gt;
*&#039;abs&#039; =&amp;gt; array(&#039;abs&#039;, &#039;Math.abs&#039;, &#039;Absolute value&#039;, &#039;number abs(number)&#039;, &#039;http://www.php.net/manual/en/function.checkdate.php&#039;, 1),&lt;br /&gt;
*&#039;if&#039; =&amp;gt; array(&#039;exprmgr_if&#039;, &#039;LEMif&#039;, &#039;Excel-style if(test,result_if_true,result_if_false)&#039;, &#039;if(test,result_if_true,result_if_false)&#039;, &#039;&#039;, 3),&lt;br /&gt;
*&#039;max&#039; =&amp;gt; array(&#039;max&#039;, &#039;Math.max&#039;, &#039;Find highest value&#039;, &#039;number max(arg1, arg2, ... argN)&#039;, &#039;http://www.php.net/manual/en/function.max.php&#039;, -2),&lt;br /&gt;
*&#039;substr&#039; =&amp;gt; array(&#039;substr&#039;, &#039;substr&#039;, &#039;Return part of a string&#039;, &#039;string substr(string, start &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, length])&#039;, &#039;http://www.php.net/manual/en/function.substr.php&#039;, 2,3),&lt;br /&gt;
&lt;br /&gt;
The syntax for each function (func) is:&lt;br /&gt;
*&#039;&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;func&#039;&#039;&#039;&amp;lt;/span&amp;gt;&#039; =&amp;gt; array(&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;details&#039;&#039;&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
The details which must be included in the array are:&lt;br /&gt;
#PHP function name - this is the PHP function that will be called for that func.&lt;br /&gt;
#JavaScript function name - this is the JavaScript function that will be called for that function&lt;br /&gt;
#Meaning - this is a short description of what the function does&lt;br /&gt;
#Syntax - this shows the valid syntax for the function&lt;br /&gt;
#Reference - this is an optional URL showing more details about the syntax (e.g. a link to the PHP documentation)&lt;br /&gt;
#Number of required arguments&lt;br /&gt;
**Multiple values are allowed at the end of the array.  For example, substr() above can take 2 or 3 arguments&lt;br /&gt;
**Negative values mean that the function accepts a variable number of arguments&lt;br /&gt;
**Negative values less than -1 mean that the function requires at least abs(N)-1 arguments (so -2 means it requires at least 1 argument)&lt;br /&gt;
&lt;br /&gt;
If you add a function that does not exist in PHP, then add it to the body of em_core_helper.php&lt;br /&gt;
*FIXME:  Eventually we should separate out such add-on functions into their own php file&lt;br /&gt;
&lt;br /&gt;
If you add a function that does not exist in JavaScript, then add it to the body of em_javascript.js&lt;br /&gt;
&lt;br /&gt;
Make sure to add Unit tests for new functions to UnitTestEvaluator&lt;br /&gt;
*Syntax is ExpectedResult~Expression, such as:&lt;br /&gt;
*212~5 + max(1,(2+3),(4 + (5 + 6)),[[]],[[7 + 8) + 9),( (10 + 11), 12),(13 + (14 * 15) - 16) )&lt;br /&gt;
&lt;br /&gt;
If your test case should return an error, use NULL as the expected value, like this:&lt;br /&gt;
*NULL~four * / seven&lt;br /&gt;
*NULL~(5 + 7) = 8&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=ExpressionScript_for_developers&amp;diff=25429</id>
		<title>ExpressionScript for developers</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=ExpressionScript_for_developers&amp;diff=25429"/>
		<updated>2013-05-13T15:10:55Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: re-ordered sentences&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
This wiki page is meant for the LimeSurvey development team and others wishing to contribute to LimeSurvey.  It provides details about how to work with, test, and extend Expression Manager (EM).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note, this document is currently incomplete.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Started==&lt;br /&gt;
&lt;br /&gt;
The best way to get started with EM is to:&lt;br /&gt;
*Install [http://www.limesurvey.org/en/download LimeSurvey 1.92]&lt;br /&gt;
*Load and play with the Expression Manager demos (located in /docs/demosurveys of the distribution)&lt;br /&gt;
*Navigate through all of the test cases&lt;br /&gt;
**Select a survey, click Tools, then Expression Manager&lt;br /&gt;
*Read the documentation&lt;br /&gt;
**Main user documentation for [[Expression Manager|Expression Manager]]&lt;br /&gt;
**Expression Manager [[Expression Manager HowTos|How Tos]]&lt;br /&gt;
&lt;br /&gt;
==EM Source Code Organization and Purpose==&lt;br /&gt;
=== ExpressionManager (EM) ===&lt;br /&gt;
&lt;br /&gt;
Implements a [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser] in PHP and JavaScript which let you create variables and securely expose a specified set of pre-defined functions.&lt;br /&gt;
&lt;br /&gt;
==== Location ==== &lt;br /&gt;
&lt;br /&gt;
* Version 1.92:  /classes/expressions/ExpressionManager.php&lt;br /&gt;
* Version 2.0:  /application/helpers/expressions/em_core_helper.php&lt;br /&gt;
&lt;br /&gt;
==== Recursive Descent Parser (all variables and functions starting with &#039;&#039;RDP_&#039;&#039;) ====&lt;br /&gt;
&lt;br /&gt;
* This is the core of EM, a compiler which builds and evaluates the parse tree for the expression&lt;br /&gt;
* Unless you are an expert in compiler theory, you should not touch the RDP_ code.&lt;br /&gt;
&lt;br /&gt;
==== API Functions to the RDP ====&lt;br /&gt;
&lt;br /&gt;
* RegisterFunctions - an interface to add external functions to EM&lt;br /&gt;
* sProcessStringContainingExpressions() - splits string on expressions, evaluates each, then joins together the parts&lt;br /&gt;
* ProcessBooleanExpression() - evaluates whether an equation (not surrounded by curly braces) is true&lt;br /&gt;
* Get*() - returns information about the most recently processed expressions&lt;br /&gt;
&lt;br /&gt;
===LimeExpressionManager (LEM)===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92:  /classes/expressions/LimeExpressionManager.php&lt;br /&gt;
**Version 2.0:  /application/helpers/admin/expressions/em_manager_helper.php&lt;br /&gt;
*Purpose - this centralizes the integration of LimeSurvey with EM&lt;br /&gt;
====Navigation Functions====&lt;br /&gt;
These process the current responses, update the database, find the next relevant set of questions, and create the metadata needed to render those questions&lt;br /&gt;
*NavigateForwards()&lt;br /&gt;
*NavigateBackwards()&lt;br /&gt;
*JumpTo()&lt;br /&gt;
*GetLastMoveResult() -&lt;br /&gt;
====Initialization Functions====&lt;br /&gt;
*StartSurvey() - initializes the survey, setting all variable mappings&lt;br /&gt;
*setVariableAndTokenMappingsForExpressionManager() - post-processes CreateFieldMap() to create metadata needed for all variables and token values&lt;br /&gt;
*_CreateSubQLevelRelevanceAndValidationEquations() - processes advanced question attributes such as array_filter, min_answers, and min_value&lt;br /&gt;
*ProcessAllNeededRelevance() - computes the relevance results (and JavaScript) for all applicable questions&lt;br /&gt;
*_ProcessGroupRelevance() - computes the relevance of a group based upon its own relevance criteria and the status of the questions it contains.&lt;br /&gt;
====Functions to Generate Tailored Content====&lt;br /&gt;
*StartProcessingPage() - called at beginning of each page&lt;br /&gt;
*StartProcessingGroup() - called for each group on a page&lt;br /&gt;
*FinishProcessingGroup() - collects all tailoring for this group so can render appropriate JavaScript&lt;br /&gt;
*FinishProcessingPage() - completes the EM-related processing, and serializes LEM into $_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;LEMsingleton&#039;]&lt;br /&gt;
*GetRelevanceAndTailoringJavaScript() - collects all relevance, validation, and tailoring logic and generates ExprMgr_process_relevance_and_tailoring() JavaScript function&lt;br /&gt;
====Response Management====&lt;br /&gt;
*ProcessCurrentResponses() - validates and processes the $_POSTed responses&lt;br /&gt;
*_UpdateValuesInDatabase() - saves values to database, including NULLing irrelevant values&lt;br /&gt;
====Caching ====&lt;br /&gt;
LEM tries to avoid calling the Initialization functions each page, storing state in $_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;LEMsingleton&#039;]&lt;br /&gt;
*SetDirtyFlag() - when called, tells LEM to force a rebuild of the Initialization functions (e.g. of admin has added/removed/updated any questions, groups, conditions, or defaults)&lt;br /&gt;
*SetSurveyId()- calls SetDirtyFlag if the user wants to work with a different survey from the one that is cached&lt;br /&gt;
*SetEMLanguage() - calls SetDirtyFlag() if the user starts  to use a language different from the cached one&lt;br /&gt;
====Validation Functions====&lt;br /&gt;
*_ValidateSurvey() - validates the entire survey by calling _ValidateGroup()&lt;br /&gt;
*_ValidatGroup() - validates a group and returns its status by calling _ValidateQuestion() on all of its questions&lt;br /&gt;
*_ValidateQuestion() - validates a question, determining whether it is relevant, hidden, or fails any validation and/or mandatory criteria&lt;br /&gt;
===EM-related JavaScript===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92: /classes/expressions/em_javascript.js&lt;br /&gt;
**Version 2.0: /scripts/admin/expressions/em_javascript.js&lt;br /&gt;
*Purpose - contains all of the custom javascript needed for EM&lt;br /&gt;
====JavaScript equivalents of PHP functions====&lt;br /&gt;
About 20 functions from phpjs.org&lt;br /&gt;
====Core Functions====&lt;br /&gt;
*LEManyNA() - checks whether any of the variables are irrelevant&lt;br /&gt;
*LEMval() - retrieves the value for any variable, or its metadata (via the dot notation syntax)&lt;br /&gt;
*LEMsetTabIndexes() - ensures that the tab sequence will act as expected even if input elements change visibility.&lt;br /&gt;
===EM-related Test Cases===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92: /classes/expressions/test/*.php&lt;br /&gt;
**Version 2.0:  /application/views/admin/expressions/*&lt;br /&gt;
*Purpose&lt;br /&gt;
**&#039;&#039;&#039;Available Functions&#039;&#039;&#039; - runs EM::ShowAllowableFunctions to display functions and syntax from EM-&amp;gt;RDP_ValidFunctions&lt;br /&gt;
**&#039;&#039;&#039;String Splitter&#039;&#039;&#039; - runs EM::UnitTestStringSplitter() to show how it parses strings with curly braces&lt;br /&gt;
**&#039;&#039;&#039;Tokenizer&#039;&#039;&#039; - runs EM::UnitTestTokenizer() to show how EM detects and categorizes tokens (e.g. variables, string, functions, operators)&lt;br /&gt;
**&#039;&#039;&#039;Unit Tests of Isolated Expressions&#039;&#039;&#039; - runs EM::UnitTestEvaluator() for unit tests of each of Expression Manager&#039;s features (e.g. all operators and functions). Color coding shows whether any tests fail. Syntax highlighting shows cases where Expression Manager properly detects bad syntax.&lt;br /&gt;
**&#039;&#039;&#039;Unit Tests of Expressions Within Strings&#039;&#039;&#039; - runs LEM::UnitTestProcessStringContainingExpressions() to show how Expression Manager can process strings containing one or more variable, token, or expression replacements surrounded by curly braces.&lt;br /&gt;
**&#039;&#039;&#039;Unit Test Dynamic Relevance Processing&#039;&#039;&#039; - runs LEM::UnitTestRelevance() to show how questions and substitutions should dynamically change based upon values entered.&lt;br /&gt;
**&#039;&#039;&#039;Preview Conversion of Conditions to Relevance&#039;&#039;&#039; - runs LEM::UnitTestConvertConditionsToRelevance() to show relevance equations for all conditions in the database, grouped by question id&lt;br /&gt;
**&#039;&#039;&#039;Bulk Convert Conditions to Relevance&#039;&#039;&#039; - actually performs the conversion, saving the generated relevance  equations (while retaining the original conditions)&lt;br /&gt;
**&#039;&#039;&#039;Test Navigation&#039;&#039;&#039; - unit tests LEM::NavigateForwards() for the selected survey, generating the following information based upon the selected debugging options:&lt;br /&gt;
***Detailed Timing - shows low-level timing information for each part of EM (e.g. to examine duration of database calls)&lt;br /&gt;
***Validation Summary - shows one line per group and question, showing its relevance equation, and indicating whether it was irrelevant, hidden, mandatory and/or failed validation criteria.  Also shows the generated SQL per navigation step to update the database&lt;br /&gt;
***Validation Detail - shows extra details per question, including&lt;br /&gt;
****Validation Tip, Equation, JavaScript equivalent of the Equation&lt;br /&gt;
****Lists of sub-questions; which are relevant; and which are unanswered&lt;br /&gt;
****List of array filters applied, by sub-question&lt;br /&gt;
***Pretty Print Syntax - syntax highlights all of the equations so that you can see errors, and also click on variable names to jump to those questions and edit them.&lt;br /&gt;
**&#039;&#039;&#039;Show Survey Logic File&#039;&#039;&#039; - generates the logic file which is available via the &amp;quot;QA&amp;quot; buttons in the admin console.&lt;br /&gt;
&lt;br /&gt;
==How EM Works==&lt;br /&gt;
&lt;br /&gt;
===What is an Expression?===&lt;br /&gt;
&lt;br /&gt;
Anything surrounded by curly braces is an Expression, with two exceptions:&lt;br /&gt;
If there is whitespace after the opening brace or before the closing brace, it is ignored.&lt;br /&gt;
*This is so that EM can ignore embedded JavaScript.&lt;br /&gt;
*So, if you have JavaScript that might be parsed by EM, make sure to add a space or newline  after the opening brace.&lt;br /&gt;
#Escaped curly braces are ignored (e.g. &amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;\{&#039;&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;\}&#039;&#039;&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Note that EM does support Expressions within strings.  Moreover, Expressions can contain nested strings, but not nested expressions.  So, the following red sections are valid Expressions and will cause substitions to occur within the containing strings.&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{Q1}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{if(Q1==&amp;quot;Y&amp;quot;,&#039;yes&#039;,&#039;no&#039;)}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{if(Q1==&amp;quot;Y&amp;quot;,&#039;single quote with {nested braces}&#039;,&amp;quot;double quote with {nested braces}&amp;quot;)}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===What does EM do with text containing expressions?===&lt;br /&gt;
#A regular expression divides the source line into STRING and EXPRESSION tokens&lt;br /&gt;
#Each EXPRESSION is parsed by ExpressionManager, a [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser].&lt;br /&gt;
##If there are syntax errors, EM returns an HTML string that syntax-highlights the equation and puts red-lined boxes around syntax errors&lt;br /&gt;
##If there are no syntax errors, EM returns the result of evaluating the expression&lt;br /&gt;
#EM re-joins the STRING and EM-evaluated EXPRESSION parts.&lt;br /&gt;
#EM optionally appends the translation activity to structures used by GetRelevanceAndTailoringJavaScript()&lt;br /&gt;
&lt;br /&gt;
===How can we be sure that EM accurately parses the equations?===&lt;br /&gt;
&lt;br /&gt;
EM was originally written in 1999-2000 by Dr. Tom White (TMSWhite) for a different project (Dialogix) in Java, using [http://en.wikipedia.org/wiki/JavaCC JavaCC], an open source compiler compiler (parser generator).  That Java-based project has been in production for over a decade, and has been fully vetted for unit and integration tests.&lt;br /&gt;
&lt;br /&gt;
Since there is no production-grade parser generator for PHP and JavaScript (although [http://www.antlr.org/ Antlr] is coming close), TMSWhite created a custom [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser] for LimeSurvey.  To ensure its accuracy, EM&#039;s logic is based upon the JavaCC source code for Dialogix.  The JavaCC syntax mirrors the functionality needed for a recursive descent parser.  JavaCC happens to build a state-based compiler, which is a little more efficient than a recusive descent parser.  However, state-based compilers are impossible to read, understand,  or expand without JavaCC-like source code, so it did not make sense to try to port the JavaCC output directly to PHP.&lt;br /&gt;
&lt;br /&gt;
Futhermore, there are comprehensive unit and integration test suites for EM. These make it easy to validate the accuracy of the EM system.  Each test suite includes dozens to hundreds of test cases, and it is trivial to add addition test cases.&lt;br /&gt;
&lt;br /&gt;
===How does the Recursive Descent Parser work?===&lt;br /&gt;
&lt;br /&gt;
EM must do the following:&lt;br /&gt;
#Tokenize the expression - separating strings, words (variable names vs. functions), and punctuation; and categorizing the types of each.&lt;br /&gt;
#Analyze the tokens to build a parse tree, checking for syntax errors along the way.&lt;br /&gt;
#Return the result of evaluating the expression (using PHP) (or return syntax-highlighted HTML if there are syntax errors).&lt;br /&gt;
#Create a safe JavaScript equivalent of the expression so that expressions can be  dynamically re-computed client-side.&lt;br /&gt;
#Determine which variables are used in each expression (so can make sure they are available client-side).&lt;br /&gt;
&lt;br /&gt;
===How does EM integrate into LimeSurvey?===&lt;br /&gt;
&lt;br /&gt;
The LimeExpressionManager (LEM) class manages the integration of EM into LimeSurvey.  LEM must:&lt;br /&gt;
#Initialize all of the variables needed by LimeSurvey (e.g. for TOKENS, INSERTANS, and templatereplace())&lt;br /&gt;
#Know which Group and Question are being processed&lt;br /&gt;
#Record the results and metadata about all of the text that LimeSurvey asks it to process&lt;br /&gt;
#Output static HTML that reflects the results of that processing&lt;br /&gt;
#Output JavaScript that lets those results be dynamically re-computed if values on the page change.&lt;br /&gt;
&lt;br /&gt;
==Extending EM==&lt;br /&gt;
&lt;br /&gt;
===Adding Test Cases===&lt;br /&gt;
&lt;br /&gt;
Please do!  The testing frameworks are solid. You just need to add more tests following the examples in the code.&lt;br /&gt;
&lt;br /&gt;
===Adding Functions===&lt;br /&gt;
&lt;br /&gt;
Functions are stored in LimeExpressionManager::amValidFunctions[]. Some existing examples are:&lt;br /&gt;
*&#039;abs&#039; =&amp;gt; array(&#039;abs&#039;, &#039;Math.abs&#039;, &#039;Absolute value&#039;, &#039;number abs(number)&#039;, &#039;http://www.php.net/manual/en/function.checkdate.php&#039;, 1),&lt;br /&gt;
*&#039;if&#039; =&amp;gt; array(&#039;exprmgr_if&#039;, &#039;LEMif&#039;, &#039;Excel-style if(test,result_if_true,result_if_false)&#039;, &#039;if(test,result_if_true,result_if_false)&#039;, &#039;&#039;, 3),&lt;br /&gt;
*&#039;max&#039; =&amp;gt; array(&#039;max&#039;, &#039;Math.max&#039;, &#039;Find highest value&#039;, &#039;number max(arg1, arg2, ... argN)&#039;, &#039;http://www.php.net/manual/en/function.max.php&#039;, -2),&lt;br /&gt;
*&#039;substr&#039; =&amp;gt; array(&#039;substr&#039;, &#039;substr&#039;, &#039;Return part of a string&#039;, &#039;string substr(string, start &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, length])&#039;, &#039;http://www.php.net/manual/en/function.substr.php&#039;, 2,3),&lt;br /&gt;
&lt;br /&gt;
The syntax for each function (func) is:&lt;br /&gt;
*&#039;&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;func&#039;&#039;&#039;&amp;lt;/span&amp;gt;&#039; =&amp;gt; array(&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;details&#039;&#039;&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
The details which must be included in the array are:&lt;br /&gt;
#PHP function name - this is the PHP function that will be called for that func.&lt;br /&gt;
#JavaScript function name - this is the JavaScript function that will be called for that function&lt;br /&gt;
#Meaning - this is a short description of what the function does&lt;br /&gt;
#Syntax - this shows the valid syntax for the function&lt;br /&gt;
#Reference - this is an optional URL showing more details about the syntax (e.g. a link to the PHP documentation)&lt;br /&gt;
#Number of required arguments&lt;br /&gt;
**Multiple values are allowed at the end of the array.  For example, substr() above can take 2 or 3 arguments&lt;br /&gt;
**Negative values mean that the function accepts a variable number of arguments&lt;br /&gt;
**Negative values less than -1 mean that the function requires at least abs(N)-1 arguments (so -2 means it requires at least 1 argument)&lt;br /&gt;
&lt;br /&gt;
If you add a function that does not exist in PHP, then add it to the body of em_core_helper.php&lt;br /&gt;
*FIXME:  Eventually we should separate out such add-on functions into their own php file&lt;br /&gt;
&lt;br /&gt;
If you add a function that does not exist in JavaScript, then add it to the body of em_javascript.js&lt;br /&gt;
&lt;br /&gt;
Make sure to add Unit tests for new functions to UnitTestEvaluator&lt;br /&gt;
*Syntax is ExpectedResult~Expression, such as:&lt;br /&gt;
*212~5 + max(1,(2+3),(4 + (5 + 6)),[[]],[[7 + 8) + 9),( (10 + 11), 12),(13 + (14 * 15) - 16) )&lt;br /&gt;
&lt;br /&gt;
If your test case should return an error, use NULL as the expected value, like this:&lt;br /&gt;
*NULL~four * / seven&lt;br /&gt;
*NULL~(5 + 7) = 8&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=ExpressionScript_for_developers&amp;diff=25428</id>
		<title>ExpressionScript for developers</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=ExpressionScript_for_developers&amp;diff=25428"/>
		<updated>2013-05-13T14:52:41Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: Updated path for version 2; reformatted markup&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
This wiki page is meant for the LimeSurvey development team and others wishing to contribute to LimeSurvey.  It provides details about how to work with, test, and extend Expression Manager (EM).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note, this document is currently incomplete.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Started==&lt;br /&gt;
&lt;br /&gt;
The best way to get started with EM is to:&lt;br /&gt;
*Install [http://www.limesurvey.org/en/download LimeSurvey 1.92]&lt;br /&gt;
*Load and play with the Expression Manager demos (located in /docs/demosurveys of the distribution)&lt;br /&gt;
*Navigate through all of the test cases&lt;br /&gt;
**Select a survey, click Tools, then Expression Manager&lt;br /&gt;
*Read the documentation&lt;br /&gt;
**Main user documentation for [[Expression Manager|Expression Manager]]&lt;br /&gt;
**Expression Manager [[Expression Manager HowTos|How Tos]]&lt;br /&gt;
&lt;br /&gt;
==EM Source Code Organization and Purpose==&lt;br /&gt;
=== ExpressionManager (EM) ===&lt;br /&gt;
&lt;br /&gt;
==== Location ====&lt;br /&gt;
* Version 1.92:  /classes/expressions/ExpressionManager.php&lt;br /&gt;
* Version 2.0:  /application/helpers/expressions/em_core_helper.php&lt;br /&gt;
&lt;br /&gt;
==== Purpose ====&lt;br /&gt;
Implements a [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser] in PHP and JavaScript which let you create variables and securely expose a specified set of pre-defined functions.&lt;br /&gt;
&lt;br /&gt;
==== Recursive Descent Parser (all variables and functions starting with &#039;&#039;RDP_&#039;&#039;) ====&lt;br /&gt;
&lt;br /&gt;
* This is the core of EM, a compiler which builds and evaluates the parse tree for the expression&lt;br /&gt;
* Unless you are an expert in compiler theory, you should not touch the RDP_ code.&lt;br /&gt;
&lt;br /&gt;
==== API Functions to the RDP ====&lt;br /&gt;
&lt;br /&gt;
* RegisterFunctions - an interface to add external functions to EM&lt;br /&gt;
* sProcessStringContainingExpressions() - splits string on expressions, evaluates each, then joins together the parts&lt;br /&gt;
* ProcessBooleanExpression() - evaluates whether an equation (not surrounded by curly braces) is true&lt;br /&gt;
* Get*() - returns information about the most recently processed expressions&lt;br /&gt;
&lt;br /&gt;
===LimeExpressionManager (LEM)===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92:  /classes/expressions/LimeExpressionManager.php&lt;br /&gt;
**Version 2.0:  /application/helpers/admin/expressions/em_manager_helper.php&lt;br /&gt;
*Purpose - this centralizes the integration of LimeSurvey with EM&lt;br /&gt;
====Navigation Functions====&lt;br /&gt;
These process the current responses, update the database, find the next relevant set of questions, and create the metadata needed to render those questions&lt;br /&gt;
*NavigateForwards()&lt;br /&gt;
*NavigateBackwards()&lt;br /&gt;
*JumpTo()&lt;br /&gt;
*GetLastMoveResult() -&lt;br /&gt;
====Initialization Functions====&lt;br /&gt;
*StartSurvey() - initializes the survey, setting all variable mappings&lt;br /&gt;
*setVariableAndTokenMappingsForExpressionManager() - post-processes CreateFieldMap() to create metadata needed for all variables and token values&lt;br /&gt;
*_CreateSubQLevelRelevanceAndValidationEquations() - processes advanced question attributes such as array_filter, min_answers, and min_value&lt;br /&gt;
*ProcessAllNeededRelevance() - computes the relevance results (and JavaScript) for all applicable questions&lt;br /&gt;
*_ProcessGroupRelevance() - computes the relevance of a group based upon its own relevance criteria and the status of the questions it contains.&lt;br /&gt;
====Functions to Generate Tailored Content====&lt;br /&gt;
*StartProcessingPage() - called at beginning of each page&lt;br /&gt;
*StartProcessingGroup() - called for each group on a page&lt;br /&gt;
*FinishProcessingGroup() - collects all tailoring for this group so can render appropriate JavaScript&lt;br /&gt;
*FinishProcessingPage() - completes the EM-related processing, and serializes LEM into $_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;LEMsingleton&#039;]&lt;br /&gt;
*GetRelevanceAndTailoringJavaScript() - collects all relevance, validation, and tailoring logic and generates ExprMgr_process_relevance_and_tailoring() JavaScript function&lt;br /&gt;
====Response Management====&lt;br /&gt;
*ProcessCurrentResponses() - validates and processes the $_POSTed responses&lt;br /&gt;
*_UpdateValuesInDatabase() - saves values to database, including NULLing irrelevant values&lt;br /&gt;
====Caching ====&lt;br /&gt;
LEM tries to avoid calling the Initialization functions each page, storing state in $_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;LEMsingleton&#039;]&lt;br /&gt;
*SetDirtyFlag() - when called, tells LEM to force a rebuild of the Initialization functions (e.g. of admin has added/removed/updated any questions, groups, conditions, or defaults)&lt;br /&gt;
*SetSurveyId()- calls SetDirtyFlag if the user wants to work with a different survey from the one that is cached&lt;br /&gt;
*SetEMLanguage() - calls SetDirtyFlag() if the user starts  to use a language different from the cached one&lt;br /&gt;
====Validation Functions====&lt;br /&gt;
*_ValidateSurvey() - validates the entire survey by calling _ValidateGroup()&lt;br /&gt;
*_ValidatGroup() - validates a group and returns its status by calling _ValidateQuestion() on all of its questions&lt;br /&gt;
*_ValidateQuestion() - validates a question, determining whether it is relevant, hidden, or fails any validation and/or mandatory criteria&lt;br /&gt;
===EM-related JavaScript===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92: /classes/expressions/em_javascript.js&lt;br /&gt;
**Version 2.0: /scripts/admin/expressions/em_javascript.js&lt;br /&gt;
*Purpose - contains all of the custom javascript needed for EM&lt;br /&gt;
====JavaScript equivalents of PHP functions====&lt;br /&gt;
About 20 functions from phpjs.org&lt;br /&gt;
====Core Functions====&lt;br /&gt;
*LEManyNA() - checks whether any of the variables are irrelevant&lt;br /&gt;
*LEMval() - retrieves the value for any variable, or its metadata (via the dot notation syntax)&lt;br /&gt;
*LEMsetTabIndexes() - ensures that the tab sequence will act as expected even if input elements change visibility.&lt;br /&gt;
===EM-related Test Cases===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92: /classes/expressions/test/*.php&lt;br /&gt;
**Version 2.0:  /application/views/admin/expressions/*&lt;br /&gt;
*Purpose&lt;br /&gt;
**&#039;&#039;&#039;Available Functions&#039;&#039;&#039; - runs EM::ShowAllowableFunctions to display functions and syntax from EM-&amp;gt;RDP_ValidFunctions&lt;br /&gt;
**&#039;&#039;&#039;String Splitter&#039;&#039;&#039; - runs EM::UnitTestStringSplitter() to show how it parses strings with curly braces&lt;br /&gt;
**&#039;&#039;&#039;Tokenizer&#039;&#039;&#039; - runs EM::UnitTestTokenizer() to show how EM detects and categorizes tokens (e.g. variables, string, functions, operators)&lt;br /&gt;
**&#039;&#039;&#039;Unit Tests of Isolated Expressions&#039;&#039;&#039; - runs EM::UnitTestEvaluator() for unit tests of each of Expression Manager&#039;s features (e.g. all operators and functions). Color coding shows whether any tests fail. Syntax highlighting shows cases where Expression Manager properly detects bad syntax.&lt;br /&gt;
**&#039;&#039;&#039;Unit Tests of Expressions Within Strings&#039;&#039;&#039; - runs LEM::UnitTestProcessStringContainingExpressions() to show how Expression Manager can process strings containing one or more variable, token, or expression replacements surrounded by curly braces.&lt;br /&gt;
**&#039;&#039;&#039;Unit Test Dynamic Relevance Processing&#039;&#039;&#039; - runs LEM::UnitTestRelevance() to show how questions and substitutions should dynamically change based upon values entered.&lt;br /&gt;
**&#039;&#039;&#039;Preview Conversion of Conditions to Relevance&#039;&#039;&#039; - runs LEM::UnitTestConvertConditionsToRelevance() to show relevance equations for all conditions in the database, grouped by question id&lt;br /&gt;
**&#039;&#039;&#039;Bulk Convert Conditions to Relevance&#039;&#039;&#039; - actually performs the conversion, saving the generated relevance  equations (while retaining the original conditions)&lt;br /&gt;
**&#039;&#039;&#039;Test Navigation&#039;&#039;&#039; - unit tests LEM::NavigateForwards() for the selected survey, generating the following information based upon the selected debugging options:&lt;br /&gt;
***Detailed Timing - shows low-level timing information for each part of EM (e.g. to examine duration of database calls)&lt;br /&gt;
***Validation Summary - shows one line per group and question, showing its relevance equation, and indicating whether it was irrelevant, hidden, mandatory and/or failed validation criteria.  Also shows the generated SQL per navigation step to update the database&lt;br /&gt;
***Validation Detail - shows extra details per question, including&lt;br /&gt;
****Validation Tip, Equation, JavaScript equivalent of the Equation&lt;br /&gt;
****Lists of sub-questions; which are relevant; and which are unanswered&lt;br /&gt;
****List of array filters applied, by sub-question&lt;br /&gt;
***Pretty Print Syntax - syntax highlights all of the equations so that you can see errors, and also click on variable names to jump to those questions and edit them.&lt;br /&gt;
**&#039;&#039;&#039;Show Survey Logic File&#039;&#039;&#039; - generates the logic file which is available via the &amp;quot;QA&amp;quot; buttons in the admin console.&lt;br /&gt;
&lt;br /&gt;
==How EM Works==&lt;br /&gt;
&lt;br /&gt;
===What is an Expression?===&lt;br /&gt;
&lt;br /&gt;
Anything surrounded by curly braces is an Expression, with two exceptions:&lt;br /&gt;
If there is whitespace after the opening brace or before the closing brace, it is ignored.&lt;br /&gt;
*This is so that EM can ignore embedded JavaScript.&lt;br /&gt;
*So, if you have JavaScript that might be parsed by EM, make sure to add a space or newline  after the opening brace.&lt;br /&gt;
#Escaped curly braces are ignored (e.g. &amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;\{&#039;&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;\}&#039;&#039;&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Note that EM does support Expressions within strings.  Moreover, Expressions can contain nested strings, but not nested expressions.  So, the following red sections are valid Expressions and will cause substitions to occur within the containing strings.&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{Q1}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{if(Q1==&amp;quot;Y&amp;quot;,&#039;yes&#039;,&#039;no&#039;)}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{if(Q1==&amp;quot;Y&amp;quot;,&#039;single quote with {nested braces}&#039;,&amp;quot;double quote with {nested braces}&amp;quot;)}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===What does EM do with text containing expressions?===&lt;br /&gt;
#A regular expression divides the source line into STRING and EXPRESSION tokens&lt;br /&gt;
#Each EXPRESSION is parsed by ExpressionManager, a [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser].&lt;br /&gt;
##If there are syntax errors, EM returns an HTML string that syntax-highlights the equation and puts red-lined boxes around syntax errors&lt;br /&gt;
##If there are no syntax errors, EM returns the result of evaluating the expression&lt;br /&gt;
#EM re-joins the STRING and EM-evaluated EXPRESSION parts.&lt;br /&gt;
#EM optionally appends the translation activity to structures used by GetRelevanceAndTailoringJavaScript()&lt;br /&gt;
&lt;br /&gt;
===How can we be sure that EM accurately parses the equations?===&lt;br /&gt;
&lt;br /&gt;
EM was originally written in 1999-2000 by Dr. Tom White (TMSWhite) for a different project (Dialogix) in Java, using [http://en.wikipedia.org/wiki/JavaCC JavaCC], an open source compiler compiler (parser generator).  That Java-based project has been in production for over a decade, and has been fully vetted for unit and integration tests.&lt;br /&gt;
&lt;br /&gt;
Since there is no production-grade parser generator for PHP and JavaScript (although [http://www.antlr.org/ Antlr] is coming close), TMSWhite created a custom [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser] for LimeSurvey.  To ensure its accuracy, EM&#039;s logic is based upon the JavaCC source code for Dialogix.  The JavaCC syntax mirrors the functionality needed for a recursive descent parser.  JavaCC happens to build a state-based compiler, which is a little more efficient than a recusive descent parser.  However, state-based compilers are impossible to read, understand,  or expand without JavaCC-like source code, so it did not make sense to try to port the JavaCC output directly to PHP.&lt;br /&gt;
&lt;br /&gt;
Futhermore, there are comprehensive unit and integration test suites for EM. These make it easy to validate the accuracy of the EM system.  Each test suite includes dozens to hundreds of test cases, and it is trivial to add addition test cases.&lt;br /&gt;
&lt;br /&gt;
===How does the Recursive Descent Parser work?===&lt;br /&gt;
&lt;br /&gt;
EM must do the following:&lt;br /&gt;
#Tokenize the expression - separating strings, words (variable names vs. functions), and punctuation; and categorizing the types of each.&lt;br /&gt;
#Analyze the tokens to build a parse tree, checking for syntax errors along the way.&lt;br /&gt;
#Return the result of evaluating the expression (using PHP) (or return syntax-highlighted HTML if there are syntax errors).&lt;br /&gt;
#Create a safe JavaScript equivalent of the expression so that expressions can be  dynamically re-computed client-side.&lt;br /&gt;
#Determine which variables are used in each expression (so can make sure they are available client-side).&lt;br /&gt;
&lt;br /&gt;
===How does EM integrate into LimeSurvey?===&lt;br /&gt;
&lt;br /&gt;
The LimeExpressionManager (LEM) class manages the integration of EM into LimeSurvey.  LEM must:&lt;br /&gt;
#Initialize all of the variables needed by LimeSurvey (e.g. for TOKENS, INSERTANS, and templatereplace())&lt;br /&gt;
#Know which Group and Question are being processed&lt;br /&gt;
#Record the results and metadata about all of the text that LimeSurvey asks it to process&lt;br /&gt;
#Output static HTML that reflects the results of that processing&lt;br /&gt;
#Output JavaScript that lets those results be dynamically re-computed if values on the page change.&lt;br /&gt;
&lt;br /&gt;
==Extending EM==&lt;br /&gt;
&lt;br /&gt;
===Adding Test Cases===&lt;br /&gt;
&lt;br /&gt;
Please do!  The testing frameworks are solid. You just need to add more tests following the examples in the code.&lt;br /&gt;
&lt;br /&gt;
===Adding Functions===&lt;br /&gt;
&lt;br /&gt;
Functions are stored in LimeExpressionManager::amValidFunctions[]. Some existing examples are:&lt;br /&gt;
*&#039;abs&#039; =&amp;gt; array(&#039;abs&#039;, &#039;Math.abs&#039;, &#039;Absolute value&#039;, &#039;number abs(number)&#039;, &#039;http://www.php.net/manual/en/function.checkdate.php&#039;, 1),&lt;br /&gt;
*&#039;if&#039; =&amp;gt; array(&#039;exprmgr_if&#039;, &#039;LEMif&#039;, &#039;Excel-style if(test,result_if_true,result_if_false)&#039;, &#039;if(test,result_if_true,result_if_false)&#039;, &#039;&#039;, 3),&lt;br /&gt;
*&#039;max&#039; =&amp;gt; array(&#039;max&#039;, &#039;Math.max&#039;, &#039;Find highest value&#039;, &#039;number max(arg1, arg2, ... argN)&#039;, &#039;http://www.php.net/manual/en/function.max.php&#039;, -2),&lt;br /&gt;
*&#039;substr&#039; =&amp;gt; array(&#039;substr&#039;, &#039;substr&#039;, &#039;Return part of a string&#039;, &#039;string substr(string, start &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, length])&#039;, &#039;http://www.php.net/manual/en/function.substr.php&#039;, 2,3),&lt;br /&gt;
&lt;br /&gt;
The syntax for each function (func) is:&lt;br /&gt;
*&#039;&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;func&#039;&#039;&#039;&amp;lt;/span&amp;gt;&#039; =&amp;gt; array(&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;details&#039;&#039;&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
The details which must be included in the array are:&lt;br /&gt;
#PHP function name - this is the PHP function that will be called for that func.&lt;br /&gt;
#JavaScript function name - this is the JavaScript function that will be called for that function&lt;br /&gt;
#Meaning - this is a short description of what the function does&lt;br /&gt;
#Syntax - this shows the valid syntax for the function&lt;br /&gt;
#Reference - this is an optional URL showing more details about the syntax (e.g. a link to the PHP documentation)&lt;br /&gt;
#Number of required arguments&lt;br /&gt;
**Multiple values are allowed at the end of the array.  For example, substr() above can take 2 or 3 arguments&lt;br /&gt;
**Negative values mean that the function accepts a variable number of arguments&lt;br /&gt;
**Negative values less than -1 mean that the function requires at least abs(N)-1 arguments (so -2 means it requires at least 1 argument)&lt;br /&gt;
&lt;br /&gt;
If you add a function that does not exist in PHP, then add it to the body of em_core_helper.php&lt;br /&gt;
*FIXME:  Eventually we should separate out such add-on functions into their own php file&lt;br /&gt;
&lt;br /&gt;
If you add a function that does not exist in JavaScript, then add it to the body of em_javascript.js&lt;br /&gt;
&lt;br /&gt;
Make sure to add Unit tests for new functions to UnitTestEvaluator&lt;br /&gt;
*Syntax is ExpectedResult~Expression, such as:&lt;br /&gt;
*212~5 + max(1,(2+3),(4 + (5 + 6)),[[]],[[7 + 8) + 9),( (10 + 11), 12),(13 + (14 * 15) - 16) )&lt;br /&gt;
&lt;br /&gt;
If your test case should return an error, use NULL as the expected value, like this:&lt;br /&gt;
*NULL~four * / seven&lt;br /&gt;
*NULL~(5 + 7) = 8&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=ExpressionScript_for_developers&amp;diff=25424</id>
		<title>ExpressionScript for developers</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=ExpressionScript_for_developers&amp;diff=25424"/>
		<updated>2013-05-08T15:09:22Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: Reformatted to make page readable&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
This wiki page is meant for the LimeSurvey development team and others wishing to contribute to LimeSurvey.  It provides details about how to work with, test, and extend Expression Manager (EM).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note, this document is currently incomplete.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Started==&lt;br /&gt;
&lt;br /&gt;
The best way to get started with EM is to:&lt;br /&gt;
*Install [http://www.limesurvey.org/en/download LimeSurvey 1.92]&lt;br /&gt;
*Load and play with the Expression Manager demos (located in /docs/demosurveys of the distribution)&lt;br /&gt;
*Navigate through all of the test cases&lt;br /&gt;
**Select a survey, click Tools, then Expression Manager&lt;br /&gt;
*Read the documentation&lt;br /&gt;
**Main user documentation for [[Expression Manager|Expression Manager]]&lt;br /&gt;
**Expression Manager [[Expression Manager HowTos|How Tos]]&lt;br /&gt;
&lt;br /&gt;
==EM Source Code Organization and Purpose==&lt;br /&gt;
===ExpressionManager (EM)===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92:  /classes/expressions/ExpressionManager.php&lt;br /&gt;
**Version 2.0:  /application/helpers/admin/expressions/em_core_helper.php&lt;br /&gt;
*Purpose - implements a [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser] in PHP and JavaScript which let you create variables and securely expose a specified set of pre-defined functions.&lt;br /&gt;
====Recursive Descent Parser (all variables and functions starting with RDP_)====&lt;br /&gt;
*This is the core of EM, a compiler which builds and evaluates the parse tree for the expression&lt;br /&gt;
*Unless you are an expert in compiler theory, you should not touch the RDP_ code.&lt;br /&gt;
====API Functions to the RDP====&lt;br /&gt;
*RegisterFunctions - an interface to add external functions to EM&lt;br /&gt;
*sProcessStringContainingExpressions() - splits string on expressions, evaluates each, then joins together the parts&lt;br /&gt;
*ProcessBooleanExpression() - evaluates whether an equation (not surrounded by curly braces) is true&lt;br /&gt;
*Get*() - returns information about the most recently processed expressions&lt;br /&gt;
===LimeExpressionManager (LEM)===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92:  /classes/expressions/LimeExpressionManager.php&lt;br /&gt;
**Version 2.0:  /application/helpers/admin/expressions/em_manager_helper.php&lt;br /&gt;
*Purpose - this centralizes the integration of LimeSurvey with EM&lt;br /&gt;
====Navigation Functions====&lt;br /&gt;
These process the current responses, update the database, find the next relevant set of questions, and create the metadata needed to render those questions&lt;br /&gt;
*NavigateForwards()&lt;br /&gt;
*NavigateBackwards()&lt;br /&gt;
*JumpTo()&lt;br /&gt;
*GetLastMoveResult() -&lt;br /&gt;
====Initialization Functions====&lt;br /&gt;
*StartSurvey() - initializes the survey, setting all variable mappings&lt;br /&gt;
*setVariableAndTokenMappingsForExpressionManager() - post-processes CreateFieldMap() to create metadata needed for all variables and token values&lt;br /&gt;
*_CreateSubQLevelRelevanceAndValidationEquations() - processes advanced question attributes such as array_filter, min_answers, and min_value&lt;br /&gt;
*ProcessAllNeededRelevance() - computes the relevance results (and JavaScript) for all applicable questions&lt;br /&gt;
*_ProcessGroupRelevance() - computes the relevance of a group based upon its own relevance criteria and the status of the questions it contains.&lt;br /&gt;
====Functions to Generate Tailored Content====&lt;br /&gt;
*StartProcessingPage() - called at beginning of each page&lt;br /&gt;
*StartProcessingGroup() - called for each group on a page&lt;br /&gt;
*FinishProcessingGroup() - collects all tailoring for this group so can render appropriate JavaScript&lt;br /&gt;
*FinishProcessingPage() - completes the EM-related processing, and serializes LEM into $_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;LEMsingleton&#039;]&lt;br /&gt;
*GetRelevanceAndTailoringJavaScript() - collects all relevance, validation, and tailoring logic and generates ExprMgr_process_relevance_and_tailoring() JavaScript function&lt;br /&gt;
====Response Management====&lt;br /&gt;
*ProcessCurrentResponses() - validates and processes the $_POSTed responses&lt;br /&gt;
*_UpdateValuesInDatabase() - saves values to database, including NULLing irrelevant values&lt;br /&gt;
====Caching ====&lt;br /&gt;
LEM tries to avoid calling the Initialization functions each page, storing state in $_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;LEMsingleton&#039;]&lt;br /&gt;
*SetDirtyFlag() - when called, tells LEM to force a rebuild of the Initialization functions (e.g. of admin has added/removed/updated any questions, groups, conditions, or defaults)&lt;br /&gt;
*SetSurveyId()- calls SetDirtyFlag if the user wants to work with a different survey from the one that is cached&lt;br /&gt;
*SetEMLanguage() - calls SetDirtyFlag() if the user starts  to use a language different from the cached one&lt;br /&gt;
====Validation Functions====&lt;br /&gt;
*_ValidateSurvey() - validates the entire survey by calling _ValidateGroup()&lt;br /&gt;
*_ValidatGroup() - validates a group and returns its status by calling _ValidateQuestion() on all of its questions&lt;br /&gt;
*_ValidateQuestion() - validates a question, determining whether it is relevant, hidden, or fails any validation and/or mandatory criteria&lt;br /&gt;
===EM-related JavaScript===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92: /classes/expressions/em_javascript.js&lt;br /&gt;
**Version 2.0: /scripts/admin/expressions/em_javascript.js&lt;br /&gt;
*Purpose - contains all of the custom javascript needed for EM&lt;br /&gt;
====JavaScript equivalents of PHP functions====&lt;br /&gt;
About 20 functions from phpjs.org&lt;br /&gt;
====Core Functions====&lt;br /&gt;
*LEManyNA() - checks whether any of the variables are irrelevant&lt;br /&gt;
*LEMval() - retrieves the value for any variable, or its metadata (via the dot notation syntax)&lt;br /&gt;
*LEMsetTabIndexes() - ensures that the tab sequence will act as expected even if input elements change visibility.&lt;br /&gt;
===EM-related Test Cases===&lt;br /&gt;
*Location&lt;br /&gt;
**Version 1.92: /classes/expressions/test/*.php&lt;br /&gt;
**Version 2.0:  /application/views/admin/expressions/*&lt;br /&gt;
*Purpose&lt;br /&gt;
**&#039;&#039;&#039;Available Functions&#039;&#039;&#039; - runs EM::ShowAllowableFunctions to display functions and syntax from EM-&amp;gt;RDP_ValidFunctions&lt;br /&gt;
**&#039;&#039;&#039;String Splitter&#039;&#039;&#039; - runs EM::UnitTestStringSplitter() to show how it parses strings with curly braces&lt;br /&gt;
**&#039;&#039;&#039;Tokenizer&#039;&#039;&#039; - runs EM::UnitTestTokenizer() to show how EM detects and categorizes tokens (e.g. variables, string, functions, operators)&lt;br /&gt;
**&#039;&#039;&#039;Unit Tests of Isolated Expressions&#039;&#039;&#039; - runs EM::UnitTestEvaluator() for unit tests of each of Expression Manager&#039;s features (e.g. all operators and functions). Color coding shows whether any tests fail. Syntax highlighting shows cases where Expression Manager properly detects bad syntax.&lt;br /&gt;
**&#039;&#039;&#039;Unit Tests of Expressions Within Strings&#039;&#039;&#039; - runs LEM::UnitTestProcessStringContainingExpressions() to show how Expression Manager can process strings containing one or more variable, token, or expression replacements surrounded by curly braces.&lt;br /&gt;
**&#039;&#039;&#039;Unit Test Dynamic Relevance Processing&#039;&#039;&#039; - runs LEM::UnitTestRelevance() to show how questions and substitutions should dynamically change based upon values entered.&lt;br /&gt;
**&#039;&#039;&#039;Preview Conversion of Conditions to Relevance&#039;&#039;&#039; - runs LEM::UnitTestConvertConditionsToRelevance() to show relevance equations for all conditions in the database, grouped by question id&lt;br /&gt;
**&#039;&#039;&#039;Bulk Convert Conditions to Relevance&#039;&#039;&#039; - actually performs the conversion, saving the generated relevance  equations (while retaining the original conditions)&lt;br /&gt;
**&#039;&#039;&#039;Test Navigation&#039;&#039;&#039; - unit tests LEM::NavigateForwards() for the selected survey, generating the following information based upon the selected debugging options:&lt;br /&gt;
***Detailed Timing - shows low-level timing information for each part of EM (e.g. to examine duration of database calls)&lt;br /&gt;
***Validation Summary - shows one line per group and question, showing its relevance equation, and indicating whether it was irrelevant, hidden, mandatory and/or failed validation criteria.  Also shows the generated SQL per navigation step to update the database&lt;br /&gt;
***Validation Detail - shows extra details per question, including&lt;br /&gt;
****Validation Tip, Equation, JavaScript equivalent of the Equation&lt;br /&gt;
****Lists of sub-questions; which are relevant; and which are unanswered&lt;br /&gt;
****List of array filters applied, by sub-question&lt;br /&gt;
***Pretty Print Syntax - syntax highlights all of the equations so that you can see errors, and also click on variable names to jump to those questions and edit them.&lt;br /&gt;
**&#039;&#039;&#039;Show Survey Logic File&#039;&#039;&#039; - generates the logic file which is available via the &amp;quot;QA&amp;quot; buttons in the admin console.&lt;br /&gt;
&lt;br /&gt;
==How EM Works==&lt;br /&gt;
&lt;br /&gt;
===What is an Expression?===&lt;br /&gt;
&lt;br /&gt;
Anything surrounded by curly braces is an Expression, with two exceptions:&lt;br /&gt;
If there is whitespace after the opening brace or before the closing brace, it is ignored.&lt;br /&gt;
*This is so that EM can ignore embedded JavaScript.&lt;br /&gt;
*So, if you have JavaScript that might be parsed by EM, make sure to add a space or newline  after the opening brace.&lt;br /&gt;
#Escaped curly braces are ignored (e.g. &amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;\{&#039;&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;\}&#039;&#039;&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Note that EM does support Expressions within strings.  Moreover, Expressions can contain nested strings, but not nested expressions.  So, the following red sections are valid Expressions and will cause substitions to occur within the containing strings.&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{Q1}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{if(Q1==&amp;quot;Y&amp;quot;,&#039;yes&#039;,&#039;no&#039;)}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
*&amp;lt;img src=&amp;quot;images/mine_&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;{if(Q1==&amp;quot;Y&amp;quot;,&#039;single quote with {nested braces}&#039;,&amp;quot;double quote with {nested braces}&amp;quot;)}&#039;&#039;&#039;&amp;lt;/span&amp;gt;.png&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===What does EM do with text containing expressions?===&lt;br /&gt;
#A regular expression divides the source line into STRING and EXPRESSION tokens&lt;br /&gt;
#Each EXPRESSION is parsed by ExpressionManager, a [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser].&lt;br /&gt;
##If there are syntax errors, EM returns an HTML string that syntax-highlights the equation and puts red-lined boxes around syntax errors&lt;br /&gt;
##If there are no syntax errors, EM returns the result of evaluating the expression&lt;br /&gt;
#EM re-joins the STRING and EM-evaluated EXPRESSION parts.&lt;br /&gt;
#EM optionally appends the translation activity to structures used by GetRelevanceAndTailoringJavaScript()&lt;br /&gt;
&lt;br /&gt;
===How can we be sure that EM accurately parses the equations?===&lt;br /&gt;
&lt;br /&gt;
EM was originally written in 1999-2000 by Dr. Tom White (TMSWhite) for a different project (Dialogix) in Java, using [http://en.wikipedia.org/wiki/JavaCC JavaCC], an open source compiler compiler (parser generator).  That Java-based project has been in production for over a decade, and has been fully vetted for unit and integration tests.&lt;br /&gt;
&lt;br /&gt;
Since there is no production-grade parser generator for PHP and JavaScript (although [http://www.antlr.org/ Antlr] is coming close), TMSWhite created a custom [http://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parser] for LimeSurvey.  To ensure its accuracy, EM&#039;s logic is based upon the JavaCC source code for Dialogix.  The JavaCC syntax mirrors the functionality needed for a recursive descent parser.  JavaCC happens to build a state-based compiler, which is a little more efficient than a recusive descent parser.  However, state-based compilers are impossible to read, understand,  or expand without JavaCC-like source code, so it did not make sense to try to port the JavaCC output directly to PHP.&lt;br /&gt;
&lt;br /&gt;
Futhermore, there are comprehensive unit and integration test suites for EM. These make it easy to validate the accuracy of the EM system.  Each test suite includes dozens to hundreds of test cases, and it is trivial to add addition test cases.&lt;br /&gt;
&lt;br /&gt;
===How does the Recursive Descent Parser work?===&lt;br /&gt;
&lt;br /&gt;
EM must do the following:&lt;br /&gt;
#Tokenize the expression - separating strings, words (variable names vs. functions), and punctuation; and categorizing the types of each.&lt;br /&gt;
#Analyze the tokens to build a parse tree, checking for syntax errors along the way.&lt;br /&gt;
#Return the result of evaluating the expression (using PHP) (or return syntax-highlighted HTML if there are syntax errors).&lt;br /&gt;
#Create a safe JavaScript equivalent of the expression so that expressions can be  dynamically re-computed client-side.&lt;br /&gt;
#Determine which variables are used in each expression (so can make sure they are available client-side).&lt;br /&gt;
&lt;br /&gt;
===How does EM integrate into LimeSurvey?===&lt;br /&gt;
&lt;br /&gt;
The LimeExpressionManager (LEM) class manages the integration of EM into LimeSurvey.  LEM must:&lt;br /&gt;
#Initialize all of the variables needed by LimeSurvey (e.g. for TOKENS, INSERTANS, and templatereplace())&lt;br /&gt;
#Know which Group and Question are being processed&lt;br /&gt;
#Record the results and metadata about all of the text that LimeSurvey asks it to process&lt;br /&gt;
#Output static HTML that reflects the results of that processing&lt;br /&gt;
#Output JavaScript that lets those results be dynamically re-computed if values on the page change.&lt;br /&gt;
&lt;br /&gt;
==Extending EM==&lt;br /&gt;
&lt;br /&gt;
===Adding Test Cases===&lt;br /&gt;
&lt;br /&gt;
Please do!  The testing frameworks are solid. You just need to add more tests following the examples in the code.&lt;br /&gt;
&lt;br /&gt;
===Adding Functions===&lt;br /&gt;
&lt;br /&gt;
Functions are stored in LimeExpressionManager::amValidFunctions[]. Some existing examples are:&lt;br /&gt;
*&#039;abs&#039; =&amp;gt; array(&#039;abs&#039;, &#039;Math.abs&#039;, &#039;Absolute value&#039;, &#039;number abs(number)&#039;, &#039;http://www.php.net/manual/en/function.checkdate.php&#039;, 1),&lt;br /&gt;
*&#039;if&#039; =&amp;gt; array(&#039;exprmgr_if&#039;, &#039;LEMif&#039;, &#039;Excel-style if(test,result_if_true,result_if_false)&#039;, &#039;if(test,result_if_true,result_if_false)&#039;, &#039;&#039;, 3),&lt;br /&gt;
*&#039;max&#039; =&amp;gt; array(&#039;max&#039;, &#039;Math.max&#039;, &#039;Find highest value&#039;, &#039;number max(arg1, arg2, ... argN)&#039;, &#039;http://www.php.net/manual/en/function.max.php&#039;, -2),&lt;br /&gt;
*&#039;substr&#039; =&amp;gt; array(&#039;substr&#039;, &#039;substr&#039;, &#039;Return part of a string&#039;, &#039;string substr(string, start &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;, length])&#039;, &#039;http://www.php.net/manual/en/function.substr.php&#039;, 2,3),&lt;br /&gt;
&lt;br /&gt;
The syntax for each function (func) is:&lt;br /&gt;
*&#039;&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;func&#039;&#039;&#039;&amp;lt;/span&amp;gt;&#039; =&amp;gt; array(&amp;lt;span style=&#039;color:#F00&#039;&amp;gt;&#039;&#039;&#039;details&#039;&#039;&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
The details which must be included in the array are:&lt;br /&gt;
#PHP function name - this is the PHP function that will be called for that func.&lt;br /&gt;
#JavaScript function name - this is the JavaScript function that will be called for that function&lt;br /&gt;
#Meaning - this is a short description of what the function does&lt;br /&gt;
#Syntax - this shows the valid syntax for the function&lt;br /&gt;
#Reference - this is an optional URL showing more details about the syntax (e.g. a link to the PHP documentation)&lt;br /&gt;
#Number of required arguments&lt;br /&gt;
**Multiple values are allowed at the end of the array.  For example, substr() above can take 2 or 3 arguments&lt;br /&gt;
**Negative values mean that the function accepts a variable number of arguments&lt;br /&gt;
**Negative values less than -1 mean that the function requires at least abs(N)-1 arguments (so -2 means it requires at least 1 argument)&lt;br /&gt;
&lt;br /&gt;
If you add a function that does not exist in PHP, then add it to the body of em_core_helper.php&lt;br /&gt;
*FIXME:  Eventually we should separate out such add-on functions into their own php file&lt;br /&gt;
&lt;br /&gt;
If you add a function that does not exist in JavaScript, then add it to the body of em_javascript.js&lt;br /&gt;
&lt;br /&gt;
Make sure to add Unit tests for new functions to UnitTestEvaluator&lt;br /&gt;
*Syntax is ExpectedResult~Expression, such as:&lt;br /&gt;
*212~5 + max(1,(2+3),(4 + (5 + 6)),[[]],[[7 + 8) + 9),( (10 + 11), 12),(13 + (14 * 15) - 16) )&lt;br /&gt;
&lt;br /&gt;
If your test case should return an error, use NULL as the expected value, like this:&lt;br /&gt;
*NULL~four * / seven&lt;br /&gt;
*NULL~(5 + 7) = 8&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=2941</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=2941"/>
		<updated>2012-11-03T11:29:10Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of Limesurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
==get_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure: Error Code 1&lt;br /&gt;
&lt;br /&gt;
==release_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
==get_site_settings==&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
==add_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==import_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
==get_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|properties not allowed to be modified|| Properties not allowed to be modified when survey active&lt;br /&gt;
|-&lt;br /&gt;
|sid||anonymized&lt;br /&gt;
|-&lt;br /&gt;
|language||datestamp&lt;br /&gt;
|-&lt;br /&gt;
|additional_languages||savetimings&lt;br /&gt;
|-&lt;br /&gt;
|active||ipaddr&lt;br /&gt;
|-&lt;br /&gt;
|||refurl&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_surveys==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Survey&#039;s properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
Survey&#039;s properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|property||type&lt;br /&gt;
|-&lt;br /&gt;
|sid||integer&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_title||string&lt;br /&gt;
|-&lt;br /&gt;
|startdate||date&lt;br /&gt;
|-&lt;br /&gt;
|expires||date&lt;br /&gt;
|-&lt;br /&gt;
|active||y/n&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==activate_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==export_statistics==&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==get_summary==&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||tokens_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==add_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==delete_survey_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
==get_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
==add_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
==import_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
==get_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_groups==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==delete_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
==import_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
==get_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|subquestions||attributes||attributes_lang||answeroptions&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_questions==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
Activate tokens&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
surveyid (string) The survey ID&lt;br /&gt;
&lt;br /&gt;
additional_attributes (array of integers) Any additional attribute fields to create. Just give the attribute IDs&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) status OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
&lt;br /&gt;
==add_participants==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a token key is automatically create&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*session key (string) - The session key&lt;br /&gt;
*survey ID (string) - The survey id&lt;br /&gt;
*participant data (array) -  2-dimensional array/structure containing your participants data&lt;br /&gt;
*createTokenKey (boolean) - Set this to true if you want a token key create automatically for each entry - if your participant data included a [token] field it will be overwritten&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success:  participant data (struct) -  structure containing your participants data plus the token ID and (if applicable) the new token&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
&lt;br /&gt;
==delete_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
==get_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|tid||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info  of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
iStart (int) - Start id of the token list&lt;br /&gt;
&lt;br /&gt;
iLimit (int) - Number of participants to return&lt;br /&gt;
&lt;br /&gt;
bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
==invite_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==remind_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==add_response==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new responses to your survey response table.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sSessionKey (string) - The session key&lt;br /&gt;
*iSurveyID (integer) - The survey id&lt;br /&gt;
*aResponseData (array) -  array/structure containing your response data&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: response_id (integer) -  Returns the id of the inserted survey response&lt;br /&gt;
*On failure: (array) with error description&lt;br /&gt;
&lt;br /&gt;
==export_responses==&lt;br /&gt;
&lt;br /&gt;
Export response data to pdf,csv,xls,doc&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (int) - Id of the Survey&lt;br /&gt;
&lt;br /&gt;
DocumentType (string) - pdf,csv,xls,doc&lt;br /&gt;
&lt;br /&gt;
sLanguageCode (string) - The language to be used&lt;br /&gt;
&lt;br /&gt;
CompletionStatus (string) - Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; selection of responses - defaults to complete&lt;br /&gt;
&lt;br /&gt;
HeadingType (string) - &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039;. type of question heading. Optional defaults to &#039;code&#039;&lt;br /&gt;
&lt;br /&gt;
ResponseType (string) - &#039;short&#039; or &#039;long&#039; response type.Optional defaults to &#039;short&#039;&lt;br /&gt;
&lt;br /&gt;
FromResponseID (int) - Optional start number of response&lt;br /&gt;
&lt;br /&gt;
ToResponseID (int) - Optional end number of responses&lt;br /&gt;
&lt;br /&gt;
Return:&lt;br /&gt;
&lt;br /&gt;
On success: Requested file as base 64-encoded string.&lt;br /&gt;
&lt;br /&gt;
On failure: Array with error information&lt;br /&gt;
&lt;br /&gt;
Note: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application based on the tiny jsonRPCClient from [http://jsonrpcphp.org/ | jsonrpcphp.org]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);  // adjust this one to your actual LimeSurvey URL&lt;br /&gt;
&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
&lt;br /&gt;
$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Changes=&lt;br /&gt;
&lt;br /&gt;
2.0a Only three functions are supported right now: getSessionKey, releaseSessionKey, deleteSurvey&lt;br /&gt;
&lt;br /&gt;
2.0b Added function add_participants&lt;br /&gt;
&lt;br /&gt;
2.0RC5 Added import_survey, activate_survey, activate_tokens&lt;br /&gt;
&lt;br /&gt;
2.0 (build 121030) Added subquestions, attributes, attributes_lang and answeroptions properties for get_question_properties&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=2944</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=2944"/>
		<updated>2012-09-19T13:48:35Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of Limesurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
==get_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure: Error Code 1&lt;br /&gt;
&lt;br /&gt;
==release_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
==get_site_settings==&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
==add_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==import_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
==get_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|properties not allowed to be modified|| Properties not allowed to be modified when survey active&lt;br /&gt;
|-&lt;br /&gt;
|sid||anonymized&lt;br /&gt;
|-&lt;br /&gt;
|language||datestamp&lt;br /&gt;
|-&lt;br /&gt;
|additional_languages||savetimings&lt;br /&gt;
|-&lt;br /&gt;
|active||ipaddr&lt;br /&gt;
|-&lt;br /&gt;
|||refurl&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_surveys==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
==activate_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==export_statistics==&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==get_summary==&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||tokens_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==add_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==delete_survey_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
==get_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
==add_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
==import_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
==get_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_groups==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==delete_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
==import_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
==get_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_questions==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
Activate tokens&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
surveyid (string) The survey ID&lt;br /&gt;
&lt;br /&gt;
additional_attributes (array of integers) Any additional attribute fields to create. Just give the attribute IDs&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) status OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
&lt;br /&gt;
==add_participants==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a token key is automatically create&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*session key (string) - The session key&lt;br /&gt;
*survey ID (string) - The survey id&lt;br /&gt;
*participant data (array) -  2-dimensional array/structure containing your participants data&lt;br /&gt;
*createTokenKey (boolean) - Set this to true if you want a token key create automatically for each entry - if your participant data included a [token] field it will be overwritten&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success:  participant data (struct) -  structure containing your participants data plus the token ID and (if applicable) the new token&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
&lt;br /&gt;
==delete_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
==get_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|tid||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info  of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
iStart (int) - Start id of the token list&lt;br /&gt;
&lt;br /&gt;
iLimit (int) - Number of participants to return&lt;br /&gt;
&lt;br /&gt;
bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
==invite_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==remind_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==add_response==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new responses to your survey response table.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sSessionKey (string) - The session key&lt;br /&gt;
*iSurveyID (integer) - The survey id&lt;br /&gt;
*aResponseData (array) -  array/structure containing your response data&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: response_id (integer) -  Returns the id of the inserted survey response&lt;br /&gt;
*On failure: (array) with error description&lt;br /&gt;
&lt;br /&gt;
==export_responses==&lt;br /&gt;
&lt;br /&gt;
Export response data to pdf,csv,xls,doc&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (int) - Id of the Survey&lt;br /&gt;
&lt;br /&gt;
DocumentType (string) - pdf,csv,xls,doc&lt;br /&gt;
&lt;br /&gt;
sLanguageCode (string) - The language to be used&lt;br /&gt;
&lt;br /&gt;
CompletionStatus (string) - Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; selection of responses - defaults to complete&lt;br /&gt;
&lt;br /&gt;
HeadingType (string) - &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039;. type of question heading. Optional defaults to &#039;code&#039;&lt;br /&gt;
&lt;br /&gt;
ResponseType (string) - &#039;short&#039; or &#039;long&#039; response type.Optional defaults to &#039;short&#039;&lt;br /&gt;
&lt;br /&gt;
FromResponseID (int) - Optional start number of response&lt;br /&gt;
&lt;br /&gt;
ToResponseID (int) - Optional end number of responses&lt;br /&gt;
&lt;br /&gt;
Return:&lt;br /&gt;
&lt;br /&gt;
On success: Requested file as base 64-encoded string.&lt;br /&gt;
&lt;br /&gt;
On failure: Array with error information&lt;br /&gt;
&lt;br /&gt;
Note: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application based on the tiny jsonRPCClient from [http://jsonrpcphp.org/ | jsonrpcphp.org]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);&lt;br /&gt;
&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
&lt;br /&gt;
$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all ids and info of groups belonging to a given survey&lt;br /&gt;
&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Changes=&lt;br /&gt;
&lt;br /&gt;
2.0a Only three functions are supported right now: getSessionKey, releaseSessionKey, deleteSurvey&lt;br /&gt;
&lt;br /&gt;
2.0b Added function add_participants&lt;br /&gt;
&lt;br /&gt;
2.0RC5 Added import_survey, activate_survey, activate_tokens&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=2945</id>
		<title>RemoteControl 2 API</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=RemoteControl_2_API&amp;diff=2945"/>
		<updated>2012-09-19T13:45:59Z</updated>

		<summary type="html">&lt;p&gt;Jweberhofer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
LimeSurvey RemoteControl 2 is a XML-RPC/JSON-RPC based web service available in LimeSurvey 2.0 or later. The old [RemoteControl] will not be available any longer in version 2.&lt;br /&gt;
&lt;br /&gt;
LSRC2 makes it possible for developers to control specific functionality of Limesurvey from any other application, without being restricted to PHP as a programming language.&lt;br /&gt;
&lt;br /&gt;
The following features are planned:&lt;br /&gt;
* start a predefined survey (change titles and things)&lt;br /&gt;
* add predefined groups or questions&lt;br /&gt;
* activate the survey, restrict it to start and endtime&lt;br /&gt;
* make it closed,&lt;br /&gt;
* add participant data/tokens when you need them&lt;br /&gt;
* return the unused tokens to the main application&lt;br /&gt;
* get a fieldmap for a survey,&lt;br /&gt;
* invite or remind the participants of your survey&lt;br /&gt;
&lt;br /&gt;
...and much more&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* libXML installed&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== How to configure LSRC2==&lt;br /&gt;
&lt;br /&gt;
In a default LimeSurvey installation LSRC2 is disabled. In order to use LSRC2 you must first enable the service, and then adjust the settings to suit your needs. To enable LSRC2 login to the LimeSurvey administration, go to [[Global settings]], choose the tab &#039;Services&#039; and select one of the two RPC services (XML-RPC or JSON-RPC) service.&lt;br /&gt;
&lt;br /&gt;
== Security==&lt;br /&gt;
&lt;br /&gt;
LSRC2 uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also LSRC2 is protected against brute-force password cracking - like the normal administration login.&lt;br /&gt;
&lt;br /&gt;
=How to use LSRC2=&lt;br /&gt;
&lt;br /&gt;
The basic LSRC2 URL is: http://&amp;lt;your_domain&amp;gt;/&amp;lt;your_limesurvey_dir&amp;gt;/index.php/admin/remotecontrol&lt;br /&gt;
&lt;br /&gt;
LSRC2 fully complies to the [http://www.xmlrpc.com/ XML-RPC specification] and JSON-RPC specifications. We recommend in general to use JSON-RPC because it is well tested and has a much smaller footprint than XML-RPC.&lt;br /&gt;
&lt;br /&gt;
LSRC2 offers the following functions:&lt;br /&gt;
&lt;br /&gt;
==get_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can create a new XML-RPC session key. This is mandatory for all following LSRC2 function calls.&lt;br /&gt;
&lt;br /&gt;
Parameters: username (string), password (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: A session key (string)&lt;br /&gt;
*On failure: Error Code 1&lt;br /&gt;
&lt;br /&gt;
==release_session_key==&lt;br /&gt;
&lt;br /&gt;
Using this function you can close a previously opened XML-RPC/JSON-RPC session.&lt;br /&gt;
&lt;br /&gt;
Parameters: session key (string)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*Always: &#039;OK&#039; (string)&lt;br /&gt;
&lt;br /&gt;
==get_site_settings==&lt;br /&gt;
&lt;br /&gt;
Function to provide with site settings only to administrators&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) The session key&lt;br /&gt;
&lt;br /&gt;
sSetttingName (string) -  Name of the setting to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Setting&lt;br /&gt;
*On failure: (string) Error message&lt;br /&gt;
&lt;br /&gt;
==add_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty survey with minimum details&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID     (int),    The wish id of the Survey to add&lt;br /&gt;
&lt;br /&gt;
sSurveyTitle     (string),  Title of the new Survey&lt;br /&gt;
&lt;br /&gt;
sSurveyLanguage    (string),  Default language of the Survey&lt;br /&gt;
&lt;br /&gt;
sformat     (string),  Question appearance format (S|G|A)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Faulty parameters&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to Delete a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string), Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int), The Survey to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: Status =&amp;gt;OK (array)&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==import_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a survey from lss,csv,xls or survey zip archive.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sImportData  (string) String containing the BASE 64 encoded data of a lss,csv,xls or survey zip archive&lt;br /&gt;
&lt;br /&gt;
sImportDataType     (string),    The format of the import file (lss,csv,xls or zip)&lt;br /&gt;
&lt;br /&gt;
sNewSurveyName     (string),  The optional new name of the survey (base language)&lt;br /&gt;
&lt;br /&gt;
DestSurveyID    (int), This is the new ID of the survey - if already used a random one will be taken instead&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) $iNewSurveyID&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import error&lt;br /&gt;
&lt;br /&gt;
==get_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|   sid||   savetimings||   allowprev||   tokenanswerspersistence||   showgroupinfo||   showwelcome&lt;br /&gt;
|-&lt;br /&gt;
|   owner_id||   template||   printanswers||   assessments||  shownoanswer ||   showprogress&lt;br /&gt;
|-&lt;br /&gt;
|   admin||   language||   ipaddr||   usecaptcha||   showqnumcode||   allowjumps&lt;br /&gt;
|-&lt;br /&gt;
|   active||   additional_languages ||   refurl||   usetokens||   bouncetime||   navigationdelay&lt;br /&gt;
|-&lt;br /&gt;
|   expires||   datestamp||   datecreated||   bounce_email||   bounceprocessing||   nokeyboard&lt;br /&gt;
|-&lt;br /&gt;
|   startdate||   usecookie||   publicstatistics||   attributedescriptions||   bounceaccounttype||   alloweditaftercompletion&lt;br /&gt;
|-&lt;br /&gt;
|   adminemail||   allowregister||   publicgraphs||   emailresponseto||   bounceaccounthost||   googleanalyticsstyle&lt;br /&gt;
|-&lt;br /&gt;
|   anonymized||   allowsave||   listpublic||   emailnotificationto||   bounceaccountpass||   googleanalyticsapikey&lt;br /&gt;
|-&lt;br /&gt;
|   faxto||   autonumber_start||   htmlemail||   tokenlength||   bounceaccountencryption||&lt;br /&gt;
|-&lt;br /&gt;
|format||   autoredirect||   sendconfirmation||   showxquestions||   bounceaccountuser||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_survey_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveySettings     (array),    An assosiative array with the name-value  pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
Properties available for changing are all those defined in get_survey_properties with the following exceptions&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|properties not allowed to be modified|| Properties not allowed to be modified when survey active&lt;br /&gt;
|-&lt;br /&gt;
|sid||anonymized&lt;br /&gt;
|-&lt;br /&gt;
|language||datestamp&lt;br /&gt;
|-&lt;br /&gt;
|additional_languages||savetimings&lt;br /&gt;
|-&lt;br /&gt;
|active||ipaddr&lt;br /&gt;
|-&lt;br /&gt;
|||refurl&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_surveys==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to list the ids and info of surveys belonging to a user.&lt;br /&gt;
&lt;br /&gt;
    * If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)&lt;br /&gt;
&lt;br /&gt;
    * Else only the syrveys belonging to the user requesting will be shown.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
sUser (string) -  The users surveys to list&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of the change for each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid user&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No surveys found&lt;br /&gt;
&lt;br /&gt;
==activate_survey==&lt;br /&gt;
&lt;br /&gt;
RPC Routine that launches a newly created survey (sets active -available for users)&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (array) The result of the activation&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Activation Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==export_statistics==&lt;br /&gt;
&lt;br /&gt;
RPC routine to export statistics of a survey to a user.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
docType (string) - Type of document to generate&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional language of the survey to use (if not set, default language is selected)&lt;br /&gt;
&lt;br /&gt;
graph (string) - Optional parameter to enable graphs (0|1)&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==get_summary==&lt;br /&gt;
&lt;br /&gt;
RPC routine to get survey summary, regarding token usage and survey participation.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
sStatname (string) - The statistic to return&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
*On success: (string) Base64 encoded string with the statistics file&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**No available data&lt;br /&gt;
**No such property&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available statistics:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|Survey stats||Token stats&lt;br /&gt;
|-&lt;br /&gt;
|completed_responses||token_count&lt;br /&gt;
|-&lt;br /&gt;
|incomplete_responses||token_invalid&lt;br /&gt;
|-&lt;br /&gt;
|full_responses||tokens_sent&lt;br /&gt;
|-&lt;br /&gt;
|||token_opted_out&lt;br /&gt;
|-&lt;br /&gt;
|||token_completed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==add_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add a language to an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) - The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the new language to be added. Note: If the language is already in that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Error&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==delete_survey_language==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a language of an existing survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
SurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aLanguage (string) - The language shortcut for the language to be removed. Note: If the language is not part of that survey no error will be thrown.&lt;br /&gt;
&lt;br /&gt;
Return values:&lt;br /&gt;
*On success: (array) status=&amp;gt;OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Cannot remove base language&lt;br /&gt;
**Error&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid session key&lt;br /&gt;
&lt;br /&gt;
==get_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to get survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleSettings     (array) -  An array with the properties to return&lt;br /&gt;
&lt;br /&gt;
slang (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) the requested value&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_survey_id            ||    surveyls_url                  ||    surveyls_email_register_subj  ||    email_admin_notification_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_language             ||    surveyls_urldescription       ||    surveyls_email_register       ||    email_admin_notification&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_title                ||    surveyls_email_invite_subj    ||    surveyls_email_confirm_subj   ||    email_admin_responses_subj&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_description          ||    surveyls_email_invite         ||    surveyls_email_confirm        ||    email_admin_responses&lt;br /&gt;
|-&lt;br /&gt;
|    surveyls_welcometext          || surveyls_email_remind_subj       ||    surveyls_dateformat           ||    surveyls_numberformat&lt;br /&gt;
|-&lt;br /&gt;
|surveyls_endtext              ||    surveyls_email_remind         ||    surveyls_attributecaptions    ||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_language_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set survey language properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey&lt;br /&gt;
&lt;br /&gt;
aSurveyLocaleData     (array) -  An assosiative array with the key-value pairs of properties to set. Invalid fieldnames or fields that may not be modified are ignored.&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)    - The language to use&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (string) Result for each parameter set&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Allowed Parameters:&lt;br /&gt;
&lt;br /&gt;
All those defined in get-language_properties except:&lt;br /&gt;
*surveyls_language&lt;br /&gt;
*surveyls_survey_id&lt;br /&gt;
&lt;br /&gt;
==add_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to add an empty group with minimum details.&lt;br /&gt;
&lt;br /&gt;
    * Used as a placeholder for importing questions.&lt;br /&gt;
&lt;br /&gt;
    * Returns the groupid of the created group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the surveythat the group will be added&lt;br /&gt;
&lt;br /&gt;
sGroupTitle     (string) -  Name of the new group&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) - Optional description of the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Creation Failed&lt;br /&gt;
&lt;br /&gt;
==delete_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  ID of the survey that the group belongs&lt;br /&gt;
&lt;br /&gt;
sGroupID    (int) -  Id of the group to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the deleted group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**Invalid Group ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Group deletion failed&lt;br /&gt;
&lt;br /&gt;
==import_group==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a group - imports lsg,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey that the group will belong&lt;br /&gt;
&lt;br /&gt;
sImportData     (string) -  String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sGroupDescription (string) -The format of the importfile in the stream (lsg|csv)&lt;br /&gt;
&lt;br /&gt;
sNewGroupName (string) - Optional new name for the group&lt;br /&gt;
&lt;br /&gt;
sNewGroupDescription (string) - Optional new description for the group&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) The ID of the new group&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Error:Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Error: Invalid LimeSurvey group structure XML&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Import Error&lt;br /&gt;
&lt;br /&gt;
==get_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to get properties of&lt;br /&gt;
&lt;br /&gt;
aGroupSettings     (array) -  Array containing the properties to request.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||description&lt;br /&gt;
|-&lt;br /&gt;
|sid||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_group_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a group of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iGroupID (integer) -  The id of the group to set properties to&lt;br /&gt;
&lt;br /&gt;
aGroupData     (array) -  Assosiative Array containing key-value pairs of the properties to set.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The result of each set action&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Error: Invalid group ID&lt;br /&gt;
**No valid Data&lt;br /&gt;
**Group with dependencies - Order cannot be changed&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
Available properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| ||&lt;br /&gt;
|-&lt;br /&gt;
|||description&lt;br /&gt;
|-&lt;br /&gt;
|||language&lt;br /&gt;
|-&lt;br /&gt;
|group_name||randomization_group&lt;br /&gt;
|-&lt;br /&gt;
|group_order||grelevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_groups==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of groups belonging to survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (integer) -  The id of the survey to get groups of&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the groups&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid Survey ID&lt;br /&gt;
**No groups found&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
&lt;br /&gt;
==delete_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int)id of the deleted Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
** Invalid question ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Cannot delete Question. Others rely on this question&lt;br /&gt;
**Error&lt;br /&gt;
&lt;br /&gt;
==import_question==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to import a question - imports lsq,csv&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
iGroupID (int) - Id of the group that the new questions belongs&lt;br /&gt;
&lt;br /&gt;
sImportData (string) - String containing the BASE 64 encoded data of a lsg,csv&lt;br /&gt;
&lt;br /&gt;
sImportDataType (string)  - Format of the input stream (lsq,csv)&lt;br /&gt;
&lt;br /&gt;
sMandatory (string) - Optional Mandatory question option (default to No)&lt;br /&gt;
&lt;br /&gt;
sNewQuestionTitle (string) - Optional new title for the question&lt;br /&gt;
&lt;br /&gt;
sNewqQuestion (string) - An optional new question&lt;br /&gt;
&lt;br /&gt;
sNewQuestionHelp (string) - An optional new question help text&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (int) Id of the new Question&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Invalid group ID&lt;br /&gt;
**Survey is active and not editable&lt;br /&gt;
**Invalid extension&lt;br /&gt;
**Invalid LimeSurvey question structure XML&lt;br /&gt;
&lt;br /&gt;
==get_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return properties of a question of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string)  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionSettings (array) The properties to get&lt;br /&gt;
&lt;br /&gt;
sLanguage (string) Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The requested properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|gid||type||help||language&lt;br /&gt;
|-&lt;br /&gt;
|parent_qid||title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|sid||question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|gid||preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_question_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set question properties&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iQuestionID  (int) - Id of the question to get properties of&lt;br /&gt;
&lt;br /&gt;
aQuestionData (array)  - An array with the particular fieldnames as keys and their values to set on that particular question&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The resilt of the set of each property&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Questions with dependencies - Order cannot be changed&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Properties:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|help|| ||&lt;br /&gt;
|-&lt;br /&gt;
|title||other||scale_id&lt;br /&gt;
|-&lt;br /&gt;
|question||mandatory||same_default&lt;br /&gt;
|-&lt;br /&gt;
|preg||question_order||relevance&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_questions==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info of questions of a survey/group.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
iGroupID  (int) - Id of the group to get questions of&lt;br /&gt;
&lt;br /&gt;
sLanguage (string)  -  Optional parameter language for multilingual questions&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) The list of the questions&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid questionid&lt;br /&gt;
**Invalid language&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Missmatch in surveyid and groupid&lt;br /&gt;
**No questions found&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
Activate tokens&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
session key (string) The session key&lt;br /&gt;
&lt;br /&gt;
surveyid (string) The survey ID&lt;br /&gt;
&lt;br /&gt;
additional_attributes (array of integers) Any additional attribute fields to create. Just give the attribute IDs&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) status OK&lt;br /&gt;
*On failure: (array) Any other status&lt;br /&gt;
&lt;br /&gt;
==add_participants==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new entries to your token table. You can also set if for these new entries a token key is automatically create&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*session key (string) - The session key&lt;br /&gt;
*survey ID (string) - The survey id&lt;br /&gt;
*participant data (array) -  2-dimensional array/structure containing your participants data&lt;br /&gt;
*createTokenKey (boolean) - Set this to true if you want a token key create automatically for each entry - if your participant data included a [token] field it will be overwritten&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success:  participant data (struct) -  structure containing your participants data plus the token ID and (if applicable) the new token&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
&lt;br /&gt;
==delete_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to delete multiple participants of a Survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID (int) - Id of the survey to get questions of&lt;br /&gt;
&lt;br /&gt;
aTokenIDs  (array) - IId of the tokens/participants to delete&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of deletion status for each participant&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
&lt;br /&gt;
==get_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return settings of a token/participant of a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to get token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to check&lt;br /&gt;
&lt;br /&gt;
aTokenProperties (array) - The properties to get&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of requested values&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|tid||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==set_participant_properties==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to set properties of a survey participant/token&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the Survey to set token properties&lt;br /&gt;
&lt;br /&gt;
iTokenID (int) - Id of the participant to alter&lt;br /&gt;
&lt;br /&gt;
aTokenData (array) - Key - value pair of the properties to set&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of results of changing properties&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**Invalid tokenid&lt;br /&gt;
**No valid Data&lt;br /&gt;
&lt;br /&gt;
Available Parameters:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|   ||   ||&lt;br /&gt;
|-&lt;br /&gt;
|||   token||   completed&lt;br /&gt;
|-&lt;br /&gt;
| participant_id ||   language||   usesleft&lt;br /&gt;
|-&lt;br /&gt;
|firstname||   blacklisted||   validfrom&lt;br /&gt;
|-&lt;br /&gt;
|   lastname||   sent||   validuntil&lt;br /&gt;
|-&lt;br /&gt;
|email||   remindersent||   mpid&lt;br /&gt;
|-&lt;br /&gt;
|emailstatus||   remindercount||   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==list_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to return the ids and info  of token/participants of a survey.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
iStart (int) - Start id of the token list&lt;br /&gt;
&lt;br /&gt;
iLimit (int) - Number of participants to return&lt;br /&gt;
&lt;br /&gt;
bUnused (bool) - If you want unused tokensm, set true&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Array of Participants info&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No Tokens found&lt;br /&gt;
&lt;br /&gt;
==activate_tokens==&lt;br /&gt;
&lt;br /&gt;
RPC routine to to initialise the survey&#039;s collection of tokens where new participant tokens may be later added&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to list participants&lt;br /&gt;
&lt;br /&gt;
aAttributeFields (array) - An array of integer describing any additional attribute fields&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array) Status OK&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**Token table could not be created&lt;br /&gt;
&lt;br /&gt;
==invite_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to invite participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==remind_participants==&lt;br /&gt;
&lt;br /&gt;
RPC Routine to send reminder for participants in a survey&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) -  Auth credentials&lt;br /&gt;
&lt;br /&gt;
iSurveyID  (int) - Id of the survey to send invitation to participants&lt;br /&gt;
&lt;br /&gt;
iMinDaysBetween (int) - Optional parameter days from last reminder&lt;br /&gt;
&lt;br /&gt;
iMaxReminders (int) - Optional parameter Maximum reminders count&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: (array)  Array of result of each email send action and count of invitations left to send&lt;br /&gt;
*On failure: (array) Failure status&lt;br /&gt;
**Invalid session key&lt;br /&gt;
**No permission&lt;br /&gt;
**Invalid survey ID&lt;br /&gt;
**No token table&lt;br /&gt;
**No candidate tokens&lt;br /&gt;
&lt;br /&gt;
==add_response==&lt;br /&gt;
&lt;br /&gt;
Using this function you can add new responses to your survey response table.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
*sSessionKey (string) - The session key&lt;br /&gt;
*iSurveyID (integer) - The survey id&lt;br /&gt;
*aResponseData (array) -  array/structure containing your response data&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
*On success: response_id (integer) -  Returns the id of the inserted survey response&lt;br /&gt;
*On failure: (array) with error description&lt;br /&gt;
&lt;br /&gt;
==export_responses==&lt;br /&gt;
&lt;br /&gt;
Export response data to pdf,csv,xls,doc&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
&lt;br /&gt;
sSessionKey (string) - Auth credentials&lt;br /&gt;
&lt;br /&gt;
SurveyID (int) - Id of the Survey&lt;br /&gt;
&lt;br /&gt;
DocumentType (string) - pdf,csv,xls,doc&lt;br /&gt;
&lt;br /&gt;
sLanguageCode (string) - The language to be used&lt;br /&gt;
&lt;br /&gt;
CompletionStatus (string) - Optional &#039;complete&#039;,&#039;incomplete&#039; or &#039;all&#039; selection of responses - defaults to complete&lt;br /&gt;
&lt;br /&gt;
HeadingType (string) - &#039;code&#039;,&#039;full&#039; or &#039;abbreviated&#039;. type of question heading. Optional defaults to &#039;code&#039;&lt;br /&gt;
&lt;br /&gt;
ResponseType (string) - &#039;short&#039; or &#039;long&#039; response type.Optional defaults to &#039;short&#039;&lt;br /&gt;
&lt;br /&gt;
FromResponseID (int) - Optional start number of response&lt;br /&gt;
&lt;br /&gt;
ToResponseID (int) - Optional end number of responses&lt;br /&gt;
&lt;br /&gt;
Return:&lt;br /&gt;
&lt;br /&gt;
On success: Requested file as base 64-encoded string.&lt;br /&gt;
&lt;br /&gt;
On failure: Array with error information&lt;br /&gt;
&lt;br /&gt;
Note: If you have huge response sets try only to request a certain number of records at a time otherwise the server may run out of memory.&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
To test you will have to activate JSON-RPC in global settings. To run a simple self-test go to&lt;br /&gt;
&lt;br /&gt;
http://path_to_your_limesurvey_installation/index.php/admin/remotecontrol/test . This will import the example survey, do various things with it and delete it afterwards.&lt;br /&gt;
&lt;br /&gt;
The test assumes that you still are using the standard user &#039;admin&#039; with password &#039;password&#039;.&lt;br /&gt;
&lt;br /&gt;
The client function for this test can be found in /application/controller/admin/remotecontrol.php and the particular function is called test().&lt;br /&gt;
&lt;br /&gt;
=PHP Example=&lt;br /&gt;
&lt;br /&gt;
To include JSON-RPC in your application, you can write an application based on the tiny jsonRPCClient from [http://jsonrpcphp.org/ | jsonrpcphp.org]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once &#039;jsonRPCClient.php&#039;;&lt;br /&gt;
&lt;br /&gt;
define( &#039;LS_BASEURL&#039;, &#039;http://localhost/limesurvey/&#039;);&lt;br /&gt;
&lt;br /&gt;
define( &#039;LS_USER&#039;, &#039;rpcuser&#039; );&lt;br /&gt;
&lt;br /&gt;
define( &#039;LS_PASSWORD&#039;, &#039;mypassword&#039; );&lt;br /&gt;
&lt;br /&gt;
// the survey to process&lt;br /&gt;
&lt;br /&gt;
$survey_id=374699;&lt;br /&gt;
&lt;br /&gt;
// instanciate a new client&lt;br /&gt;
&lt;br /&gt;
$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.&#039;/admin/remotecontrol&#039; );&lt;br /&gt;
&lt;br /&gt;
// receive session key&lt;br /&gt;
&lt;br /&gt;
$sessionKey= $myJSONRPCClient-&amp;gt;get_session_key( LS_USER, LS_PASSWORD );&lt;br /&gt;
&lt;br /&gt;
// receive all&lt;br /&gt;
&lt;br /&gt;
$groups = $myJSONRPCClient-&amp;gt;list_groups( $sessionKey, $survey_id );&lt;br /&gt;
&lt;br /&gt;
print_r($groups, null );&lt;br /&gt;
&lt;br /&gt;
// release the session key&lt;br /&gt;
&lt;br /&gt;
$myJSONRPCClient-&amp;gt;release_session_key( $sessionKey );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Changes=&lt;br /&gt;
&lt;br /&gt;
2.0a Only three functions are supported right now: getSessionKey, releaseSessionKey, deleteSurvey&lt;br /&gt;
&lt;br /&gt;
2.0b Added function add_participants&lt;br /&gt;
&lt;br /&gt;
2.0RC5 Added import_survey, activate_survey, activate_tokens&lt;/div&gt;</summary>
		<author><name>Jweberhofer</name></author>
	</entry>
</feed>