API access to list of participants attributes

More
5 months 2 weeks ago #178813 by corven
Hello,

the following api request works fine and gives me the expected results, including the participant_info attributes firstame, lastname and email.

REQUEST:

{
"method": "list_participants",
"params": {
"sSessionKey":"XXXXXXXXXXXXX",
"iSurveyID": 123456,
"iStart": 0,
"iLimit": 500,
},
"id": 1
}

RESULTS

{"tid":"5","token":"7fogajzloiVaddT","participant_info":{"firstname":"","lastname":"","email":""}},{"tid":"6","token":"qqTlbxdZN2cJ57z","participant_info":{"firstname":"","lastname":"","email":""}},{"tid":"7","token":"7pzoeFNSYbfqqLZ","participant_info":{"firstname":"","lastname":"","email":""}},{"tid":"8","token":"ON4tey6z9d4DaIS","participant_info":{"firstname":"","lastname":"","email":""}},{"tid":"9","token":"MMhTnZ5FSo5ovoO","participant_info":{"firstname":"","lastname":"","email":""}},


I'd like to access the rest of attributes, like usesleft or completed. According to the API I should add the parameter aAttributes to my request with an array of the required attributes.

{
"method": "list_participants",
"params": {
"sSessionKey":"XXXXXXXXXXXX",
"iSurveyID": 123456,
"iStart": 0,
"iLimit": 500,
"aAttributes": ["completed", "usesleft"]
},
"id": 1
}

which gives me exactly the same results as the previous request and doesn't include the required attributes.


The user ID is the superadmin so it is not a permissions issue, I've tried changing other parameters in the request and the changes work fine, it is just the aAttributes that is not working.

Any idea of what's wrong with my request?


Using version 3.7.3


Thanks in advance!

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

LimeSurvey Partners
More
5 months 2 weeks ago #178814 by corven
Here is the answer to my problem. the optional parameter bUnused needs to be included for the request to work.

Am I doing something wrong or is this a bug? In case it is not a bug, this definitely needs to be included in the documentation. I've been struggling with this issue for hours.

{
"method": "list_participants",
"params": {
"sSessionKey":"XXXXXXXXXXXX",
"iSurveyID": 123456,
"iStart": 0,
"iLimit": 500,
"bUnused": false,
"aAttributes": ["completed", "usesleft"]
},
"id": 1
}


RESULTS

{"tid":"5","token":"7fogajzloiVaddT","participant_info":{"firstname":"","lastname":"","email":""},"completed":"N","usesleft":"1"},{"tid":"6","token":"qqTlbxdZN2cJ57z","participant_info":{"firstname":"","lastname":"","email":""},"completed":"N","usesleft":"1"},{"tid":"7","token":"7pzoeFNSYbfqqLZ","participant_info":{"firstname":"","lastname":"","email":""},"completed":"N","usesleft":"1"},{"tid":"8","token":"ON4tey6z9d4DaIS","participant_info":{"firstname":"","lastname":"","email":""},"completed":"N","usesleft":"1"},{"tid":"9","token":"MMhTnZ5FSo5ovoO","participant_info":{"firstname":"","lastname":"","email":""},"completed":"N","usesleft":"1"},
The following user(s) said Thank You: DenisChenu

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

More
5 months 2 weeks ago - 5 months 2 weeks ago #178815 by DenisChenu

corven wrote: Am I doing something wrong or is this a bug? In case it is not a bug, this definitely needs to be included in the documentation. I've been struggling with this issue for hours.

Json request are done with ordered parameters, not named parameters : this can be improved , but it's a new feature then … not really a bug. And if a merge request is done : it must be without broking usage of ordered parameters.

Maybe this need to be better documented: i add it quickly here : manual.limesurvey.org/RemoteControl_2_API#Other_functions , if you can improve it :)

api.limesurvey.org/classes/remotecontrol...od_list_participants

It's my point of view :)

PS : updated again manul : usage of JSON RPC version 1 : then always «params - An Array of objects to pass as arguments to the method. »

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 .
Last edit: 5 months 2 weeks ago by DenisChenu.
The following user(s) said Thank You: corven

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

More
5 months 2 weeks ago #178828 by corven
Thanks for the clarification Denis,

I think the documentation should also mention that all the preceding parameters need to be included even if they are not relevant.

Something like:
https://manual.limesurvey.org/RemoteControl_2_API#Other_functions
Parameter structure use array of values, you must send the values in the API expected order (see jsonrpc specification), and all preceding parameters must be included in the request.

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

More
5 months 2 weeks ago #178832 by tpartner
The documentation is a wiki. Update it as you see fit.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com

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

More
5 months 2 weeks ago #178835 by DenisChenu

corven wrote: Thanks for the clarification Denis,

I think the documentation should also mention that all the preceding parameters need to be included even if they are not relevant.

It's what order mean …

1st param at 1st, 2nd param at 2nd then if you need only 2nd you must set 1st (to null for example)

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.

More
5 months 2 weeks ago #178843 by corven
Order doesn't mean you need to include the optional parameters, it just implies the included parameters need to be in the same position in relation to each other.

I won't edit it if you feel it is clear enough as it is.

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

More
5 months 2 weeks ago #178860 by DenisChenu

corven wrote: Order doesn't mean you need to include the optional parameters, it just implies the included parameters need to be in the same position in relation to each other.

Yes, but if you need the 5th parameters, and the 4th is optionnal : this mean you must include 4th parameter, no ?


If it's unclear : please : you can some more detailed sentence after the alerts :)

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!