Skip to content

Commit

Permalink
added new feature: orderKeywordData to request new keywords. This met…
Browse files Browse the repository at this point in the history
…hod will be extended in future for bulk requests.
  • Loading branch information
PatrickHuetter committed Jul 9, 2014
1 parent 53579f0 commit b730a22
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit b730a22

Please sign in to comment.