package | Default |
---|
__construct(\AdminController $controller)
_checkEmailFormat( $sEmail): boolean
boolean
_checkSessionKey(string $sSessionKey): boolean
access | protected |
---|
string
Auth credentials
boolean
_doLogin(string $sUsername,string $sPassword,string $sPlugin): boolean|string
access | protected |
---|
string
username
string
password
string
plugin to be used
boolean|string
_jumpStartSession(string $username): boolean
access | protected |
---|
string
The username
boolean
activate_survey(string $sSessionKey,integer $iSurveyID): array
Return the result of the activation Failure status : Invalid Survey ID, Survey already active, Consistency check error, Activation Error, Invalid session key, No permission
access | public |
---|
string
Auth credentials
integer
ID of the Survey to be activated
array
in case of success result of the activation
activate_tokens(string $sSessionKey,integer $iSurveyID,array $aAttributeFields = array()): array
Initialise the survey participant table of a survey where new participant tokens may be later added.
access | public |
---|
string
Auth credentials
integer
ID of the Survey where a survey participants table will be created for
array
An array of integer describing any additional attribute fields
array
Status=>OK when successful, otherwise the error description
add_group(string $sSessionKey,integer $iSurveyID,string $sGroupTitle,string $sGroupDescription = ''): array|integer
Used as a placeholder for importing questions. Returns the groupid of the created group.
access | public |
---|
string
Auth credentials
integer
ID of the Survey to add the group
string
Name of the group
string
Optional description of the group
array|integer
The id of the new group - Or status
add_language(string $sSessionKey,integer $iSurveyID,string $sLanguage): array
access | public |
---|
string
Auth credentials
integer
ID of the Survey for which a survey participants table will be created
string
A valid language shortcut to add to the current Survey. If the language already exists no error will be given.
array
Status=>OK when successful, otherwise the error description
add_participants(string $sSessionKey,integer $iSurveyID,array $aParticipantData,boolean $bCreateToken = true): array
The parameters $aParticipantData is a 2 dimensionnal array containing needed participant data.
see | \Token for all available attribute, |
---|---|
example |
Returns the inserted data including additional new information like the Token entry ID and the token string. In case of errors in some data, return it in errors. |
access | public |
string
Auth credentials
integer
ID of the Survey
array
Data of the participants to be added
boolean
Optional - Defaults to true and determins if the access token automatically created
array
The values added
add_response(string $sSessionKey,integer $iSurveyID,array $aResponseData): integer|array
Returns the id of the inserted survey response
access | public |
---|---|
todo | Need to clean up return array, especially the case when response was added but file not uploaded. See discussion: https://bugs.limesurvey.org/view.php?id=13794 |
string
Auth credentials
integer
ID of the Survey to insert responses
array
The actual response
integer|array
The response ID or an array with status message (can include result_id)
add_survey(string $sSessionKey,integer $iSurveyID,string $sSurveyTitle,string $sSurveyLanguage,string $sformat = 'G'): integer|array
This just tries to create an empty survey with the minimal settings.
Failure status: Invalid session key, No permission, Faulty parameters, Creation Failed result
access | public |
---|
string
Auth credentials
integer
The desired ID of the Survey to add
string
Title of the new Survey
string
Default language of the Survey
string
(optional) Question appearance format (A, G or S) for "All on one page", "Group by Group", "Single questions", default to group by group (G)
integer|array
The survey id in case of success
copy_survey(string $sSessionKey,integer $iSurveyID_org,string $sNewname): array
access | public |
---|
string
Auth credentials
integer
Id of the source survey
string
name of the new survey
array
On success: new $iSurveyID in array['newsid']. On failure array with error information
cpd_importParticipants(integer $sSessionKey, $participants,boolean $update = false): array
It stores attributes as well, if they are registered before within ui
Call the function with $response = $myJSONRPCClient->cpd_importParticipants( $sessionKey, $aParticipants);
integer
boolean
array
with status
delete_group(string $sSessionKey,integer $iSurveyID,integer $iGroupID): array|integer
Returns the id of the deleted group.
access | public |
---|
string
Auth credentials
integer
ID of the Survey that the group belongs
integer
ID of the group to delete
array|integer
The ID of the deleted group or status
delete_language(string $sSessionKey,integer $iSurveyID,string $sLanguage): array
access | public |
---|
string
Auth credentials
integer
ID of the Survey for which a survey participants table will be created
string
A valid language shortcut to delete from the current Survey. If the language does not exist in that Survey no error will be given.
array
Status=>OK when successful, otherwise the error description
delete_participants(string $sSessionKey,integer $iSurveyID,array $aTokenIDs): array
Returns the id of the deleted token
access | public |
---|
string
Auth credentials
integer
ID of the Survey that the participants belong to
array
ID of the tokens/participants to delete
array
Result of deletion
delete_question(string $sSessionKey,integer $iQuestionID): array|integer
Returns the id of the deleted question.
access | public |
---|
string
Auth credentials
integer
ID of the Question to delete
array|integer
ID of the deleted Question or status
delete_response(string $sSessionKey,integer $iSurveyID,integer $iResponseID): array
RPC Routine to delete responses of particular id in a survey. Returns array
access | public |
---|
string
Auth credentials
integer
Id of the survey that participants belong
integer
Id of the response to delete
array
Result of the change action
delete_survey(string $sSessionKey,integer $iSurveyID): array
Failure status: Invalid session key, No permission
access | public |
---|
string
Auth credentials
integer
The ID of the Survey to be deleted
array
Returns status : status are OK in case of success
export_responses(string $sSessionKey,integer $iSurveyID,string $sDocumentType,string $sLanguageCode = null,string $sCompletionStatus = 'all',string $sHeadingType = 'code',string $sResponseType = 'short',integer $iFromResponseID = null,integer $iToResponseID = null,array $aFields = null,array $aAdditionalOptions = null): array|string
access | public |
---|
string
Auth credentials
integer
ID of the Survey
string
any format available by plugins (for example : pdf, csv, xls, doc, json)
string
(optional) The language to be used
string
(optional) 'complete','incomplete' or 'all' - defaults to 'all'
string
(optional) 'code','full' or 'abbreviated' Optional defaults to 'code'
string
(optional)'short' or 'long' Optional defaults to 'short'
integer
(optional) Frpm response id
integer
(optional) To response id
array
(optional) Name the fields to export
array
(optional) Addition options for export, mainly 'convertY', 'convertN', 'nValue', 'yValue',
array|string
On success: Requested file as base 64-encoded string. On failure array with error information
export_responses_by_token(string $sSessionKey,integer $iSurveyID,string $sDocumentType,string $sToken,string $sLanguageCode = null,string $sCompletionStatus = 'all',string $sHeadingType = 'code',string $sResponseType = 'short',array $aFields = null): array|string
Returns the requested file as base64 encoded string
access | public |
---|
string
Auth credentials
integer
ID of the Survey
string
pdf, csv, xls, doc, json
string
The token for which responses needed
string
The language to be used
string
Optional 'complete','incomplete' or 'all' - defaults to 'all'
string
'code','full' or 'abbreviated' Optional defaults to 'code'
string
'short' or 'long' Optional defaults to 'short'
array
Optional Selected fields
array|string
On success: Requested file as base 64-encoded string. On failure array with error information
export_statistics(string $sSessionKey,integer $iSurveyID,string $docType = 'pdf',string $sLanguage = null,string $graph = '0',integer|array $groupIDs = null): string|array
Allow to export statistics available Returns string - base64 encoding of the statistics.
access | public |
---|
string
Auth credentials
integer
ID of the Survey
string
(optional) Type of documents the exported statistics should be (pdf|xls|html)
string
(optional) language of the survey to use (default from Survey)
string
(optional) Create graph option (default : no)
integer|array
(optional) array or integer containing the groups we choose to generate statistics from
string|array
in case of success : Base64 encoded string with the statistics file
export_timeline(string $sSessionKey,integer $iSurveyID,string $sType,string $dStart,string $dEnd): array
Returns an array of values (count and period)
access | public |
---|
string
Auth credentials
integer
ID of the Survey
string
(day|hour)
string
string
array
On success: The timeline. On failure array with error information
get_fieldmap(string $sessionKey,integer $surveyId,string $language = null): array
Returns the requested survey's fieldmap in an array
access | public |
---|
string
Auth credentials
integer
ID of the Survey
string
(optional) language of the survey to use (default from Survey)
array
get_group_properties(string $sSessionKey,integer $iGroupID,array $aGroupSettings = null,string $sLanguage = null): array
Returns array of properties needed or all properties
see | \QuestionGroup for available properties |
---|---|
access | public |
string
Auth credentials
integer
Id of the group to get properties of
array
The properties to get
string
Optional parameter language for multilingual groups
array
in case of success the requested values in array
get_language_properties(string $sSessionKey,integer $iSurveyID,array|null $aSurveyLocaleSettings = null,string|null $sLang = null): array
see | \SurveyLanguageSetting for available properties |
---|---|
access | public |
string
Auth credentials
integer
ID of the Survey
array|null
(optional) Properties to get, default to all attributes
string|null
(optional) Language to use, default to Survey->language
array
in case of success The requested values
get_participant_properties(string $sSessionKey,integer $iSurveyID,array|integer $aTokenQueryProperties,array $aTokenProperties = null): array
Allow to request for a specific participant. If more than one participant is returned with specified attribute(s) an error is returned.
access | public |
---|
string
Auth credentials
integer
ID of the Survey to get token properties
array|integer
of participant properties used to query the participant, or the token id as an integer
array
The properties to get
array
The requested values
get_question_properties(string $sSessionKey,integer $iQuestionID,array $aQuestionSettings = null,string $sLanguage = null): array
see | \Question for available properties. Some more properties are available_answers, subquestions, attributes, attributes_lang, answeroptions, answeroptions_multiscale, defaultvalue |
---|---|
access | public |
string
Auth credentials
integer
ID of the question to get properties
array
(optional) properties to get, default to all
string
(optional) parameter language for multilingual questions, default are \Survey->language
array
The requested values
get_response_ids(string $sSessionKey,integer $iSurveyID,string $sToken): array
string
integer
string
array
get_session_key(string $username,string $password,string $plugin = 'Authdb'): string|array
Using this function you can create a new XML-RPC/JSON-RPC session key. This is mandatory for all following LSRC2 function calls.
access | public |
---|
string
string
string
to be used
string|array
get_site_settings(string $sSessionKey,string $sSetttingName): string|array
Function to query site settings. Can only be used by super administrators.
access | public |
---|
string
Auth Credentials
string
Name of the setting to get
string|array
The requested value or an array with the error in case of error
get_summary(string $sSessionKey,integer $iSurveyID,string $sStatName = 'all'): string|array
Returns the requested value as string, or all status in an array
Available status are
all
Failure status : No available data, No such property, Invalid session key, No permission
access | public |
---|
string
Auth credentials
integer
ID of the Survey to get summary
string
(optional) Name of the summary option, or all to send all in an array (all by default)
string|array
in case of success the requested value or an array of all values
get_survey_properties(string $sSessionKey,integer $iSurveyID,array|null $aSurveySettings = null): array
Get properties of a survey All internal properties of a survey are available.
see | \Survey for the list of available properties Failure status : Invalid survey ID, Invalid session key, No permission, No valid Data |
---|---|
access | public |
string
Auth credentials
integer
The id of the Survey to be checked
array|null
(optional) The properties to get
array
get_uploaded_files(string $sSessionKey,integer $iSurveyID,string $sToken): array
access | public |
---|
string
Auth credentials
integer
ID of the Survey
string
Response token
array
On success: array containing all uploads of the specified response On failure: array with error information
import_group(string $sSessionKey,integer $iSurveyID,string $sImportData,string $sImportDataType,string $sNewGroupName = null,string $sNewGroupDescription = null): array|integer
access | public |
---|
string
Auth credentials
integer
The ID of the Survey that the group will belong
string
String containing the BASE 64 encoded data of a lsg,csv
string
lsg,csv
string
Optional new name for the group
string
Optional new description for the group
array|integer
iGroupID - ID of the new group or status
import_question(string $sSessionKey,integer $iSurveyID,integer $iGroupID,string $sImportData,string $sImportDataType,string $sMandatory = 'N',string $sNewQuestionTitle = null,string $sNewqQuestion = null,string $sNewQuestionHelp = null): array|integer
Import a question from lsq file
access | public |
---|
string
integer
The ID of the Survey that the question will belong to
integer
The ID of the Group that the question will belong to
string
String containing the BASE 64 encoded data of a lsq
string
lsq
string
(optional) Mandatory question option (default to No)
string
(optional) new title for the question
string
(optional) new question text
string
(optional) new question help text
array|integer
The id of the new question in case of success. Array if errors
import_survey(string $sSessionKey,string $sImportData,string $sImportDataType,string $sNewSurveyName = null,integer $DestSurveyID = null): integer|array
Allow importing lss, csv, xls or survey zip archive in BASE 64 encoded.
Failure status: Invalid session key, No permission, The import error
access | public |
---|
string
Auth Credentials
string
String containing the BASE 64 encoded data of a lss, csv, txt or survey lsa archive
string
lss, csv, txt or lsa
string
(optional) The optional new name of the survey
integer
(optional) This is the new ID of the survey - if already used a random one will be taken instead
integer|array
The ID of the new survey in case of success
invite_participants(string $sSessionKey,integer $iSurveyID,array $aTokenIds = null,boolean $bEmail = true): array
Returns array of results of sending. The sending stops on the first error (ie. when a token is invalid).
access | public |
---|
string
Auth credentials
integer
ID of the survey that participants belong
array
Ids of the participant to invite
boolean
Send only pending invites (TRUE) or resend invites only (FALSE)
array
Result of the action
list_groups(string $sSessionKey,integer $iSurveyID,string $sLanguage = null): array
Returns the ids and all attributes of all survey groups
access | public |
---|
string
Auth credentials
integer
ID of the Survey containing the groups
string
Optional parameter language for multilingual groups
array
in case of success the list of groups
list_participants(string $sSessionKey,integer $iSurveyID,integer $iStart,integer $iLimit = 10,boolean $bUnused = false,boolean|array $aAttributes = false,array $aConditions = array()): array
If $bUnused is true, user will get the list of uncompleted tokens (token_return functionality). Parameters iStart and iLimit are used to limit the number of results of this call. Starting with version 4.3.0 it is not possible anymore to query for several IDs just using an array of values - instead you have use the 'IN' operator. Examples of conditions: array ('tid => 'IN','1','3','26') array('email' => 'info@example.com') array('validuntil' => array('>', '2019-01-01 00:00:00'))
By default return each participant with basic information
access | public |
---|
string
Auth credentials
integer
ID of the Survey to list participants
integer
Start id of the token list
integer
Number of participants to return
boolean
If you want unused tokens, set true
boolean|array
The extented attributes that we want
array
Optional conditions to limit the list, either as a key=>value array for simple comparisons or as key=>array(operator,value[,value[...]]) using an operator. Valid operators are ['<', '>', '>=', '<=', '=', '<>', 'LIKE', 'IN'] Only the IN operator allows for several values. The same key can be used several times. All conditions are connected by AND.
array
The list of tokens
list_questions(string $sSessionKey,integer $iSurveyID,integer $iGroupID = null,string $sLanguage = null): array
Returns array of ids and info.
access | public |
---|
string
Auth credentials
integer
ID of the Survey to list questions
integer
Optional id of the group to list questions
string
Optional parameter language for multilingual questions
array
The list of questions
list_survey_groups(string $sSessionKey,string|null $sUsername = null): array
If user is admin he can get survey groups of every user (parameter sUser) or all survey groups (sUser=null) Else only the survey groups belonging to the user requesting will be shown.
Returns array with survey group attributes
access | public |
---|
string
Auth credentials
string|null
(optional) username to get list of survey groups
array
In case of success the list of survey groups
list_surveys(string $sSessionKey,string|null $sUsername = null): array
If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null) Else only the surveys belonging to the user requesting will be shown.
Returns array with
sid
the ids of surveysurveyls_title
the title of the surveystartdate
start dateexpires
expiration dateactive
if survey is active (Y) or not (!Y)access | public |
---|
string
Auth credentials
string|null
(optional) username to get list of surveys
array
In case of success the list of surveys
list_users(string $sSessionKey = null,integer $uid = null,string $username = null): array
Returns array of ids and info.
Failure status : Invalid user id, Invalid username, No users found, Invalid session key, Permission denied (super admin is required)
string
Auth credentials
integer
Optional; ID of the user
string
Optional; name of the user
array
The list of users in case of success
mail_registered_participants(string $sSessionKey,integer $iSurveyID,array $overrideAllConditions = array()): array
Returns array of results of sending
Default behaviour is to send register emails to not invited, not reminded, not completed and in valid frame date participant.
$overrideAllConditions replaces this default conditions for selecting the participants. A typical use case is to select only one participant
$overrideAllConditions = Array();
$overrideAllConditions[] = 'tid = 2';
$response = $myJSONRPCClient->mail_registered_participants( $sessionKey, $survey_id, $overrideAllConditions );
access | public |
---|
string
Auth credentials
integer
ID of the Survey that participants belong
array
replace the default conditions
array
Result of the action
release_session_key(string $sSessionKey): string
Using this function you can close a previously opened XML-RPC/JSON-RPC session.
access | public |
---|
string
the session key
string
OK
remind_participants(string $sSessionKey,integer $iSurveyID,integer $iMinDaysBetween = null,integer $iMaxReminders = null,array $aTokenIds = false): array
Returns array of results of sending
access | public |
---|
string
Auth credentials
integer
ID of the Survey that participants belong
integer
(optional) parameter days from last reminder
integer
(optional) parameter Maximum reminders count
array
Ids of the participant to remind (optional filter)
array
in case of success array of result of each email send action and count of invitations left to send in status key
set_group_properties(string $sSessionKey,integer $iGroupID,array $aGroupData): array
see | \QuestionGroup for available properties and restriction Some attribute can not be set
|
---|---|
access | public |
string
Auth credentials
integer
array
array
Of succeeded and failed modifications according to internal validation.
set_language_properties(string $sSessionKey,integer $iSurveyID,array $aSurveyLocaleData,string $sLanguage = null): array
see | \SurveyLanguageSetting for available properties. Some properties can not be set
|
---|---|
access | public |
string
Auth credentials
integer
array
string
array
in case of success 'status'=>'OK', when save successful otherwise error text.
set_participant_properties(string $sSessionKey,integer $iSurveyID,array|integer $aTokenQueryProperties,array $aTokenData): array
Allow to set properties about a specific participant, only one particpant can be updated.
see | \Token for available properties |
---|---|
access | public |
string
Auth credentials
integer
Id of the Survey that participants belong
array|integer
of participant properties used to query the participant, or the token id as an integer
array
Data to change
array
Result of the change action
set_question_properties(string $sSessionKey,integer $iQuestionID,array $aQuestionData,string $sLanguage = null): array
see | \Question for available properties. Restricted properties:
|
---|---|
access | public |
string
Auth credentials
integer
array
string
Optional parameter language for multilingual questions
array
Of succeeded and failed modifications according to internal validation.
set_quota_properties(string $sSessionKey,integer $iQuotaId,array $aQuotaData): array
Retuns an array containing the boolean 'success' and 'message' with either errors or Quota attributes (on success)
access | public |
---|
string
Auth credentials
integer
Quota ID
array
Quota attributes as array eg ['active'=>1,'limit'=>100]
array
['success'=>bool, 'message'=>string]
set_survey_properties(string $sSessionKey,integer $iSurveyID,array $aSurveyData): array
see | \Survey for the list of available properties Properties available are restricted
In case of partial success : return an array with key as properties and value as boolean , true if saved with success. Failure status : Invalid survey ID, Invalid session key, No permission, No valid Data |
---|---|
access | public |
string
Auth credentials
integer
array
array
Of succeeded and failed nodifications according to internal validation
update_response(string $sSessionKey,integer $iSurveyID,array $aResponseData): array|boolean
Routine supports only single response updates. Response to update will be identified either by the response id, or the token if response id is missing. Routine is only applicable for active surveys with alloweditaftercompletion = Y.
access | public |
---|
string
Auth credentials
integer
Id of the Survey to update response
array
The actual response
array|boolean
TRUE(bool) on success. Array with error status on failure.
upload_file(string $sSessionKey,integer $iSurveyID,string $sFieldName,string $sFileName,string $sFileContent): array
Returns the metadata on success.
access | public |
---|
string
Auth credentials
integer
ID of the Survey to insert file
string
the Field to upload file
string
the uploaded file name
string
the uploaded file content encoded as BASE64
array
The file metadata with final upload path or error description
INVALID_SESSION_KEY