Java Code Examples for retrofit2.http.FormUrlEncoded

The following are top voted examples for showing how to use retrofit2.http.FormUrlEncoded. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: GitHub   File: RequestBuilderTest.java   Source Code and License 6 votes vote down vote up
@Test public void formEncodingFailsOnNonBodyMethod() {
  class Example {
    @FormUrlEncoded //
    @GET("/") //
    Call<ResponseBody> method() {
      return null;
    }
  }
  try {
    buildRequest(Example.class);
    fail();
  } catch (IllegalArgumentException e) {
    assertThat(e).hasMessage(
        "FormUrlEncoded can only be specified on HTTP methods with request body (e.g., @POST).\n    for method Example.method");
  }
}
 
Example 2
Project: GitHub   File: RequestBuilderTest.java   Source Code and License 6 votes vote down vote up
@Test public void onlyOneEncodingIsAllowedFormEncodingFirst() {
  class Example {
    @FormUrlEncoded //
    @Multipart //
    @POST("/") //
    Call<ResponseBody> method() {
      return null;
    }
  }
  try {
    buildRequest(Example.class);
    fail();
  } catch (IllegalArgumentException e) {
    assertThat(e).hasMessage(
        "Only one encoding annotation is allowed.\n    for method Example.method");
  }
}
 
Example 3
Project: Phoenix-for-VK   File: IWallService.java   Source Code and License 6 votes vote down vote up
@FormUrlEncoded
@POST("wall.post")
Single<BaseResponse<PostCreateResponse>> post(@Field("owner_id") Integer ownerId,
                                              @Field("friends_only") Integer friendsOnly,
                                              @Field("from_group") Integer fromGroup,
                                              @Field("message") String message,
                                              @Field("attachments") String attachments,
                                              @Field("services") String services,
                                              @Field("signed") Integer signed,
                                              @Field("publish_date") Long publishDate,
                                              @Field("lat") Double latitude,
                                              @Field("long") Double longitude,
                                              @Field("place_id") Integer placeId,
                                              @Field("post_id") Integer postId,
                                              @Field("guid") Integer guid,
                                              @Field("mark_as_ads") Integer markAsAds,
                                              @Field("ads_promoted_stealth") Integer adsPromotedStealth);
 
Example 4
Project: GitHub   File: RequestBuilderTest.java   Source Code and License 5 votes vote down vote up
@Test public void simpleFormEncoded() {
  class Example {
    @FormUrlEncoded //
    @POST("/foo") //
    Call<ResponseBody> method(@Field("foo") String foo, @Field("ping") String ping) {
      return null;
    }
  }
  Request request = buildRequest(Example.class, "bar", "pong");
  assertBody(request.body(), "foo=bar&ping=pong");
}
 
Example 5
Project: Renrentou   File: OrderService.java   Source Code and License 5 votes vote down vote up
@POST("order/new")
@FormUrlEncoded
Flowable<ResponseDto> add(
        @Field("deviceId") String deviceId,
        @Field("price") float price,
        @Field("adOwner") String adOwner,
        @Field("deviceOwner") String deviceOwner,
        @Field("token") String token
);
 
Example 6
Project: Phoenix-for-VK   File: IGroupsService.java   Source Code and License 5 votes vote down vote up
@FormUrlEncoded
@POST("groups.editManager")
Single<BaseResponse<Integer>> editManager(@Field("group_id") int groupId,
                                          @Field("user_id") int userId,
                                          @Field("role") String role,
                                          @Field("is_contact") Integer isContact,
                                          @Field("contact_position") String contactPosition,
                                          @Field("contact_phone") String contactPhone,
                                          @Field("contact_email") String contactEmail);
 
Example 7
Project: GitHub   File: RequestBuilderTest.java   Source Code and License 5 votes vote down vote up
@Test public void formEncodedWithEncodedNameFieldParam() {
  class Example {
    @FormUrlEncoded //
    @POST("/foo") //
    Call<ResponseBody> method(@Field(value = "na%20me", encoded = true) String foo) {
      return null;
    }
  }
  Request request = buildRequest(Example.class, "ba%20r");
  assertBody(request.body(), "na%20me=ba%20r");
}
 
