I made REST API with Django Rest Framework. Currently, I'm working on a mobile app for my site. When I do POST request (it's my second POST request in my app) I'm getting this error:
E/Volley: [385] BasicNetwork.performRequest: Unexpected response code 500 for http://laude.ct8.pl/api/user/data/aktualizacja/
Here is my code:
private val UPDATE_URL = "http://laude.ct8.pl/api/user/data/aktualizacja/"
private var volleyRequest: RequestQueue? = null
private val jsonObj = JSONObject()
volleyRequest = Volley.newRequestQueue(this)
private fun aktualizacja() {
jsonObj.put("librus_user", usernameEdit.text)
jsonObj.put("librus_pswd", passwordEdit.text)
val req = JsonObjectRequest(Request.Method.POST, UPDATE_URL, jsonObj,
Response.Listener { response ->
Toast.makeText(this, response.toString(), Toast.LENGTH_LONG).show()
val user = Intent(this, UserActivity::class.java)
startActivity(user)
},
Response.ErrorListener { error ->
Toast.makeText(this, error.toString(), Toast.LENGTH_LONG).show()
})
req.retryPolicy = DefaultRetryPolicy(60000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)
volleyRequest!!.add(req)
}
When I use same data on my website I'm not getting any errors, I got it only on a mobile app. Thanks for help !