8

For a given survey, how do you determine its survey_id for use with the SurveyMonkey API?

A list of all IDs is returned by the API method get_survey_list, and you could subsequently call get_survey_details on each survey to determine which one is the intended one, but that seems needlessly complicated. There has to be a way to get a survey's ID from the My Surveys page, right?

Edit:

Whoops, get_survey_details isn't actually necessary, since get_survey_list can take a fields parameter that includes the survey's title.

Phantom Watson
  • 2,568
  • 2
  • 22
  • 36
  • 1
    This isn't needlessly complicated for the usual use case of the API - it's all meant to work programatically. There are some roundabout ways to get your survey id via the SurveyMonkey website, but using the API is much easier. If there is a particular survey you are looking for, I recommend using the 'title' parameter in get_survey_list to filter things down - other filters may be helpful in narrowing it down too. Check out the docs here: https://developer.surveymonkey.com/mashery/get_survey_list – Miles Cederman-Haysom May 12 '14 at 22:23
  • My specific use case is a project website that needs to periodically import new responses to the project's surveys. We expect to eventually have a hundred or more unique surveys, each of which will have a database record manually added by the staffers who are creating them. Ideally, those staffers would have an easy way to look up a survey's ID and copy and paste it into the database record. – Phantom Watson May 12 '14 at 23:24
  • I could rig up an AJAX call that finds and lists all survey titles, then allow the user to set the survey's ID by selecting the correct title from the list, but that will get cumbersome once there are hundreds of surveys to choose from and altogether feels like a really roundabout way to solve the problem. Not criticizing the SurveyMonkey API, just trying to find the most elegant solution. – Phantom Watson May 12 '14 at 23:29
  • 1
    Aha, I see. I just had a quick look then and there is not an easy way for the user to get the survey_id - any current ways are not guaranteed to work in future and are not easy to use either. Sorry about that! – Miles Cederman-Haysom May 12 '14 at 23:43
  • Disappointing as that may be, just having that confirmed helps me out a ton. Now I know that my awkward solution is the best we can manage at the moment. Thanks! – Phantom Watson May 12 '14 at 23:49
  • 1
    @PhantomWatson you might want to consider limiting the survey creation date when presenting a list to staffers. You would do that by passing a start_date to get_survey_details. I would suggest sending the date yesterday so staffers will only see the surveys created in the last couple of days and then giving them a "view all" option so they can also see an exhaustive list if needed. You'll also probably want to set order_asc to False so that the newest surveys are displayed first. – Tony Mayse May 13 '14 at 16:23
  • Not a bad idea. Thanks! – Phantom Watson May 13 '14 at 16:28

2 Answers2

10

If you want to get the survey ID via the web page you can:

  • Right click on the survey in the "ALL SURVEYS" surveys view, and press "Inspect Element" or "Inspect" depending on your browser.

  • In the bottom of the browser, you will see a highlighted block that starts with: <a href="/summary/...

  • Scroll up a few lines until you see a line that starts with: <tr class="survey-row" id=`

  • The number that follows id= is the survey id, which you can then use in the API.
Mike Godin
  • 2,890
  • 2
  • 23
  • 26
0

Nothing much to add to what Tony & Miles said, just that my UI form contains these fields:

1) An Age limit - eg the past 365 days

2) A keyword in the title - typically all the surveys for one client have that client's name in the title. Hint: if you can be organised enough to enforce a convention, and put keywords in the nickname, the nickname is what the API looks in for Title, although what the user sees is the other title.

3) A start date to get responses only after a start date - the first day may have been only a test.

4) A combobox with all the matching surveys is presented showing the title, number of respondents, date created and date recently modified, pretty much the same as what appears in the SurveyMonkey web UI. That's where they pick the one they want.

HTH

Patrick

sysmod
  • 431
  • 3
  • 11