Example 8
Project: Protein   File: AccessTokenService.java   Source Code and License 5 votes vote down vote up
@POST
@FormUrlEncoded
Observable<Response<AccessToken>> getAccessToken(@Url String url,
                                                 @Field("client_id") String clientId,
                                                 @Field("client_secret") String clientSecret,
                                                 @Field("code") String code,
                                                 @Field("redirect_uri") String redirect_uri);
 
Example 9
Project: Paper-Melody   File: SocialSystemAPI.java   Source Code and License 5 votes vote down vote up
@FormUrlEncoded
@POST("upload/music")
Observable<UploadResponse> uploadMusic(@Field("name") String name,
                                       @Field("author") String author,
                                       @Field("authorID") Integer authorID,
                                       @Field("authorAvatarName") String authorAvatarName,
                                       @Field("date") String date,
                                       @Field("musicName") String musicName,
                                       @Field("imgName") String imgName,
                                       @Field("musicInfo") String musicInfo);
 
Example 10
Project: Phoenix-for-VK   File: IAudioService.java   Source Code and License 5 votes vote down vote up
@FormUrlEncoded
@POST("audio.search")
Single<BaseResponse<Items<VKApiAudio>>> search(@Field("q") String query,
                                               @Field("auto_complete") Integer autoComplete,
                                               @Field("lyrics") Integer lyrics,
                                               @Field("performer_only") Integer performerOnly,
                                               @Field("sort") Integer sort,
                                               @Field("search_own") Integer searchOwn,
                                               @Field("offset") Integer offset,
                                               @Field("count") Integer count);
 
Example 11
Project: AndroidThings-BurglarAlarm   File: IgniteService.java   Source Code and License 5 votes vote down vote up
@Headers({
        "Authorization:Basic ZnJvbnRlbmQ6",
        "Content-Type:application/x-www-form-urlencoded"
})
@FormUrlEncoded
@POST("login/oauth")
Call<AccessToken> getAccessToken(@Field("username") String username, @Field("password") String password, @Field("grant_type") String grant_type);
 
Example 12
Project: Renrentou   File: SystemService.java   Source Code and License 5 votes vote down vote up
@POST("sys/comments/new")
@FormUrlEncoded
Flowable<ResponseDto> comment(
        @Field("account") String account,
        @Field("content") String content,
        @Field("token") String token
);
 
Example 13
Project: lostfilm-android-client   File: LostFilmService.java   Source Code and License 5 votes vote down vote up
@POST("ajaxik.php")
@FormUrlEncoded
Observable<TvShowsResponse> getTvShows(@Field("act") String act,
                                       @Field("type") String type,
                                       @Field("o") int offset,
                                       @Field("s") int searchType,
                                       @Field("t") int t);
 
Example 14
Project: Renrentou   File: OrderService.java   Source Code and License 5 votes vote down vote up
@POST("order/update")
@FormUrlEncoded
Flowable<ResponseDto> updateAd(
        @Field("id") String id,
        @Field("adId") String adId,
        @Field("token") String token
);
 
Example 15
Project: GxIconAndroid   File: NanoServerService.java   Source Code and License 5 votes vote down vote up
/**
 * { "status": 0, "msg": "success" }
 */
@FormUrlEncoded
@POST("reqfilter/{iconpack}/{user}")
Call<ResResBean> filterPkg(@Path("iconpack") String iconPack,
                           @Path("user") String user,
                           @Field("pkg") String pkgName,
                           @Field("launcher") String launcherActivity);
 
