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_number
Integerinitials
String (or null)email
String, email of the user logging this questionlocation
String, name of the location facetduration
String, name of the duration facetformat
String, name of the format facetasked_by
String, name of the asked_by (Questioner) facetquestion_type
String, name of the question_type facetdifficulty
String, name of the difficulty facet valueasked_at
Date and time in the "Asked at" fieldquestion_date
Date portion ofasked_at
question_time
Time portion ofasked_at
question_half_hour
Question time, rounded to nearest half-hourquestion_weekday
String, weekday of questionadded_at
Date and time the question was added to the databasetags
String. Space-separated list of tagssite
String. Branch nameaccount
String. Account namequestion
String. Question textanswer
String. 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_id
question[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:
id
Integer, indicating the id of this branch/site.name
String.status
String, will be 'active', 'archive_pending', or 'archived'question_count
Integer, indicates the current number of questions for this branch/site.use_initials
Boolean, true if initials are stored with questionsuse_difficulty
Boolean, true if difficulty is enableduse_qa
Boolean, true if question/answer text are stored with questionsuse_tagging
Boolean, 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:
id
Integer, indicating the ID of this facettype
String. One of 'Duration', 'Format', 'Location', 'Questioner', 'QuestionType', 'Difficulty'name
String.
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:
id
Integer, indicating the ID of this useremail
String.current_sign_in_at
Timestamp, updated when the user signs inlast_sign_in_at
Timestamp, of the previous sign insites
Array. 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>