Exemplo n.º 1
0
        public CreateFlowForm()
        {
            InitializeComponent();

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

            cfrData = new CreateFlowRequest();

            cbxLanguage.DataSource = Enum.GetNames(typeof(LanguageEnum));

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

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

            return MakeApiRequest(url, serializedParameters);
        }
        /// <summary>
        /// Create a survey, email collector, and email message based on a template or existing survey. ###Notes * You cannot specify both template_id and from survey_id * Maximum number of recipients supported is 10000
        /// Endpoint : https://api.surveymonkey.net/v2/batch/create_flow?api_key=your_api_key
        /// Example Request
        ///     curl -H 'Authorization:bearer XXXYYYZZZ' -H 'Content-Type: application/json' https://api.surveymonkey.net/v2/batch/create_flow?api_key=your_api_key --data-binary 
        /// </summary>
        public CreateFlowResponse CreateFlow(CreateFlowRequest requestData)
        {
            CreateFlowResponse flowResponse;
            
            JsonResponse = MakeApiRequest(CREATE_FLOW, requestData);
            flowResponse = JsonConvert.DeserializeObject<CreateFlowResponse>(JsonResponse);

            return flowResponse;
        }