API get the attributedescriptions

More
3 years 1 month ago - 3 years 1 month ago #114124 by adishardis
adishardis created the topic: API get the attributedescriptions
Hi, I'm trying to get the Attribute names, like Attribute_1 has the description gender.

This is the code:
$property_to_fetch = 'attributedescriptions';

$attributedescriptions = $myJSONRPCClient->get_survey_properties( $sessionKey, $survey_id, $property_to_fetch );

but that returns:

Array ( [status] => No valid Data )

What am I missing?

edit: I'm using Version 2.05+ Build 141003 and other api calls such as list_groups works perfectly!

Cheers
/Adam
Last Edit: 3 years 1 month ago by adishardis. Reason: Made progress and updated the question

Please Log in to join the conversation.

More
3 years 1 month ago #114297 by adishardis
adishardis replied the topic: API get the attributedescriptions
Ok, so I'm getting somewhere and want to update this thread.

I got the api request working with this syntax:

$property_to_fetch = 'attributedescriptions';

$attributedescriptions = $myJSONRPCClient->get_survey_properties( $sessionKey, $survey_id, array($property_to_fetch));

This returns:

Array ( [attributedescriptions] => a:2:{s:11:"attribute_1";a:4:{s:11:"description";s:5:"tel_1";s:9:"mandatory";s:1:"Y";s:13:"show_register";s:1:"N";s:7:"cpdbmap";s:0:"";}s:11:"attribute_2";a:4:{s:11:"description";s:5:"tel_2";s:9:"mandatory";s:1:"N";s:13:"show_register";s:1:"N";s:7:"cpdbmap";s:0:"";}} )

Is there a way to get an array of "Attribute_1" => "tel_1", "Attribute_2" => "tel_2" from this?

Please Log in to join the conversation.

More
3 years 1 month ago #114322 by DenisChenu
DenisChenu replied the topic: API get the attributedescriptions
You know you can look at LS source code ?

unserialize / serialize

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!