Wie mache ich diese Abfrage, die ich unten erwähnen werde?GET Abfrage mit JSON - Retrofit 2.0
Methode @GET
. Abfrage sollte wie folgt aussieht:
/top40?data={"ranking":"world"}
/top40?data={"ranking":"country"}
@GET("/api/top40")
Call<FamousTop40Model> getStatus(
// what should be there?
);
class Factory {
private static FamousTop40Api service;
public static FamousTop40Api getInstance() {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(ApiConstants.BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
service = retrofit.create(FamousTop40Api.class);
return service;
}
}
Könnt ihr mir helfen?
EDIT: + Ich sollte accessKey
in der Kopfzeile haben.
Sie möchten eine Get or Put-Anfrage stellen? – Drv
Anfrage erhalten, aber in der empfangenen API wird gesagt, dass ich JSON senden sollte, um Daten zu empfangen. Es ist sogar möglich, jsons params in Get zu senden? – y07k2
Sie können die folgende Antwort folgen: @ y07k2 – Lampard