Example 16
Project: Tribe   File: ApiService.java   Source Code and License 5 votes vote down vote up
@FormUrlEncoded
@POST("api.php?m=activity&a=add")
Observable<HttpResult<String>> releaseActivity(@Field("userid") String userId,
                                                     @Field("country_id") String countryId,
                                                     @Field("name") String name,
                                                     @Field("address") String address,
                                                     @Field("start_time") String startTime,
                                                     @Field("end_time") String endTime,
                                                     @Field("fee") String fee,
                                                     @Field("num") String num,
                                                     @Field("sponsor") String sponsor,
                                                     @Field("desc") String content,
                                                     @Field("index_pics") String coverImg,
                                                     @Field("detail_pics") String detailPics);
 
Example 17
Project: GxIconDIY   File: NanoServerService.java   Source Code and License 5 votes vote down vote up
/**
 * { "status": 0, "msg": "success" }
 */
@FormUrlEncoded
@POST("reqfilter/{iconpack}/{user}")
Call<ResResBean> filterPkg(@Path("iconpack") String iconPack,
                           @Path("user") String user,
                           @Field("pkg") String pkgName,
                           @Field("launcher") String launcherActivity);
 
Example 18
Project: Phoenix-for-VK   File: IGroupsService.java   Source Code and License 5 votes vote down vote up
@POST("groups.banUser")
@FormUrlEncoded
Single<BaseResponse<Integer>> banUser(@Field("group_id") int groupId,
                                      @Field("user_id") int userId,
                                      @Field("end_date") Long endDate,
                                      @Field("reason") Integer reason,
                                      @Field("comment") String comment,
                                      @Field("comment_visible") Integer commentVisible);
 
Example 19
Project: Phoenix-for-VK   File: IWallService.java   Source Code and License 5 votes vote down vote up
@FormUrlEncoded
@POST("wall.getComments")
Single<BaseResponse<DefaultCommentsResponse>> getComments(@Field("owner_id") Integer ownerId,
                                                          @Field("post_id") int postId,
                                                          @Field("need_likes") Integer needLikes,
                                                          @Field("start_comment_id") Integer startCommentId,
                                                          @Field("offset") Integer offset,
                                                          @Field("count") Integer count,
                                                          @Field("sort") String sort,
                                                          @Field("extended") Integer extended,
                                                          @Field("fields") String fields);
 
Example 20
Project: Tribe   File: ApiService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("api.php?m=activity&a=activityList")
Observable<HttpResult<List<CommentBean>>> getMyCommentList(@Field("userid") String userId);
 
Example 21
Project: TestChat   File: ApiService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST
Call<ResponseBody> post(@Url String url, @FieldMap Map<String,String>map);
 
Example 22
Project: Daejeon-People   File: APIinterface.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("/logout")
Call<Void> doLogOut();
 
Example 23
Project: TripBuyer   File: Api.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("weiPay/wantedPay") Observable<ResponseModel_no_list> weiXin_xuanShang(@Field("id") String orderId);
 
Example 24
Project: AppFirCloud   File: PassportApi.java   Source Code and License 4 votes vote down vote up
/**
 * 登录
 */
@FormUrlEncoded
@POST(BaseApi.Url.URL_REGISTER)
Observable<JSONObject> login(@FieldMap Map<String, String> map);
 
Example 25
Project: telegram-bot-api   File: BotApi.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("/bot{apiToken}/exportChatInviteLink")
Call<ApiResponse<String>> exportChatInviteLink(@Path("apiToken") String apiToken, @Field("chat_id") long chatId);
 
Example 26
Project: bigjpg-app   File: BigjpgServerService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("login")
Call<LoginBean> login(@Field("username") String user,
                      @Field("password") String pwd);
 
Example 27
Project: telegram-bot-api   File: BotApi.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("/bot{apiToken}/restrictChatMember")
Call<ApiResponse<Boolean>> restrictChatMember(@Path("apiToken") String apiToken, @Field("chat_id") String chatId, @Field("user_id") long userId, @Field("until_date") Long untilDate, @Field("can_send_messages") Boolean canSendMessage, @Field("can_send_media_messages") Boolean canSendMediaMessage, @Field("can_send_other_messages") Boolean canSendOtherMessage, @Field("can_add_web_page_previews") Boolean canAddWebPagePreviews);
 
