Closed BrettButcher closed 4 years ago
Since you're querying for "me" I'd expect just a single object to be returned, not a list of users (which seems to be the case looking at your JSON response). So you can try serializing directly into a User object, not a IEnumerable:
var fulluser = await client.CustomRequest.Get<User>("wp/v2/users/me?context=edit",false,true);
Thasnk you @ThomasPe. Just got to your comment as I was doing just that ... I was thrown by the example in the Wiki where it uses an IEnumerable for ContactFormItem(s).. Cheers.
Hi, I am not sure if I am just needing help here or have found an issue. I am trying to get more details about the user. The client.Users.GetCurrentUser method uses /me?embed and returns the basic info. I want to get the users Roles in the WP site and you can do this with /me?context=edit (for example).
I have the following code lines, the first works fine but I get an error with the second:
var user = await client.Users.GetCurrentUser();
var fulluser = await client.CustomRequest.Get<IEnumerable<User>>("wp/v2/users/me?context=edit",false,true);
The call is executed fine but the result is failing at the json parser I think with whis error message:
I have monitored both reponses with Fiddler and done a JSON Compare - The one on the left is the one returned from the 'context=edit' call.
The wiki said that the CustomRequest needs its own model. But I would have thought that the User model seems fine. As far as I can see, the JSON looks fine in both ? Am I missing something or is there an issue.