改造格式错误的网址

时间:2018-12-23 17:27:45

标签: retrofit2

我想对电报API进行改造。但是它给出了

“由以下原因引起:java.lang.IllegalArgumentException:格式错误的URL。基址:https://api.telegram.org/,相对:botXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXX / getUpdates”错误

 public interface telegramService {
    @GET ("{botKey}/getUpdates")
    Call<telegramModel> getValue (@Path("botKey") String botKey);
 }

    Retrofit.Builder builder = new Retrofit.Builder()
            .baseUrl("https://api.telegram.org/")
            .addConverterFactory(GsonConverterFactory.create());
    OkHttpClient client = new OkHttpClient.Builder()
            .build();
    Retrofit retrofit = builder.client(client).build();
    telegramService mTelegram =retrofit.create(telegramService.class);
    Call<telegramModel> mTelegramModel= mTelegram.getValue("botXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXX");

0 个答案:

没有答案