Accessing the server using api

I have a personal demo server that I would like to access using susoapi. Am unable to do so. Any leads? I try the same with python but still unable to

library(susoapi)

Authentication -----------------------------------------------------------

set_credentials(
server = “https://mosotieno-demo.mysurvey.solutions”,
user = “mootieno”,
password = “MyCorrectPassword”
)

check_credentials()

Since you get the same result for R and Python wrappers, please check a few things:

  • That your user is an API user
  • That the login and password provided are correct for the user
  • That your requests specify a workspace (if not “primary”)
  • That your user has adequate permission for the specified workspace

Sorry–I know this is a lot to check. But in my experience, the error usually lies in one of the above elements.

Separately, please consider sharing the messages that appear after executing the last command above. This could help with troubleshooting. (If you’re using the susoapi R package above, I’m the package author.)

Thank you very much for taking time to answer. I am not sure how to specify the workspace in set_credentials function(server, user and password are the only parameters to specify). Also to be clear enough am using the PDS that I was assigned-I don’t think that should be an issue…

For the credentials, there’s no argument for workspace. But other functions require the workspace argument (while providing a default value of workspace = "primary").

For example, to check your credentials for a particular workspace:

susoapi::check_credentials(
    workspace = "my_non_primary_workspace"
)

Similarly, to get the questionnaires for a target workspace:

susoapi::get_questionnaires(
    workspace = "my_non_primary_workspace"
)

Look for a vignette on working in/with workspaces soon. It’s on my backlog (here),and I’ve not found/made the time recently to tackle it.

Your reasonable questions might be just the motivation I needed!