0

i am trying to get a user data from api but it always shows me an error that refit exception cant deserialize

this is the json

[
  {
    "_id": "6342110f32eca716e8c79165",
    "name": "Ak",
    "password": "a",
    "gmail": "a@gmail.com",
    "__v": "0"
  }
]

interface

namespace Glow.Interface
{
    public interface IAuthAPI
    {
        [Post("/subscribers/login")]
        Task<string> SignIn([Body] Dictionary<string, string> data);

        [Post("/subscribers")]
        Task<string> Register([Body] Dictionary<string, string> data);
        [Get("/subscribers/{gmail}")]
        Task<User> GetData2([AliasAs("gmail")] string gmail);
    }
}

user model

namespace Glow.Model
{
    public class User
    {
        public string _id { get; set; }
        public string name { get; set; }
        public string password { get; set; }
        public string gmail { get; set; }
        public string __v { get; set; }
    }
}

usage:

var todoItem = await todoServer.GetData2(gmail);

0 Answers0