I can't manage the add_participant routine to works for a given survey. Anyone have an idea about it?
Code:
<?php
/* * * * * * * * * * * * * * * * * * * * * *
* Start Edit
* * * * * * * * * * * * * * * * * * * * * */
define( 'LS_BASEURL', 'https://www.vecteursleviers.com/conseil' ); // if subbfolder => https://localhost/MyFolder
define( 'LS_USER', '***' );
define( 'LS_PASSWORD', '***' );
$iSurveyId = 318848; // survey ID
$sid = 318848;
/* * * * * * * * * * * * * * * * * * * * * *
* End Edit
* * * * * * * * * * * * * * * * * * * * * */
/* using LimeSurvey (LS) RemoteControly API version 2's JSON-RPC method */
include "application/libraries/jsonRPCClient.php";
/* instantiate a new client */
$lsJSONRPCClient = new jsonRPCClient( LS_BASEURL.'/index.php/admin/remotecontrol' );
/* receive session key */
$sessionKey = $lsJSONRPCClient->get_session_key(LS_USER, LS_PASSWORD);
/* receive all ids and info of query belonging to a given survey */
$properties = array('template','datecreated','showwelcome','bounce_email');
$result = $lsJSONRPCClient->call('get_survey_properties', array($sessionKey,$iSurveyId,$properties));
/* output */
print_r($result, null );
/* Code from https://code.uoa.gr/p/limesurvey/test_scenarios.php */
/* Participants Data */
$aParticipantData = array(
'user3'=>array('firstname'=>'Christopher',
'lastname'=>'hitchens',
'email'=>'christopher@example.com',
'language'=>'en',
'emailstatus'=>'ok'),
);
/* Add particpants */
$result = $client->call('add_participants', array($sessionkey,$sid,$aParticipantData));
/*List participants */
$result = $client->call('list_participants', array($sessionkey,$sid));
/* End code from https://code.uoa.gr/p/limesurvey/test_scenarios.php */
/* release the session key */
$lsJSONRPCClient->release_session_key($sessionKey);
?>