0

I tried my request in both way. which is

@PUT("api/check-ticket/{reg_id}/{gate}/") Observable<AppAllowTicketResponse> checkRealTimeTicketStatus( @Path("reg_id") String ticket_id, @Path("gate") int gate_id ); 

And ..

@FormUrlEncoded @PUT("api/check-ticket/{reg_id}/{gate}/") Observable<AppAllowTicketResponse> checkRealTimeTicketStatus( @Field("reg_id") String ticket_id, @Field("gate") int gate_id ); 

but its always ends by giving me error. HTTP 404 not found. I have other @GET and @POST request which is working. call is happening from here ..

mTicketCheckService.checkRealTimeTicketStatus(ticket_id, (gate_id+ValueConstants.GATE_ADD_VALUE)) .subscribeOn(mNewThread) .observeOn(mMainThread) .subscribe(new Observer<AppAllowTicketResponse>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { e.printStackTrace(); Log.e("api error response: ", e.getLocalizedMessage()); } @Override public void onNext(AppAllowTicketResponse appAllowTicketResponse) { } }); 

I have no idea why this is happening. I have searched stackoverflow for similar problem but didn't get any solution.

4
  • Since other requests worked, I presume you have the internet permission turned on. Did you try the url in postman and see if it's good? Commented Mar 6, 2017 at 8:34
  • works fine i postman. URL is "base.url/api/check-ticket?reg_id=YB-40001&gate=16" Commented Mar 6, 2017 at 8:38
  • Did you try without the extra "/" at the end? "base.url/api/check-ticket?reg_id=YB-40001&gate=16" vs "base.url/api/check-ticket?reg_id=YB-40001&gate=16/" Commented Mar 6, 2017 at 8:41
  • found my problem. added as answer Commented Mar 6, 2017 at 8:49

1 Answer 1

1

I did a silly mistake. It was all for wrong url format. the call is now

@PUT("api/check-ticket") Observable<AppAllowTicketResponse> checkRealTimeTicketStatus( @Query("reg_id") String ticket_id, @Query("gate") int gate_id ); 

and its perfectly working now.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.