Skip to main content Link Menu Expand (external link) Document Search Copy Copied


Suave API

In the following requests, may be,, or

A. http get requests

Request Format Example Note
Getting a previously saved snapshot: http:///snapshot/ Returns web page
Public view of a personal survey gallery http:///gallery/ Returns web page
Open SuAVE application http:///main/file=&views=&view= In this case, “1110101” indicates that: “grid” view will be shown; “bucket” view will be shown; “crosstab” view will be shown; “qca” view will not be shown; “map” view will be shown; “R” view will not be shown; “Jupyter” view will be shown. Opens SuAVE app for a specified dataset and views. SuAVE v2 has additional URL parameters described in the “Crowdsourcing” section.
Download survey data file http:///getSurveys/  
Administration interface, showing a list of user surveys http:///home  
Administration interface, showing a list of annotations over user surveys http:///comments  

B. Publishing SuAVE surveys in Python

In the code fragment below, consider the POST request which takes the following parameters:

r =, files=csv, data=upload_data, headers=headers)

Input Description Example Notes
upload_url SuAVE server URL to publish the survey to, plus “uploadCSV” upload_url = ‘’  
files pointer to a data file for the new survey new_file = ‘../../temp_csvs/zaslavsk_datafile_v1.csv’ csv = {“file”: open(new_file, “rb”)} files=csv the data file should be materialized in the ‘temp_csvs’ directory, eg from a Pandas dataframe as df.to_csv(new_file, index=None)
data additional survey attributes to post, including user name, dzc filem and survey name survey_name=’New Survey’ dzc_file=’’ user=’zaslavsk’ data = { ‘name’: survey_name, ‘dzc’: dzc_file, ‘user’:user } user must be logged in SuAVE for successful POST
headers request headers, including referer and user agent. Referer is the root server URL referer = ‘’ headers = { ‘User-Agent’: ‘suave user agent’, ‘referer’: referer }  

See code examples in SuAVE notebooks, and below:

referer = survey_url.split("/main")[0] +"/"
upload_url = referer + "uploadCSV"
new_survey_url_base = survey_url.split(user)[0]

import requests
import re
csv = {"file": open(new_file, "rb")}
upload_data = {
'name': input_text.value,
'dzc': dzc_file,
headers = {
'User-Agent': 'suave user agent',
'referer': referer

r =, files=csv, data=upload_data, headers=headers)

if r.status_code == 200:
printmd("<b><span style='color:red'>New survey created successfully</span></b>")
regex = re.compile('[^0-9a-zA-Z_]')
s_url = survey_name
s_url = regex.sub('_', s_url)

url = new_survey_url_base + user + "_" + s_url + ".csv" + "&views=" + views + "&view=" + view
printmd("<b><span style='color:red'>Click the URL to open the new survey</span></b>")
printmd("<b><span style='color:red'>Error creating new survey. Check if a survey with this name already exists.</span></b>")
printmd("<b><span style='color:red'>Reason: </span></b>"+ str(r.status_code) + " " + r.reason)