我编写了一个Windows Phone APP,它调用_https://www.yammer.com/api/v1/users.json API来检索所有用户。
问题是返回的JSON对象包含不同于英语的FULL_NAME。
有人遇到类似问题吗?
// Call this API to test if the auth token works
var messageApiEndpoint = new Uri(Constants.ApiEndpoints.allUsersUrl, UriKind.Absolute);
OAuthUtils.GetJsonFromApi(messageApiEndpoint, onSuccess: response =>
{
byte[] byteArray = System.Text.UTF8Encoding.UTF8.GetBytes(response);
MemoryStream res = new MemoryStream(byteArray);
List<YammerUser> users = SerializationUtils.DeserializeJson<List<YammerUser>>(res);
ListBoxAllUsers.DataContext = users;
ListBoxAllUsers.ItemsSource = users;
// we just dump the unformated json string response into a textbox
Dispatcher.BeginInvoke(() => txtResponses.Text = "Messages Retrieved");
},
onErrorResponse: errorResponse =>
{
Dispatcher.BeginInvoke(() =>
{
MessageBox.Show(errorResponse.OAuthError.ToString(), "Invalid operation", MessageBoxButton.OK);
txtResponses.Text = string.Empty;
});
},
onException: ex =>
{
Dispatcher.BeginInvoke(() =>
{
MessageBox.Show(ex.ToString(), "Unexpected exception!", MessageBoxButton.OK);
txtResponses.Text = string.Empty;
});
}
);
Dispatcher.BeginInvoke(() => txtResponses.Text = "Retrieving ...");