AnsweredAssumed Answered

API - Edit functions in .net

Question asked by MICHAEL NORRIS on Jun 8, 2016
Latest reply on Jun 16, 2016 by Garth Egbert


When executing a PutAsync or PutAsJsonAsync, I am getting an OK response back but am not seeing the data being updated.

 

I am trying to update several quiz names from a "PRE_" to a "POST_" and make sure the results are always hidden.  I get a response of success but have yet to see any quiz names get updated.  Does anyone know why?

 

string newQuizName = quizName.Replace("PRE_", "POST_");

 

QuizUpdate q = new QuizUpdate();

q.title = newQuizName;

q.hide_results = "always";

 

string jsonData = JsonConvert.SerializeObject(q);

HttpContent content = new StringContent(

                        jsonData,

                        Encoding.UTF8,

                        "application/json");

 

string uri = Canvas.mainUri.ToString() + Canvas.httpAdd.ToString();

 

HttpResponseMessage response = await client.PutAsync(uri, content);

if (response.IsSuccessStatusCode)

{

     Console.WriteLine("Succes:" + newQuizName);

}

Outcomes