0

I am trying to poll respondents that have changed answers or get new respondents but this code appears to pull in all of the data regardless. Have I got the wrong data key? The polling guide suggests adding start_modified_date but that doesn't work. Thanks in advance

var SurveyMonkeyAPI = require('surveymonkey').SurveyMonkeyAPI;

try { 
    var api = new SurveyMonkeyAPI(config.surveymonkey.key, config.surveymonkey.access_token, config.surveymonkey.params);
} catch (error) {
    console.log(error.message);
}

var data = {
    survey_id: surveyId,
    fields: ["date_created", "date_modified", "status"],
    start_modified_date: lastLoadedDate.toISOString().replace(/T/, ' ').replace(/\..+/, '')
};

console.log("FETCHING ", surveyId, data);
this.api.getRespondentList(data, this.bind(function (error, data) {
    if (error)
        console.log(error.message);
    else
        console.log(JSON.stringify(data)); // Do something with your data!
});
georgephillips
  • 3,540
  • 4
  • 23
  • 30
  • I would ensure that data variable is being sent as a JSON dictionary correctly. That is the correct way to use it, i.e. with start_modified_date. Looking at the logs on our end, all I can see being sent in the JSON body is a survey_id. What does your program say it is POSTing to the get_respondent_list endpoint? – Miles Cederman-Haysom Oct 31 '13 at 05:15
  • Hi thanks for your help. It appears that the node-surveymonkey library filters params it does not expect in [https://github.com/Datahero/node-surveymonkey/blob/master/lib/surveymonkey/SurveyMonkeyAPI_v2.js]. I will post a fixed forked version soon – georgephillips Oct 31 '13 at 10:26
  • You can also checkout the PHP implementation https://github.com/oori/php-surveymonkey, how it follows survey monkey API (incl. overcoming it's limitations, see getResponses chunks) – oori Nov 26 '13 at 02:24

1 Answers1

0

Here is the fork that has it fixed https://github.com/GeorgePhillips/node-surveymonkey

georgephillips
  • 3,540
  • 4
  • 23
  • 30