I am working on a project on android and I want to implement the functionality of my application on an API written in Node JS and use it with HTTP requests.
I am searching for an (open source) HTTP API (CRUD System) that I can use in my android application in order to make HTTP requests to my API (GET, POST, PUT, DELETE).
What are you suggesting me? Which are the best solutions?
Thank you
I recommend OSS "Fuel".
https://github.com/kittinunf/Fuel
I created a sample application of API request using Fuel.
https://github.com/y-okudera/FuelSampleApp
I hope this will be of some help.
Related
I'm working on a multilayer Android app where I have to intercept HTTP requests, modify one of the headers, execute and return responses. I can't change a way of creating requests, but I can change the API base URL used for requests. The approach I chose was writing a proxy listening on a specific port and doing a man-in-the-middle job:
taking requests,
applying required changes to HTTP requests,
executing it and
returning response.
I applied SparkJava as an HTTP server and OkHttpClient as an HTTP client. It worked like a charm until I found it works only on Android 8 and newer. There is a problem with missing ThreadLocal<S> ThreadLocal.withInitial (Supplier<? extends S> supplier) in API prior to 26 that SparkJava's backend - Jetty, uses).
I guess I will try to look for other HTTP server framework working fine in older API and reimplement my proxy.
In the meantime, does this approach seem to be ok? Or maybe there is another way of proxying HTTP requests in Android app that would allow modifying headers having only an option of changing base API URL?
All ideas much appreciated.
PS. I know that in a typical app this kind of proxying would make a security issue, but this is not a concern in this case.
I am currently learning django and android. I created a REST API for my backend. The endpoints are working since I can GET/POST with Postman, Insomnia, and httpie. However, if I try it with my android app it gives the response 'Bad Request'. I've been working on it for many hours now. Could someone explain to me why is this happening?
![1]: http://imgur.com/a/NF1oY
![2]: http://imgur.com/a/UG06U
Solved. I was using a lightweight server by django to run my api. Found out about gunicorn.
Is it possible to use Android Account Manager using Cookie-based authentication? How (a code with a explanation would be much appreciated)?
I have seen many examples regarding authentication token, but that is not the case. I have just implemented cookie-based authentication on Python FLASK.
OBS.: I'm using Android Volley for the requests of the application.
All you need to do is to add this line in onCreate in your Application class:
CookieHandler.setDefault(new CookieManager());
this line will make your HttpUrlConnection hold cookies like browser, and since most of the http agents like Volley or okHttp are based on HttpUrlConnection they also will hold your cookies )
I found many examples on Stack Overflow and I just don't know where to start since I have a particular prerequisite:
My Delphi Datasnap Rest server is using ZLibCompression and RSA encryption (in TTransportFilterCollection of DSHTTPWebDispatcher). Is there an Android restful API that can handle those? Any sample that already implements that?
I found this thread Android REST client, Sample? as a good starting point, both lightweight and well-formed clients are presented but is it enough for me?
Thanks in advance for any hint, sample or library that you could point me to.
you can use the Android Rest-Client for sending data to a webservice
see my answer in the post Adding body of call to POST using HttpURLConnection
I just used the proxy generator from Danasnap server TDSProxyGenerator component (http://yourserver:port/proxy/java_android.zip) and added this code to my android project...
I had to search for the DSRESTSSLFactory.java file that is not generated by the proxy (but required !!), i found it in a demo from embarcadero, and from that point the communication is entirely handled, all accessible procedures are publicated, and really really simple to use...
So I am trying to sync to google docs, without having to ask the user for his credentials. I use this code to get an auth-token:
AccountManager mgr = AccountManager.get(activity);
authToken = mgr.blockingGetAuthToken(account, DocsService.DOCS_SERVICE, true);
This returns a auth-token that looks well-formated. So on my DocsService I run:
service.setAuthSubToken(authToken);
However, when I try to use the API I just get a AuthenticationException. Any ideas on how to approach this error?
edit: I do have the USE_CREDENTIALS permission.
The problem is that the returned token is a ClientLogin token, not an AuthSub token. An even bigger problem is that the GData Java Client library does not officially support Android. We recently added a note on the home page of the GData Java Client library that for Android we recommend Google API Client Library for Java instead.
Two samples come up mind that would be helpful for you for getting started with Google API Client Library for Java: calendar-v2-atom-android-sample and docs-v3-atom-oauth-sample
Disclosure: I am an owner of both the GData Java Client library and Google API Client Library for Java projects.
You might also want to take a look at Yaniv's Google I/O 2011 Session slides/video for reference on how to access the GData APIs on Android.
http://www.google.com/events/io/2011/sessions/best-practices-for-accessing-google-apis-on-android.html
As Yaniv explained, Gdata Lib doesn't work in Android. I wasted several hour with no result. It looks pretty weird, its Google's product and still not supported in their own platform (Android).
Anyway I have developed a Client Library which works on Android. I am managing the project on Google Code-
http://code.google.com/p/google-spreadsheet-lib-android/
You can give a try.