Android client consumes API returns bad request - android

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.

Related

HTTP 403 Forbidden with android kotlin and retrofit

I'm working on sending data to an API and getting data back from it which is easy enough but how do i add api-key and client-id to my app (I'm using retrofit)? I tested it with Postman and it's working with both of them.
This is fixed by simply adding #Headers("key:value") above the GET/POST api call.
link to more info

Jhipster Jwt Authentication for Mobile API

I have a jHipster project with Jwt Authentication but I can't get it to work outside de webapp. I'm currently developping a Android application and the authentication process get harder than I expected.
Basically I'm sending the parameters of the LoginDTO, to UserJwtController#authorize ('/api/authenticate'). At first I was getting Unauthorized, both on Android or Postman (I'm using it to test the requests).
If I change the '/api' to permitAll, I'm getting 405, Request method 'POST' not supported.
EDIT
It was a wrong typo on Android :/
It works fine for me against /api/authenticate, so either you use wrong URL (e.g. /api/authorize) or your JSON payload is wrong. The only issue you could have is with CORS. You should consider testing with curl as it is easier than PostMan for reporting here what you really do and also the curl options are already built for you in JHipster swagger page.

No Connection error in Volley and Socket Time out in HttpClient by Async Task

I have spend near about 3 days in this issue of No Time error of Volley,
I am calling 10 web APIs sequentially, at 4th web API I am getting No Connection error of volley, out of 12 there are specifically 4 web APIs which are giving me same error(tries asynchronous as well).
I tried same by Async Task using Http Client getting Socket Time out error for the same web APis.
Note : All these web APIs are working in IOS as well as postman properly.
Can any one please let me know that this is the android side issue or from server side, if its of android please tell me the solution , how can I get rid of it?
I have resolved this issue after doing lots of work around.
Issue was of SSL Certification, As volley doesn't support SSL so need to allow externally.
To allow SSL Refer : here Create a HttpsTrustManager class that implements X509TrustManager:

Consuming .net rest api via android - 400 error

I have created REST service according to this: http://www.asp.net/web-api/overview/older-versions/creating-a-web-api-that-supports-crud-operations
tutorial and a android client according to this: http://www.techrepublic.com/blog/software-engineer/calling-restful-services-from-your-android-app/
I changed the service to receive the json messages, and the connection string to the same that works in the browser, with 10.0.2.2 instead of localhost(according to one of the advices in stackoverflow) - in the browser it works perfectly. When I try to test it on the emulator I get the 400 bad request error. Maybe this is totally wrong way of approaching this, I am confused - would you kindly show me the error in the implementation or the tutorial that could help me with consuming the rest api with android client?

android - rest API timeout

I am developing an android application which calls http requests.
The rest API is on the same laptop (using wamp). I test the API over post man (Chrome plugin), and I get the right response after ~21s ...The strange thing is, I have received immediate answer when the api was on an other pc and other network.
I didn't change nothing on the wamp config (and I have the same version) or on the code of the rest api.
The api was written in Laravel by someone else, and worked fine on the previous laptop/server.
How could I solve this?
I just noticed that the CMS loads very slow too. I solved the issue by changing "localhost" to "127.0.0.1" in laravel/app/config/database.php

Categories

Resources