Пример #1
0
        /// <summary>
        /// Takes a list of respondent ids and returns the responses that correlate to them.To be used with 'get_survey_details'
        /// Notes
        ///     Surveys with over 500,000 reponses are not available via the API currently
        ///     Text responses returned are truncated after 32,768 characters
        ///     Max number of respondents per call is 100
        /// Endpoint : https://api.surveymonkey.net/v2/surveys/get_responses?api_key=your_api_key
        /// Example Request
        /// curl -H 'Authorization:bearer XXXYYYZZZ' -H 'Content-Type: application/json' https://api.surveymonkey.net/v2/surveys/get_responses/?api_key=your_api_key --data-binary '{"survey_id":"103994756", "respondent_ids": ["2503019027", "2500039028", "2500039029", "2503019064"]}'
        /// </summary>
        private void BtnGetResponses_Click(object sender, EventArgs e)
        {
            GetSurveyDetailsResponse  surveyDetails;
            GetResponsesResponse      responses;
            GetRespondentListResponse respondent;

            BasicRequestData   brd          = GetRequestFields();
            SurveyQuestionView surveyView   = new SurveyQuestionView();
            ResponseView       responseView = new ResponseView();

            if (brd.SurveyID == null)
            {
                MessageBox.Show("no survey id specified.  Going to get error back.");
            }

            try
            {
                if ((brd.RespondentIDList == null) && (brd.RespondentIDList.Length == 0))
                {
                    MessageBox.Show("no respondants specified.  May be error, or empty return.");
                }

                surveyDetails = SurveyRequest.GetSurveyDetails(brd);
                respondent    = SurveyRequest.GetRespondentListFull(brd);
                responses     = SurveyRequest.GetResponses(brd);
                surveyView.LoadSurvey(surveyDetails);

                responseView.Flatten(responses.ResponseResultList, respondent.RespondantListResult.RespondantList, surveyView);

                //List<ResponseWithAnswer> ResponseAnswerList { get; set; }


                lblStatus.Text   = respondent.Status.ToString();
                lblErrorMsg.Text = respondent.ErrorMessage;

                try
                {
                    dgvSurveyList.DataSource = responseView.ResponseAnswerList; //respondent.ResponseResultList;
                }
                catch { } // do nothing
            }
            catch
            {
                MessageBox.Show("ERROR with respondants specified.  No data submitted to SurveyMonkey");
            }
        }