Gimlet has a simple REST API for importing and exporting question data, along with some of the other information you might need to do those things.
If this guide isn't enough for you, please file an issue or contact support@gimlet.us and we'll give you a hand.
To get an API key, have an administrator head to:
Account -> Branches -> Users -> (Choose an Email)
and click the "Generate API Key" button.
The API key grants a user access to add and query questions for sites they are a member of.
The API is accessible at:
https://<yourdomain>.gimlet.us/api/v1/
Use HTTP Basic authentication; username is your Gimlet email, and password is your API key.
GET https://<yourdomain>.gimlet.us/api/v1/sites/<site_id>/questions?start_date=YYYY-MM-DD&end_date=YYYY-MM-DD
All times and dates are in your account's local time zone. Start and end dates are inclusive.
Returns a JSON object with one attribute: questions which is an array of questions occurring between start_date and end_date. The array contains:
question_numberIntegerinitialsString (or null)emailString, email of the user logging this questionlocationString, name of the location facetdurationString, name of the duration facetformatString, name of the format facetasked_byString, name of the asked_by (Questioner) facetquestion_typeString, name of the question_type facetdifficultyString, name of the difficulty facet valueasked_atDate and time in the "Asked at" fieldquestion_dateDate portion ofasked_atquestion_timeTime portion ofasked_atquestion_half_hourQuestion time, rounded to nearest half-hourquestion_weekdayString, weekday of questionadded_atDate and time the question was added to the databasetagsString. Space-separated list of tagssiteString. Branch nameaccountString. Account namequestionString. Question textanswerString. Answer text
You can also get the data in CSV format. You can do this either by setting the request header Accept: text/csv or by changing /questions to /questions.csv in your URL.
Note that there is no pagination on these requests. If you request a date range with a million questions, we'll stream them all to you. Be ready.
POST https://<yourdomain>.gimlet.us/api/v1/sites/<site_id>/questions
To make things a bit easier, you can either refer to facets by their ID (eg, location_id) or name (eg, location_name). If you include both in your request, the behavior is undefined — one of them will win but you won't know which one.
The following parameters are required:
site_idquestion[location_name]orquestion[location_id]question[duration_name]orquestion[duration_id]question[format_name]orquestion[format_id]question[question_type_name]orquestion[question_type_id]question[questioner_name]orquestion[questioner_id]
The following parameters are optional:
question[difficulty_name]orquestion[difficulty_id]question[tag_list]question[initials]question[question]question[answer]question[asked_at_time](24-hour, local time)question[asked_at_date](mm/dd/yyyy)
GET https://<yourdomain>.gimlet.us/api/v1/sites
Returns a JSON object with one attribute: branches which is an array of objects containing the following attributes:
idInteger, indicating the id of this branch/site.nameString.statusString, will be 'active', 'archive_pending', or 'archived'question_countInteger, indicates the current number of questions for this branch/site.use_initialsBoolean, true if initials are stored with questionsuse_difficultyBoolean, true if difficulty is enableduse_qaBoolean, true if question/answer text are stored with questionsuse_taggingBoolean, true if tags are stored with questions
GET https://<yourdomain>.gimlet.us/api/v1/sites/<site_id>/facets
Returns a JSON object with one attribute: facets which is an array of objects containing the following attributes:
idInteger, indicating the ID of this facettypeString. One of 'Duration', 'Format', 'Location', 'Questioner', 'QuestionType', 'Difficulty'nameString.
GET https://<yourdomain>.gimlet.us/api/v1/users
Returns a JSON object with one attribute: users which is an array of objects containing the following attributes:
idInteger, indicating the ID of this useremailString.current_sign_in_atTimestamp, updated when the user signs inlast_sign_in_atTimestamp, of the previous sign insitesArray. A collection of objects containing site id integers
POST https://<yourdomain>.gimlet.us/api/v1/users
The following parameters are required:
user[email]user[site_ids]
PUT https://<yourdomain>.gimlet.us/api/v1/users/<user_id>
The following parameters are required:
user[email]user[site_ids]
DELETE https://<yourdomain>.gimlet.us/api/v1/users/<user_id>