Not able to export data using the API

Dear users,

I have tested several R wrappers for the API as well as the Python wrapper and in particular, I cannot start neither download the data for all the questionnaires in our server and workspace.

Our server is

https://encuestass.ine.cl/pilotoagro

The responses I get from the apidocs in export section are 403 Forbidden. Similar result with curl in Bash command line.

The result I get from the R/Python wrappers in exporting are questionnaire is not found.

I am aware another team in my institution was able to export data 1 or 2 years ago, possibly using V1 of the API, but that doesn’t work anymore.

Could this be related to our server setup?
How can I ask some support if that is the case. I mean, so to guide a better question to IT people.

Thanks in advance.

PS:
I tested all R/Python wrappers mentioned in the link:

And some others mentioned in the forum without luck:

Hello @_Matias21 ,

the first thing that comes to mind when you write that basically nothing works is that you might have wrong credentials to the server.

If you are 100% confident that you have the right credentials, then, please, check what is actually working. At least you should be able to succeed in getting some read operations such as getting the list of questionnaires or users. Knowing what works and what doesn’t will give a more clear picture of what is going on and what may be the reason for the errors.

Perhaps, especially because in your description you have no success at all in calling any API. But only you know the details of your server’s setup. For example, when I try to access the address you’ve posted I am getting the following:


so the server you are using could be too slow to respond or be selective to which queries it responds.

Specifically on the export, the API did change about a year ago, so your colleagues may have been using an older way of doing it, but at least Andre’s package that you’ve mentioned is specifically mentioning that his package is implementing the API V2 export procedure according to the flow I recommended in this post of this forum.

The API wrappers, libraries, adapters, etc are work of individual authors, who are best positioned to provide assistance and indicate what is implemented in their codes and what is not supported. Andre’s package description also indicates that " susor is work in process" and “feel free to collaborate on making susor easier and more efficient to use.

Hope this helps.

Best, Sergiy Radyakin

Hello @sergiy ,

When I enter the url:
https://encuestass.ine.cl
the browser loads this:
https://encuestass.ine.cl/Account/LogOn?ReturnUrl=%2F

Or enter:
https://encuestass.ine.cl/pilotoagro
the browser redirects to this:
https://encuestass.ine.cl/pilotoagro/Account/LogOn?ReturnUrl=%2Fpilotoagro%2F

Regarding the credentials, the HQ user has been enabled to be API user too. So I use the same credentials.

With the API + R or Python I can list the questionnaires IDs but when I try any of them, it gives 404.

Thankyou for your reply.

Hello @_Matias21 ,

I am getting the same time out message when trying to access the second address also. This may be specific blocking of users by IP-range, country, or network, or too many hops between my machine and your server, or something else.

I am not sure what this means. Any account in survey solutions is only one role it is either HQ, or API user, but not both. Some API functionality may be available to users not in API role (mostly GraphQL), but definitely retry with the credentials of the user that is specifically in the role API-user.

Regarding the site, it does appear to be online, yet not connecting from all locations:

Response in 28 seconds is on the margin of being functional, and probably will not be comfortable to work with.

Thankyou @sergiy for the feedback.

It seems the API credentials are not correct. Although I used the API to create/archive/unarchive assignments and users before. As you said, some functionality did work without it. I am waiting for IT reply, but seems to be that.

Also, regarding code used before by other teams, I tested with a colleague and is working correctly in other workspaces, including version 1 of the API.

Thankyou again for your support.

Be careful to use an API user when working with the API. For some requests, HQ user credentials are (wrongly) accepted. (Note to self: report this issue.) For all interactions with the API, one needs API user credentials for a user authorized to access the target workspace.

Regarding API wrappers, be careful whether functions use the V1 or V2 API–and use workspaces. As Sergiy pointed out, wrappers are written by individuals, and may not be maintained. To figure out what the wrapper is doing, you may need to either check the documentation or the source code.