Activate Tokens Remote Control - Additional Attributes

More
7 months 3 weeks 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?

Please Log in or Create an account to join the conversation.

More
7 months 1 week ago #178900 by bmdavis
Anyone have an example for the format of RPC activate_tokens command - attributefields array?

Please Log in or Create an account to join the conversation.

More
7 months 1 week ago - 7 months 1 week 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: 7 months 1 week ago by tpartner.
The following user(s) said Thank You: DenisChenu, bmdavis

Please Log in or Create an account to join the conversation.

More
7 months 1 week ago #178970 by bmdavis
Thanks Tony! That definitely worked. Any chance we can also pass in a "Field Description" through the API?

Please Log in or Create an account to join the conversation.

More
7 months 1 week 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

Please Log in or Create an account to join the conversation.

More
7 months 1 week 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?

Please Log in or Create an account to join the conversation.

More
7 months 1 week ago #179085 by bmdavis

Please Log in or Create an account to join the conversation.

More
7 months 1 week 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 .
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!