Пример #1
0
        public SendFlowForm()
        {
            InitializeComponent();

            btnDone.Click += BtnDone_Click;
            this.FormClosing += CreateFlowForm_FormClosing;

            sfrData = new SendFlowRequest();

            List<RecipientInfo> rfi = new List<RecipientInfo>();
            BindingSource bs = new BindingSource();
            bs.DataSource = rfi;
            dgvRecipients.DataSource = bs;

        }
        /// <summary>
        /// Specific for when sending request data for sending out an existing survey to a list of recipients
        /// </summary>
        private string MakeApiRequest(string endPoint, SendFlowRequest data)
        {
            string url = BaseURL + endPoint;
            var serializedParameters = JsonConvert.SerializeObject(data);

            return MakeApiRequest(url, serializedParameters);
        }
        /// <summary>
        /// Create an email collector and email message attaching them to an existing survey.
        /// Notes
        ///     •Maximum number of recipients supported is 1000
        ///     •Basic users will have requests fail if they have more than 3 collectors, 
        ///      response will have the upgrade_info dictionary
        /// Endpoint : https://api.surveymonkey.net/v2/batch/send_flow?api_key=your_api_key
        /// Example Request
        ///     curl -H 'Authorization:bearer XXXYYYZZZ' -H 'Content-Type: application/json' https://api.surveymonkey.net/v2/batch/send_flow?api_key=your_api_key --data-binary '{"survey_id": "100487745", "collector": {"type": "email", "name" : "email invite", "recipients": [{"email": "*****@*****.**", "first_name": "Stannis", "last_name": "Baratheon", "custom_id": "94301"}, {"email": "*****@*****.**", "first_name": "Joffrey", "last_name": "Baratheon", "custom_id": "94401"}, {"email": "renly@surveymonkey"}]}, "email_message" : { "subject" : "Ice and Fire event" , "reply_email" : "*****@*****.**", "body_text" : "We are conducting a survey, and your response would be appreciated. Here is a link to the survey: [SurveyLink] This link is uniquely tied to this survey and your email address. Please do not forward this message. Thanks for your participation! Please note: If you do not wish to receive further emails from us, please click the link below, and you will be automatically removed from our mailing list. [RemoveLink]"}}'
        /// </summary>
        public SendFlowResponse SendFlow(SendFlowRequest requestData)
        {
            SendFlowResponse flowResponse;

            JsonResponse = MakeApiRequest(SEND_FLOW, requestData);
            flowResponse = JsonConvert.DeserializeObject<SendFlowResponse>(JsonResponse);

            return flowResponse;
        }