Hello! I'm trying to organize the registration of a user from the android application on the server through the ASP.NET API. Form data is sent via POST. JAVA code:
@POST("/app/accounts/register") Observable<Integer> userRegistration(@Body UserAPI body); UserAPI class:
public class UserAPI { @SerializedName("id") @Expose private int id; @SerializedName("sid") @Expose private int sid; @SerializedName("full_name") @Expose private String full_name; @SerializedName("iin") @Expose private String iin; ...} The implementation of the userRegistration function:
@Override public Observable<Integer> userRegistration(UserAPI body) { return apiInterface.userRegistration(body) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()); } In the service controller (ASP.NET, C #):
// /app/accounts/register [HttpPost] [ActionName("Register")] public int Register(User user) { return mModel.registerUser(user); } User class in service:
public class User { public int id { get; set; } public int sid { get; set; } public string full_name { get; set; } public string iin { get; set; } } When sending from the application, android errors do not occur, however, the service does not react either, and in response a 404 error comes. What's my mistake.
%20and, as a result, you simply ignore it and you get an invalid query. - Yuriy SPb ♦public int Register(User user)method on the server? also check out the routs for this action - Grundy