Welcome to the LimeSurvey Community Forum

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

Laravel Copy-Survey - Copiando uam Survey atraves de uma API - RESOLVIDO

  • avelar
  • avelar's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 2 months ago #188380 by avelar
Preciso criar uma API, usando o comando copy-Survey, para copiar uma survey automaticamente, estou perdido, poderiam me ajudar?

public function CopiarPesquisa()
{
$limeSurvey = new LimesurveyApiHandle(Config::get('limesurveyApiHandle.url'), Config::get('limesurveyApiHandle.username'), Config::get('limesurveyApiHandle.password'));

$iSurveyID_org = 516357;
$sNewname = 'copia da Pesquisa 516357';


if(ctype_alnum($iSurveyID_org) && strlen($iSurveyID_org == 6)) {

$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.'/index.php/admin/remotecontrol' );

$sSessionKey= $myJSONRPCClient->get_session_key();

if(is_array($sSessionKey)) {
echo $sSessionKey;
}
else if($sSessionKey) {

// copiar pesquisa
$newSurvey = $myJSONRPCClient->copy_survey($sSessionKey, $iSurveyID_org, $sNewname);

// imprimir o resultado da copia.
print_r($newSurvey);
}

$myJSONRPCClient->release_session_key( $sSessionKey );
}
else { // Invalid SID format
die( 'Invalid format!' );
}

Obrigado.

AAvelar
The topic has been locked.
  • avelar
  • avelar's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 2 months ago #188389 by avelar
public function getCopiarPesquisa()
{
$limeSurvey = new LimesurveyApiHandle(Config::get('limesurveyApiHandle.url'), Config::get('limesurveyApiHandle.username'), Config::get('limesurveyApiHandle.password'));

$iSurveyID_org = 516357;
$sNewname = 'copia da Pesquisa 516357';

$newSurvey = $limeSurvey->copy_survey($iSurveyID_org, $sNewname);

print_r($newSurvey);
}
The topic has been locked.
Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose