0

While posting to the surveymonkey api im expecting a JSON payload but whenever I send it i get a status "3" which on their documentation is an Invalid Request I'm unsure what im supposed to be giving to the api to get the data i need back. Am i missing something that is needed to get this list of surveys back?

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://api.surveymonkey.net/v2/surveys/get_survey_list?api_key=apikey");
            request.Headers.Add("Authorization", "bearer " + responseToken);
            request.ContentType = "application/json";
            request.Method = "POST";
            request.Accept = "*/*";
            request.UserAgent = "WindowsFormApplication3";
            Console.WriteLine(request.UserAgent);
            string listString = "";
            byte[] listData = encoding.GetBytes(listString);
            using (HttpWebResponse listResponse = (HttpWebResponse)request.GetResponse())
            {
                Console.WriteLine("listResponse = " + listResponse);
                bool b = listResponse.GetResponseStream().CanRead;
                using (StreamReader reader = new StreamReader(listResponse.GetResponseStream()))
                {
                    Console.WriteLine(reader.ReadToEnd());
                }
            }
        }
        catch (Exception aProblem)
        {
            System.Diagnostics.Debug.WriteLine(aProblem);
        }
    }

EDIT: If it helps when i use get_user_details instead of get_survey_list i get a valid response which gives the correct information

  • At the end of the API URL it wants you to enter in your API key, have you filled that in? If not, you'll need to get one from SurveyMonkey and append it to the end of your URL. – JaTochNietDan Dec 30 '13 at 16:15
  • i have i just took it out for the sake of formatting in this question. I have it appended in the code I'm working on. – Arachnid Hivemind Dec 30 '13 at 16:16

0 Answers0