Example 28
Project: RetrofitRxjavaDemo   File: APIService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("getArticleList")
Observable<HttpResult<ArticleListResult>> getArticleList2(
        @Field("pageSize") int pageSize,
        @Field("page") int page);
 
Example 29
Project: 12306_Android   File: HttpService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("passcodeNew/checkRandCodeAnsyn")
Observable<CheckRandCodeResponse> checkRandCode(@Field(value = "randCode", encoded = true) String randCode, @Field("rand") String rand);
 
Example 30
Project: Tribe   File: ApiService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("api.php?m=activity&a=clearList")
Observable<HttpResult<String>> clearCommentList(@Field("userid") String userId);
 
Example 31
Project: ZeroKit-Android-SDK   File: AdminApi.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@Headers(AUTHORIZATION_HEADER)
@POST("/api/tresor/invited-user")
retrofit2.Call<Void> sharedTresor(@Field("operationId") String operationId);
 
Example 32
Project: ImageClassify   File: TaskService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("task/getfinishedtask")
Call<HttpResult<List<Task>>> getFinishedTask(@Field(ApiConstant.OAUTH_TOKEN) String token,
                                             @Field(ApiConstant.START) String start,
                                             @Field(ApiConstant.PAGE_NUM) String pageNum);
 
Example 33
Project: Phoenix-for-VK   File: IFaveService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("fave.addUser")
Single<BaseResponse<Integer>> addUser(@Field("user_id") int userId);
 
Example 34
Project: Phoenix-for-VK   File: IFaveService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("fave.addGroup")
Single<BaseResponse<Integer>> addGroup(@Field("group_id") int groupId);
 
Example 35
Project: Book-Shelf   File: Authentication.java   Source Code and License 4 votes vote down vote up
@POST("/auth/")
@FormUrlEncoded
Call<CsrfToken> perform(@Field("username") String username, @Field("password") String password);
 
Example 36
Project: TripBuyer   File: Api.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("allAddress") Observable<ResponseModel<List<AllAddress>>> allAddress(@Field("wid") int noMain);
 
Example 37
Project: Protestr   File: ApiInterface.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST(Constants.LOGIN_ENDPOINT)
Call<User> attemptLogin(@Field("user_email") String email, @Field("password") String password);
 
Example 38
Project: PicShow-zhaipin   File: LoginService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("user/update_user_info.shtml")
Observable<BaseJson<LoginInfo>> updateUserInfo(@FieldMap Map<String, String> body);
 
Example 39
Project: Edu   File: LoginClient.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("/api.php/Public/login_json")
Call<User> login(@Field("phone") String phone,@Field("code") String code);
 
Example 40
Project: Edu   File: LoginClient.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("/api.php/Public/send_sms_json")
Call<JsonObject> getCode(@Field("phone") String phone);
 
Example 41
Project: ImageClassify   File: RankService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("rank/getranking")
Call<HttpResult<List<Rank>>> getRanking(@Field(ApiConstant.OAUTH_TOKEN) String token,
                                        @Field(ApiConstant.RANK_IDENTIFICATION) String rankIdentification,
                                        @Field(ApiConstant.START) String start,
                                        @Field(ApiConstant.PAGE_NUM) String num);
 
Example 42
Project: JD-Test   File: BaseApiService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST()
Flowable<ResponseBody> postForm(
        @Url() String url,
        @FieldMap Map<String, Object> maps);
 
Example 43
Project: Phoenix-for-VK   File: INewsfeedService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("newsfeed.getLists")
Single<BaseResponse<Items<VkApiFeedList>>> getLists(@Field("list_ids") String listIds,
                                                    @Field("extended") Integer extended);
 
Example 44
Project: RetrofitRxjavaDemo   File: APIService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("getJoke")
Observable<HttpResult<JokeResult>> getJokeById2(
        @Field("id") int id);
 
