From b730a22b862a1d27d793e9872f56e6ef5f179c58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=BCtter?= Date: Wed, 9 Jul 2014 15:38:57 +0200 Subject: [PATCH] added new feature: orderKeywordData to request new keywords. This method will be extended in future for bulk requests. --- .../services/KeywordDeskApiService.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/main/java/com/encircle360/keyworddesk/client/services/KeywordDeskApiService.java b/src/main/java/com/encircle360/keyworddesk/client/services/KeywordDeskApiService.java index fc9f3e5..e042f9f 100644 --- a/src/main/java/com/encircle360/keyworddesk/client/services/KeywordDeskApiService.java +++ b/src/main/java/com/encircle360/keyworddesk/client/services/KeywordDeskApiService.java @@ -342,6 +342,29 @@ public Boolean hasCredits() { return false; } + /** + * Order keyword-data (or request refreshing of data) wich isn't in the keyworddesk database. You'll get a push notification to the url you specified in your api backend if the job is completed, so you don't need to pull the api. + * @param keywordRequest + * @return the job id of the created job for this request or null if request failed + */ + public String orderKeywordData(KeywordRequest keywordRequest) { + + String jsonString = JSONObject.fromObject(keywordRequest).toString(); + String jobId = null; + + try { + String responseContent = this.sendHttpPost(this.getUrlApiBase() + "/orderKeywordData", jsonString); + JSONObject jsonObject = JSONObject.fromObject(responseContent); + JSONObject jobCreated = (JSONObject) jsonObject.get("jobCreated"); + jobId = jobCreated.getString("id"); + + } catch (Exception e) { + e.printStackTrace(); + } + + return jobId; + } + public String getUrlApiLogin() { return urlApiLogin; }