Installation
Install WebService::Careerjet module via cpnam
cpanm -S WebService::Careerjet
Documentation
You can find the full documentation of the module here
Important notes:
- the GET parameters <USER_IP> and <USER_AGENT> are required and must be replaced by actual values.
- the header field
Refereris required and contains the page from which the API call was initially triggered. For example, if your page ishttps://example-publisher-site.com/find-jobs/, then the Referer field should contain exactly that. - the fields
searchandlocationare optional but are limited to your country
Example code
use Careerjet_API;
my $api_key = '<API_KEY>';
my $locale_code = 'en_IM';
my $user_ip = '<USER_IP>';
my $user_agent = '<USER_AGENT>';
my $referer = 'https:///find-jobs/?s=perl+developer&l=London'
# Create Perl interface to API
my $search_api = WebService::Careerjet->new($locale_code, $api_key);
# Perform a search
my $result = $search_api->search({
'keywords' => 'perl developer',
'location' => 'London',
'page' => 1,
'sort' => 'releveance',
'user_ip' => $user_ip,
'user_agent' => $user_agent,
'referrer' => $referrer,
});
# Go through results
if ($result->{type} eq 'JOBS') {
print "Found ". $result->{hits}. " jobs on " . $result->{pages} . " pages\n";
my $ra_jobs = $result->{jobs};
foreach my $job(@$ra_jobs) {
print "URL :".$job->{url}."\n";
print "TITLE :".$job->{title}."\n";
print "COMPANY :".$job->{company}."\n";
print "SALARY :".$job->{salary}."\n";
print "DATE :".$job->{date}."\n";
print "DESCRIPTION :".$job->{description}."\n";
print "LOCATIONS :".$job->{locations}."\n";
print "\n";
}
}
# when several locations match the input location
# a new search needs to be done with one of the proposed locations
if ($result->{type} == 'LOCATIONS') {
foreach my $loc(@{$result->locations}) {
print $loc->{name} . "\n";
}
}