从 Android 中删除所有上下文 Dialogflow?

Delete all contexts Dialogflow from Android?

基地 URL : https://api.dialogflow.com/v1/

删除“https://api.dialogflow.com/v1/contexts?sessionId=12345

Headers: 授权:不记名 YOUR_CLIENT_ACCESS_TOKEN Content-Type: application/json

我正在使用改造 2,我想对 Dialogflow 发出删除请求。我想删除所有上下文。

这是到目前为止所做的:

@DELETE("contexts?sessionId=12345") Call<Void>deletDialogflow(@Header("Content-Type")String content_type, @Header("Authorization")String auth);

并在api调用。

private void deleteContextDialogFlow(){

    Retrofit retrofit = new Retrofit.Builder()
            .baseUrl(DialogflowService.BASE_URL_DIALOGFLOW)
            .addConverterFactory(GsonConverterFactory.create())
            .build();

    DialogflowService service = retrofit.create(DialogflowService.class);

    Call call = service.deletDialogflow("application/json; charset=utf-8", DialogflowService.BEARER + DialogflowService.TOKEN_DIALOGFLOW);


   call.enqueue(new Callback() {
       @Override
       public void onResponse(Call call, Response response) {

           Log.e("Successful Delete", "" + response.body().toString());

       }

       @Override
       public void onFailure(Call call, Throwable t) {

           Log.e("UnSuccessful Delete", "" + t.getMessage());


       }
   });



}

我没有得到我想要的结果。也就是说,所有上下文都消失了。

我确实测试了下面的代码工作正常,看看这个。

请仔细看我的代码:

DialogflowService.java

@Headers("Content-Type:application/json")
@DELETE("contexts?sessionId=12345")
Call<String> deletDialogflow(@Header("Authorization") String auth);

deleteContextDialogFlow()

Call<String> call = service.deletDialogflow(DialogflowService.BEARER+DialogflowService.TOKEN_DIALOGFLOW);
 call.enqueue(new Callback<String>() {
   @Override
   public void onResponse(Call<String> call, Response<String> response) {
      if (response.isSuccessful()) {
        Log.e("Successful Delete", "" + response.body().toString());
        }
        else{
        Log.e("Fail Delete", "" + response.errorBody().string());
        }

   }

   @Override
   public void onFailure(Call<String> call, Throwable t) {
       Log.e("UnSuccessful Delete", "" + t.getMessage());
   }
});