0 Replies Latest reply on May 16, 2017 1:48 PM by petery

    .NET 4.5 Pokeshot deserialized Person "Internal Server Error" on PUT

    petery

      Using Pokeshot's project's DownloadProfiles as a starting point, I got the GET working for the Person using a non-federated ID.

       

      But for PUT it would not work.

       

                      Person myPerson = JsonConvert.DeserializeObject<Person>(cleanResponse);

                      string JsonPerson = JsonConvert.SerializeObject(myPerson);

       

                      var httpContent = new StringContent(JsonPerson, Encoding.UTF8, "application/json");

                      System.Net.Http.HttpResponseMessage putResponse = await httpClient.PutAsync(String.Format(apiUrl), httpContent);

                      string myPutResponse = await putResponse.Content.ReadAsStringAsync();

                      var status = putResponse.StatusCode;

       

      Switched to use Json .NET.

      The date format through Json .Net is below which is not ISO 8601.

      "initialLogin": "2015-09-04T14:20:59.65-04:00"

       

      Removing these read-only fields helped.

                  rss.Remove("resources");

                  rss.Remove("updated");

                  rss.Remove("directReportCount");

                  rss.Remove("displayName");

                  rss.Remove("followerCount");

                  rss.Remove("followingCount");

                  rss.Remove("id");

                  rss.Remove("mentionName");

                  rss.Remove("photos");

                  rss.Remove("published");

                  rss.Remove("thumbnailId");

                  rss.Remove("thumbnailUrl");

                  rss.Remove("type");

                  rss.Remove("lastProfileUpdate");

                  rss.Remove("lastAuthenticated");

                  rss.Remove("initialLogin");   

                  rss.Remove("tags");

       

                  JObject rssName = (JObject)rss["name"];

                  rssName.Property("formatted")?.Remove();

       

                  JObject rssJive = (JObject)rss["jive"];

                  rssJive.Property("enabled")?.Remove();

                  rssJive.Property("external")?.Remove();

                  rssJive.Property("externalIdentities")?.Remove();

                  rssJive.Property("lastProfileUpdate")?.Remove();

                  rssJive.Property("lastAuthenticated")?.Remove();

                  rssJive.Property("locale")?.Remove();

                  rssJive.Property("externalContributor")?.Remove();

                  rssJive.Property("sendable")?.Remove();

                  rssJive.Property("visible")?.Remove();