- Posts: 12
- Thank you received: 2
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
API access to list of participants attributes
- corven
- Topic Author
- Offline
- New Member
Less
More
5 years 3 months ago #178813
by corven
API access to list of participants attributes was created 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!
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!
The topic has been locked.
- corven
- Topic Author
- Offline
- New Member
Less
More
- Posts: 12
- Thank you received: 2
5 years 3 months ago #178814
by corven
Replied by corven on topic API access to list of participants attributes
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"},
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
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13624
- Thank you received: 2490
5 years 3 months ago - 5 years 3 months ago #178815
by DenisChenu
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 , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic API access to list of participants attributes
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.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.
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 , plugin development .
I don't answer to private message.
Last edit: 5 years 3 months ago by DenisChenu.
The following user(s) said Thank You: corven
The topic has been locked.
- corven
- Topic Author
- Offline
- New Member
Less
More
- Posts: 12
- Thank you received: 2
5 years 3 months ago #178828
by corven
Replied by corven on topic API access to list of participants attributes
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:
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.
I think the documentation should also mention that all the preceding parameters need to be included even if they are not relevant.
Something like:
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.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10103
- Thank you received: 3591
5 years 3 months ago #178832
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic API access to list of participants attributes
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.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13624
- Thank you received: 2490
5 years 3 months ago #178835
by DenisChenu
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 , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic API access to list of participants attributes
It's what order mean …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.
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 , plugin development .
I don't answer to private message.
The topic has been locked.
- corven
- Topic Author
- Offline
- New Member
Less
More
- Posts: 12
- Thank you received: 2
5 years 3 months ago #178843
by corven
Replied by corven on topic API access to list of participants attributes
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.
I won't edit it if you feel it is clear enough as it is.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13624
- Thank you received: 2490
5 years 3 months ago #178860
by DenisChenu
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 , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic API access to list of participants attributes
Yes, but if you need the 5th parameters, and the 4th is optionnal : this mean you must include 4th parameter, no ?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.
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 , plugin development .
I don't answer to private message.
The topic has been locked.