我想通过Android发出此请求
我想更改“季节”参数。 这是我的代码
RequestQueue requestQueue = Volley.newRequestQueue(getContext());
String uri = Uri.parse("https://fortnite-public-api.theapinetwork.com/prod09/challenges/get")
.buildUpon()
.build().toString();
StringRequest stringRequest = new StringRequest(
Request.Method.GET, uri, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject obj = new JSONObject(response);
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("VolleyError", error.toString());
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> params = new HashMap<>();
params.put("season", "4");
return params;
}
};
requestQueue.add(stringRequest);
它可以工作,但是响应设置为“ season = 0”,我想将其设置为4或5等...
如何更改身体参数以进行自己的请求?