Wrapper functions for Survey Solutions API.
- dl_one: Downloads the data for the specified version for the specified questionnaire. How to use.
- dl_allVers: Downloads all versions of the specified questionnaire. How to use.
- dl_similar: Downloads the data for all questionnaire that matches a specified pattern. Can use regex patterns. How to use.
- get_qx: Gets information about all the questionnaires imported on the server. How to use.
- get_qx_id: Returns the template ID of the specified questionnaire.
- get_asgmts_list: Returns all the assignments on the server for a version of a questionnaire. How to use.
- archive_asgmts: Archive assignments.
These programs uses R to interact with the Survey Solutions API so you will need to install R and R Studio on your computer.
You will also need to make an API user account on your survey server. Learn how to make an API user account on the support page.
Download the the repository by clicking on the green Clone or download button on the right side under the respository name and selecting Download Zip. This will download all the code and read me files onto your computer in a zip file.
You can use the functions in one of three ways:
- Run the R file for the function in R Studio by opening it and pressing Ctrl+Shift+Enter. This will run all the code for the function in the file and now the function will be in the working environment for use in the working environment.
- In the menu, go to Code -> Source File... or use the Ctrl+Alt+G keyboard shortcut. Select the function you would like to use and now it will be available for use in the working environment.
- To load the function at the beginning of your code, use the source function.
If you are using the functions to download the same type of data from the same server, you should make a serverDetails.R file to save time. Fill in this template with details on your server and login for the API user.
It is possible to call R code in Stata using the rcall package. Installation information is available on the package's github.
This package allows R and Stata to interact and exchange data so it is possible to use these API functions in Stata with rcall. However, this will require writing a script in R to download the data from the API. Use it only after reading the documentation for rcall thoroughly.