Java interface to Careerjet's public search API
The following details how to embed Careerjet job search results directly within your website in Java.
Installation
Download both careerjet-api-1.0.jar as well as Json-simple and add them to your class path directory.
Documentation
Java docs are available here.
Example
Client c = new Client("en_GB");
Map<String, String> args = new HashMap<String, String>();
args.put("keywords", "perl developer");
args.put("location", "london");
JSONObject results = (JSONObject) c.search(args);
// A list of jobs is returned
if (results.get("type").equals("JOBS")) {
JSONArray jobs = (JSONArray) results.get("jobs");
System.out.println("Number of results:" + results.get("hits"));
int index = 0;
while( index < jobs.size()) {
JSONObject job = (JSONObject) jobs.get(index);
System.out.println("URL :" + job.get("url"));
System.out.println("TITLE :" + job.get("title"));
System.out.println("COMPANY :" + job.get("company"));
System.out.println("SALARY :" + job.get("salary"));
System.out.println("DATE :" + job.get("date"));
System.out.println("DESCRIPTION :" + job.get("description"));
System.out.println("SITE :" + job.get("site"));
System.out.println("LOCATIONS :" + job.get("locations"));
index++;
}
}
// The location was amiguous. Suggestions are returned.
// Add the location_id to the query to resolve the ambiguity.
if (results.get("type").equals("LOCATIONS")) {
System.out.println("Narrow down your location ");
System.out.println("Please specify a location");
JSONArray solvelocations = (JSONArray) results.get("solveLocations");
int index = 0;
while(index < solvelocations.size()) {
JSONObject location = (JSONObject) solvelocations.get(index);
System.out.println("NAME :" + location.get("name"));
System.out.println("LOCATION ID :" + location.get("location_id"));
index++;
}
}
// An error occured. An error message is returned.
if (results.get("type").equals("ERROR")) {
System.out.println("An error occurred whilst processing the search query");
System.out.println("Error message :" + results.get("ERROR"));
}
