Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ApiResponse checkQuote(ApiRequest apiRequest) {
- ApiResponse apiResponse = new ApiResponse();
- String url = String.format("qwerty/%s/%s", apiRequest.getCampaignId(), apiRequest.getQuota());
- HttpGet httpGet = new HttpGet(url);
- try {
- CloseableHttpResponse response = httpClient.execute(httpGet);
- int responseStatusCode = response.getStatusLine().getStatusCode();
- if (200 == responseStatusCode) {
- String jsonResult = new BasicResponseHandler().handleResponse(response);
- boolean success = GSON.fromJson(jsonResult, Boolean.class);
- apiResponse.setSuccess(success);
- }
- } catch (IOException e) {
- apiResponse.setSuccess(false);
- }
- return apiResponse;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement