Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. {
  2. "comments": "Testing",
  3. "quantity": 0,
  4. "retailerId": 0,
  5. "retailerquote": 0,
  6. "subProductId": 999,
  7. "unit": "kg",
  8. "wholesalerid": 999
  9. }
  10.  
  11. HashMap<String,String> header = new HashMap<String, String>();
  12. header.put("Content-type","application/json");
  13. HashMap<String,String> data = new HashMap<String, String>();
  14. data.put("comments",comments);
  15. data.put("quantity",quantity);
  16. data.put("retailerId",retailerID);
  17. data.put("retailerquote",retailerQuote);
  18. data.put("wholesalerId",wholesalerID);
  19. data.put("unit",unit);
  20. data.put("subProductId",subProductID);
  21.  
  22. Call<RequestQuoteCheck> call = RetrofitBaseAdapter.getCommonPathInterfaceRequestQuote().requestQuoteCheck(data);
  23.  
  24. call.enqueue(new retrofit2.Callback<RequestQuoteCheck>() {
  25.  
  26. @Override
  27. public void onResponse(Call<RequestQuoteCheck> call, Response<RequestQuoteCheck> response) {
  28.  
  29. Toast.makeText(getApplicationContext(),response.message(),Toast.LENGTH_SHORT).show();
  30.  
  31. }
  32.  
  33. @Override
  34. public void onFailure(Call<RequestQuoteCheck> call, Throwable t) {
  35.  
  36. }
  37. });
  38.  
  39. public static WebserviceMethods getCommonPathInterfaceRequestQuote() {
  40. final OkHttpClient okHttpClient = new OkHttpClient.Builder()
  41. .readTimeout(30, TimeUnit.SECONDS)
  42. .connectTimeout(30, TimeUnit.SECONDS)
  43. .build();
  44. Retrofit restAdapterRequestQuote = new Retrofit.Builder()
  45. .baseUrl(Constants.baseURLforRequestQuote)
  46. .addConverterFactory(GsonConverterFactory.create())
  47. .client(okHttpClient)
  48. .build();
  49. WebserviceMethods retrofitinterfaces = restAdapterRequestQuote.create(WebserviceMethods.class);
  50. return retrofitinterfaces;
  51. }
  52. }
  53.  
  54. @POST("requestQuoteCheck")
  55. Call<RequestQuoteCheck> requestQuoteCheck(
  56. @HeaderMap Map<String,String> data );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement