設定したDjango APIに接続できません。私は外部ソース(例えばrequestmaker.com)を介してPOST jsonすることができ、apiはそれがするべきことをします。しかし、ボレーを使用して、私は500エラーコードを取得し続けます。私はどこかにボレーのセットアップで間違っていた場合、APIは、問題ではないようですので、私は思っていたAndroid Studio 500コードfrom Volley POST
マイコード:
public void onClick(View v){
if(titleEdit.getText().toString().trim().length() != 0 && descriptionEdit.getText().toString().trim().length() != 0) {
String issueTitle = titleEdit.getText().toString();
String issueDesc = descriptionEdit.getText().toString();
issueQueue = Volley.newRequestQueue(this);
JSONObject jsObj = new JSONObject();
try {
jsObj.put("title", issueTitle);
jsObj.put("description", issueDesc);
} catch (JSONException e) {
e.printStackTrace();
}
JsonObjectRequest jsObjRequest = new JsonObjectRequest
(Request.Method.POST, "http://hurst.pythonanywhere.com/supportal/api", jsObj, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
System.out.println(response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
error.printStackTrace();
}
});
// add the request object to the queue to be executed
issueQueue.add(jsObjRequest);
}
それは私がこれにヘッダを含める必要があることは可能ですか?あるいは、ボレーよりも良い選択肢かもしれない。私は本当に何が間違っているのかは分からないので、どんな助けでも大歓迎です。
あなたの入力ストリームを比較することができます。ソースから来て、何が間違っているのかを確認してください。 –