Android - mongodb RESTful integration -


i'm developing app needs export document (csv or txt) server. i'm not best practice in case? read quite lot restful web services, not sure if they'd work in case of files rather simple id related queries.

android app not need retrieve mongo, need send text server parses , stores in mongo. how should approach implementing that?

many thanks!

i've solved problem using spring framework on server side (https://spring.io/guides/gs/rest-service/) , following class on client (android):

public class restclient {  public restclient() { }  public void export(jsonarray data) {     requestparams params = new requestparams();     params.put("dataarray", data.tostring());     exporttowebservice(params); }  public void exporttowebservice(requestparams params){     asynchttpclient client = new asynchttpclient();     string url = "change url here";      client.get(url, params, new asynchttpresponsehandler() {          @override         public void onsuccess(string response) {             // validation + error handling goes here         }          @override         public void onfailure(int statuscode, throwable error,                               string content) {              // when http response code '404'             if (statuscode == 404) {                 log.d("ws response", "404 response");             }             // when http response code '500'             else if (statuscode == 500) {                 log.d("ws response", "500 response");             }             // when http response code other 404, 500             else {                 log.d("ws response", "statuscode: " + statuscode);                 log.d("ws response", "throwable error: " + error.tostring());                 log.d("ws response", "content: " + content);             }         }     }); } 

}


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -