android - Retrofit post request returns 405 error -


i'm new @ using retrofit library. need write method register user.

api shown below:

post http://blablabla.com/user/ contains 4 fields

  1. fio - string
  2. email - string
  3. phone - string
  4. password - string

response example:

{     "result": {         "code": 200,         "token": "fcac1a3b62cb51374123de565dc12e16"     } } 

it client class:

package com.example.bydlokoder.mobigeartest.activities.utils;  import retrofit.callback; import retrofit.http.body; import retrofit.http.post;  public class blablaclient {     public static final string api_url = "http://blablabla.com/";      public interface service {         @post("/user")         void createuser(@body user user, callback<result> callback);     } } 

it result class object wanna after registration completed:

public class result {     int code;     string token;      public string gettoken() {         return token;     }      public int getcode() {         return code;     } } 

it user class should used create request:

public class user {      public user(string fio, string email, string phone, string password) {         this.fio = fio;         this.email = email;         this.phone = phone;         this.password = password;     }      private string fio;     private string email;     private string phone;     private string password;      public string getfio() {         return fio;     }      public string getemail() {         return email;     }      public string getphone() {         return phone;     }      public string getpassword() {         return password;     } } 

it server side error. thanks.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -