Ssaw InterviewsApi Bug

When ever I use ssaw.InterviewsApi().get_list() it returns only 100 interviews while there are hundreds of interviews on the server. See sample code below;

c = 0
for interview in ssaw.InterviewsApi(client, workspace=Workspace).get_list(questionnaire_variable = ‘census2021_VR’):
c += 1


This is somewhat hidden behavior of Survey Solutions API itself, to avoid (unintended) load on the servers, hard limit of 100 rows is imposed on the response - all list queries are affected. A user will get smaller number of rows if take or where parameters are specified but the overall size of returned results is still 100 from the server.

I plan to update ssaw code to overcome this change and try and read all rows (if so requested by the user) using paging. This way, although execution of the code to read many interviews may still take long time on your client machine, the server running Survey Solutions will not be overwhelmed.

I will update this post as soon as the new version of the package is published.

p.s. As a separate note, if you really need to read unfiltered list of many (all) interviews, getting the full export may be more efficient way to do it.

Please update to the 0.6.3 version of the package.
In addition to interviews list, questionnaires and users were affected. With this version, all methods retrieve the full list of items.

1 Like

It works, thank you very much.

Good Day,

When using UsersApi(client).list_supervisors() only the supervisors from the Primary/Default workspace are returned. Is this a bug with the api or is there a way to filter by workspace?

Before the update of the package I was able to filter by workspace however the users from one of the workspace were not returned.

Survey Solutions API (somewhat unfortunately) is split between two implementations - some actions are available as part of the REST api, and others, in the newer GraphQL. REST and GraphQL work/are implemented slightly differently - for the REST endpoints, they are workspace-specific (i.e. GET /primary/api/v1/supervisors or /otherworkspace/api/v1/supervisors).

However, after introducing workspaces, users management became a global action so they are outside of workspaces. So the newer GraphQL-based users list (UsersAPI.get_list() method) works across this global user list, irrespective of their workspace.

so when you run UsersAPI(client).get_supervisors() it returns supervisors only from the primary workspace, as it is the default if you don’t explicitly specify otherwise. If you want to work with another workspace, you will need to create the client specific for that i.e. client = Client(url, user, password, workspace)

Unfortunately, there is no workspace filter in the GraphQL users list at this moment, so I couldn’t implement get_supervisors and get_interviewers, in the new, general way, but hopefully some consolidation in API will happen so that this inconvenience will be improved.

Thank you for the information, I’ve managed to get my script to work by filtering by workspace at the Client level.