我正在嘗試通過(guò) Android 上的 Volley 庫(kù)發(fā)出 HTTP POST 請(qǐng)求。實(shí)際上,我想檢索 API 返回給我的 JSON 對(duì)象。API 文檔給了我這個(gè)有效的 curl 請(qǐng)求:curl -H "Authorization: Token $API_KEY" \ --header "Content-Type: application/json" \ --compressed \ --data @- \ https://api.idbus.com/v1/search <<JSON { "origin_id": 1, "destination_id": 17, "date": "2015-08-15", "passengers": [ { "id": 1, "age": 30 }, { "id": 2, "age": 30 }, { "id": 3, "age": 1 } ] }JSON但我想用 Volley 將其轉(zhuǎn)換為 HTTP 請(qǐng)求。問(wèn)題是,當(dāng)我啟動(dòng)我的代碼時(shí),在 curl 請(qǐng)求工作時(shí)出現(xiàn) 404 錯(cuò)誤。我認(rèn)為問(wèn)題出在我將 JSON 對(duì)象傳遞到請(qǐng)求中的方式。但是我沒(méi)有找到錯(cuò)誤希望有人可以幫助我,在此先感謝您!
添加回答
舉報(bào)
0/150
提交
取消