static void Mymain(string[] args) { //RootObject json_forms = getForms().Result; typeFormApi.getForms(); FormTypeForm.RootObject json_form = typeFormApi.getForm(typeFormApi.id_form); //List<string> d= getEntreprisesRep(); // typeFormApi.json_answers = typeFormApi.getAnswers(typeFormApi.id_form); //AnswerTypeForm.RootObject json_answers = typeFormApi.getAnswers(typeFormApi.id_form); /*foreach (string f in getEntreprisesRep("5f1ccad09db138f184034ce06ba87f74", "vT94Udur6LMJ")) * { * Console.WriteLine(f); * }*/ //Console.WriteLine(getNomEntreprise("5f1ccad09db138f184034ce06ba87f74")); InfoEntreprise info = typeFormApi.getInfos("5f1ccad09db138f184034ce06ba87f74"); Console.WriteLine(info.getNom()); // getNomEntreprises(id_question_nom_entreprise); //getEntreprisesRep(); //getInfoEntreprise("5f1ccad09db138f184034ce06ba87f74", "KA17sOqFVIRs"); //getQuestions(); // getInfos("5f1ccad09db138f184034ce06ba87f74"); //getQuestions(); //getNomEntreprise("KA17sOqFVIRs", "5f1ccad09db138f184034ce06ba87f74"); Console.ReadKey(); }
public async Task <FormTypeForm.RootObject> getForm(string id_form) { string url = "https://api.typeform.com/forms/" + id_form; string outputJson = await getJson(url, token); FormTypeForm.RootObject res = JsonConvert.DeserializeObject <FormTypeForm.RootObject>(outputJson); return(res); }
/* * retourne un formulaire */ public static FormTypeForm.RootObject getForm(string id_form) { string url = "https://api.typeform.com/forms/" + id_form; string outputJson = getJson(url).Result; FormTypeForm.RootObject res = JsonConvert.DeserializeObject <FormTypeForm.RootObject>(outputJson); return(res); }
/*Retourne toute les sous-questions*/ public static void getQuestions() { FormTypeForm.RootObject json_form = getForm(id_form); foreach (FormTypeForm.Field field in json_form.fields) { if (field.properties != null && field.properties.fields != null) { foreach (FormTypeForm.Field sous_question in field.properties.fields) { Console.WriteLine("Question: " + sous_question.title + " : " + sous_question.id); } } } }
/* * retourne les formulaires au format json */ public static FormTypeForm.RootObject getForms() { string url = "https://api.typeform.com/forms"; using (var client = new HttpClient()) { client.DefaultRequestHeaders.TryAddWithoutValidation("authorization", "bearer " + token); string outputJson = getJson(url).Result; FormTypeForm.RootObject res = JsonConvert.DeserializeObject <FormTypeForm.RootObject>(outputJson); return(res); } }