how to parse this web service using retrofit in android? -


http://www.superbinstruments.com/directory/index.php?r=webservice/profile/id/4096

here want pass id in url (like above) , jsonobject (can null) in body.

here concept when pass null json object retrieve profile data or if pass json object profile information update profile data.

i have tried below methods can retrieve data can not update data. update data we can pass same json response body.

@post("index.php") call<userprofile> profileuser(@query("r") string value, @body string user);  @post("index.php?") call<userprofile> saveuser(@query("r") string value, @body jsonobject user); 

i passing like: value= webservice/profile/id/4096

if pass json string profile updated info getting "invalid request password not needed."
or if pass jsonobject profile updated info getting java.lang.outofmemoryerror: outofmemoryerror thrown while trying throw outofmemoryerror; no stack trace available

the link have posted not required body post. remove body code. use @field have annotate method @formurlencoded

your method should this.

@formurlencoded @post("index.php?r=webservice/profile/id/") call<userprofile> saveuser(@field("value") string value); 

hope helps:)


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -