Activate Tokens Remote Control - Additional Attributes

More
1 year 6 months ago #178714 by bmdavis
Hello,

I'm looking for a little more specificity or an example for the RPC activate_tokens command, specifically regarding additional attributes.

The reference mentions:
array $aAttributeFields  An array of integer describing any additional attribute fields

Can someone please provide an example using the attributefields array?
The topic has been locked.
LimeSurvey Partners
More
1 year 6 months ago #178900 by bmdavis
Anyone have an example for the format of RPC activate_tokens command - attributefields array?
The topic has been locked.
More
1 year 6 months ago - 1 year 6 months ago #178902 by tpartner
Here is a simple PHP example:

<?php
 
	define( 'LS_BASEURL', 'http://path/to/limesurvey/');
	define( 'LS_USER', 'admin' );
	define( 'LS_PASSWORD', 'password' );
 
	require_once '../../../../../application/libraries/jsonRPCClient.php';
 
	$iSurveyID = 123456;
 
 
	// Instantiate a new RPC client
	$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.'/index.php/admin/remotecontrol' );
 
	// Get a session key
	$sSessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD );
 
	// Define attributes
	$aAttributeFields = array(1, 2, 3);
 
	// Activate the tokens
	$tokenActivation = $myJSONRPCClient->activate_tokens($sSessionKey, $iSurveyID, $aAttributeFields);
 
	// The returned result
	if($tokenActivation['status'] == 'OK') {
		echo 'Tokens created for survey '.$iSurveyID.'.';
	}
	else {
		echo 'Tokens NOT created for survey '.$iSurveyID.': '.$tokenActivation['status'];
	}
 
	// Release the session key
	$myJSONRPCClient->release_session_key( $sSessionKey );
?>


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Attachments:
Last edit: 1 year 6 months ago by tpartner.
The following user(s) said Thank You: DenisChenu, bmdavis
The topic has been locked.
More
1 year 6 months ago #178970 by bmdavis
Thanks Tony! That definitely worked. Any chance we can also pass in a "Field Description" through the API?
The topic has been locked.
More
1 year 5 months ago #179028 by tpartner
As far as I know, that is not currently possible.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
The following user(s) said Thank You: DenisChenu
The topic has been locked.
More
1 year 5 months ago #179084 by bmdavis
Thanks again tpartner.

How can I make a feature request to notify the developers that this would be desirable feature to add?
The topic has been locked.
More
1 year 5 months ago #179085 by bmdavis
The topic has been locked.
More
1 year 5 months ago #179106 by DenisChenu
You can create your oanw function in remote control,

See : gitlab.com/SondagesPro/RemoteControl/extendRemoteControl for a demo.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development . I don't answer to private message.
The topic has been locked.

Start now!

Just create your account and start using Limesurvey today.

Register now