Example 45
Project: ImageClassify   File: ImageTaskService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("task/committask")
Call<HttpResult<String>> commitTask(@Field(ApiConstant.OAUTH_TOKEN) String oauth_token,
                                    @Field(ApiConstant.TASK) String task,
                                    @Field(ApiConstant.IS_COMMIT) String isCommit);
 
Example 46
Project: Daejeon-People   File: APIinterface.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("/friend/refuse")
Call<Void> refuseFriendRequest(@Header("cookie") String UserSession,
                               @Field("requester_id") String requesterId);
 
Example 47
Project: ImageClassify   File: TaskService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("task/gethometaskstatusdetail")
Call<HttpResult<HomeTaskStatusDetail>> getHomeTaskStatusDetail(@Field(ApiConstant.OAUTH_TOKEN) String token);
 
Example 48
Project: Phoenix-for-VK   File: IWallService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("wall.getById")
Single<BaseResponse<PostsResponse>> getById(@Field("posts") String ids,
                                            @Field("extended") Integer extended,
                                            @Field("copy_history_depth") Integer copyHistoryDepth,
                                            @Field("fields") String fields);
 
Example 49
Project: TripBuyer   File: Api.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("login") Observable<ResponseModel_no_list> login_usepwd(@Field("tel") String tel, @Field("password") String password);
 
Example 50
Project: Phoenix-for-VK   File: IVideoService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("video.editComment")
Single<BaseResponse<Integer>> editComment(@Field("owner_id") Integer ownerId,
                                          @Field("comment_id") int commentId,
                                          @Field("message") String message,
                                          @Field("attachments") String attachments);
 
Example 51
Project: Tribe   File: ApiService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("api.php?m=activity&a=enrollActivity")
Observable<HttpResult<String>> takePartInTheParty(@Field("activity_id") String partyId,
                                                  @Field("userid") String userId);
 
Example 52
Project: react-native-android-library-humaniq-api   File: WalletService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST(value = "/wallet/api/v1/users/{user_id}/transactions") Call<BaseResponse<TransactionResponse>> createTransaction(
    @Path("user_id") String userId, @Field("to_user_id") String toUserId,
    @Field("to_address") String toAddress, @Field("amount") float amount);
 
Example 53
Project: Last.fm-API   File: UpdateService.java   Source Code and License 4 votes vote down vote up
@POST("./")
@FormUrlEncoded
Completable unloveTrack(@FieldMap Map<String,String> options);
 
Example 54
Project: JBase   File: Api.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("clothing_classificati")
Observable<String> test(@Field("apikey") String sign,@Field("apikeys") String signs);
 
Example 55
Project: google-assistant-java-demo   File: OAuthClient.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("token")
Call<OAuthCredentials> refreshAccessToken(@Field("refresh_token") String refreshToken,
                                          @Field("client_id") String clientId,
                                          @Field("client_secret") String clientSecret,
                                          @Field("grant_type") String grantType);
 
Example 56
Project: TripBuyer   File: Api.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("purse/password") Observable<ResponseModel_no_list> setPayPwd(@Field("newPassword") String newPassword);
 
Example 57
Project: yyox   File: UserService.java   Source Code and License 4 votes vote down vote up
@Headers({HEADER_API_VERSION})
@FormUrlEncoded
@POST("login/send")
Observable<BaseJson<JsonObject>> login(@Field("username") String name, @Field("password") String pwd);
 
Example 58
Project: Phoenix-for-VK   File: IVideoService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("video.deleteComment")
Single<BaseResponse<Integer>> deleteComment(@Field("owner_id") Integer ownerId,
                                            @Field("comment_id") int commentId);
 
Example 59
Project: Phoenix-for-VK   File: IFaveService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("fave.getPhotos")
Single<BaseResponse<Items<VKApiPhoto>>> getPhotos(@Field("offset") Integer offset,
                                                  @Field("count") Integer count);
 
Example 60
Project: whatanime-android   File: WhatAnimeServices.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@POST("search")
Call<JsonObject> search(@Query("token") String token, @Field("image") String encodedImage, @Field("filter") String filter);