Kairos API - get JSON response - android

I would like to use Kairos' API for face recognition. It seems a pretty good system, but have no idea, how to catch examples. If I use a string, it is empty after the process. There isn't any example about this in API documentation, nor in its GitHub repo: https://github.com/kairosinc/Kairos-SDK-Android
I try to connect to http://api.kairos.com, but maybe there is a problem with authentication, or should use URL with some parameters added. I cannot found any information about this.

You might be missing the proper APP_ID and APP_KEY headers. Check out this answered solution using a Curl example.

Related

How can I connect to WMATA API?

I am working on a project using WMATA (DC Metro) API and I need to retrieve some data such as stations names, pathing of two stations...
I have an API Key but I don't know to do the networking part.
Should WMATA return an OAuthToken? How can I send a request?
No, you don't need OAuthToken or any Auth method, you just need to send your api_key at request header. There are a lot of example on wmata documentation. You can use Java examples as a reference for Kotlin.
Look at the Java section bottom of this page and find this line:
request.setHeader("api_key", "{subscription key}");
Change
{subscription key}
with your API Key

Tasker App: Why my HTTP POST is not sending parameters?

I'm making a simple HTTP POST request using Tasker app, it's working fine but somehow it's not sending my arguments. HTTP GET is working fine. What am I doing wrong?
The only thing the server does is JSON stringify all received parameters and return them like: Text: { parameters }
HTTP GET is working:
HTTP POST works, it returns the response "text: {}" but doesn't return any parameter:
Now sometimes it shows "Bad Request Error 400"
I've tested it with another server and this issue persists...
Here's a fiddle to send get and post requests to the same server and both work.
I've exported my task as xml for you to test: You can download it here
Thanks in advance guys!
I have done a little testing with what you have supplied. It appears that your post parameters are making it to the server but %HTTPR is not getting populated. The Tasker documentation says that this variable will be populated if the response is "text-based", but this does not seem to be the case. I may not know what Tasker considers to be "text-based", but I have tried "text/plain" and "text/html" with no luck.
The work-around that I have come up with is to put the response into a file using the "Output File" field of the post task. (Leave "Content Type" blank or this won't work.) You can then read the file into a variable and do what you need to.
This is either a defect in Tasker, incorrect documentation, or just a misunderstanding of what it takes to make it work. This work-around, however, will get you what you need.
Here is a link to a GitHub repository with the updated task export. You may need to change the output file name/location to work with your device.
Update:
Since I posted the above solution, I have run across a Tasker plugin called "RESTask for Tasker". Evidently, Tasker has enough issues with HTML requests that a separate plugin was needed. I have tested this plugin with POST and it does work, so this is another way to go. The plugin is available on the Google Play store.

android:--java.net.ProtocolException:Too many follow-up requests:21

I am trying to sync my app with the server (periodically,on-demand & when network outage happens),which uses the basic authentication for the syncing.Here i am facing this error.
Had done some research on this but found no solution.Have anyone come across this & have a solution???
PS:I am a novice developer in android.
I recommend double checking the method url that you are using.
For instance, can you run it using Postman or some other REST client and get a valid response?
This behavior happened in one of my project while I accidentally used a broken method URL but with a right host.
good luck:)

Android Rest client to Delphi XE2 Datasnap Rest server

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...

android robolectric : mocking HTTP Requests - cannot find class Http

This is probably a stupid question; however, I am out of options and would appreciate help. I am trying to mock file downloads using Robolectric. I am referring to the class HttpTest.java, and the Robolectric blog post.
My problem: Maven is unable to find the Http class referred to in the HttpTest.java code. I could manually bring it over as a class in the same package, but I ended up getting a NullPtrException in one of the methods of class Http.
I have searched on the net for a solution. I have also verified the modules configuration in the pom file. I do have com.pivotlabs present there.
Has anyone gotten this working? Please let me know what I am missing here.
I got this working.
Http is a class internal to Robolectric's sample code. It can be used outside; but you might not want to do that if your code is gonna be built non-locally.
The clarification/mention in documentation that would have gone long way in helping me is: "Robolectric will give you the response you create using addPendingHttpResponse() for your HTTP request, no matter how you do the request. Robolectric will NOT do an actual HTTP request." Once I understood this, rest was easy.
I used Apache's DefaultHttpClient for my request, and verified received response against the already created response.
Hope this helps; I'd be happy to clarify further.
Thanks for the help I received here.
[I had asked this question on Robolectric's google group as well.]

Categories

Resources