PHP code example of seregazhuk / headhunter-api

1. Go to this page and download the library: Download seregazhuk/headhunter-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

seregazhuk / headhunter-api example snippets


// You may need to amend this path to locate composer's autoloader
need token only
 * for resources that 

$vacancy = $api->vacancies->view($id);

$similarVacancies = $api->vacancies->similar($id);

$blacklisted = $api->vacancies->blacklisted();

$vacancies = $api->vacancies->favorited();

// with pagination
$vacancies = $api->vacancies->favorited(['page' => 2]);

$vacancies = $api->vacancies->search($params);

$stats = $api->vacancies->statistics($vacancyId);

$vacancies = $api->vacancies->active();

// you can specify a manager, by default uses current manager
$vacancies = $api->vacancies->active($managerId);
// with pagination
$vacancies = $api->vacancies->active($managerId, ['page'=>2]);

$archived = $api->vacancies->archived();
// with pagination
$archived = $api->vacancies->archived(['page'=>2]);

$hidden = $api->vacancies->hidden();
// with pagination
$hidden = $api->vacancies->hidden(['page'=>2]);

$api->vacancies->hide($vacancyId);

$api->vacancies->restore($vacancyId);

$employee = $api->employers->view($id);

$employers = $api->employers->search($params);

$reference_type = $api->employers->getManagerTypes();
$reference_type = $api->employers->getManagerTypes($employerId);

$managers = $api->employers->getManagers();
$managers = $api->employers->getManagers($employerId);
$managerWhoHasVacancies = $api->employers->getManagersWhoHasVacancies();
$managerWhoHasVacancies = $api->employers->getManagersWhoHasVacancies($employerId);

$managers = $api->employers->getManager($managerId);
$managers = $api->employers->getManager($managerId, $employerId);

$photos = $api->artifacts->photos();

$portfolio = $api->artifacts->portfolio();

$api->artifacts->deletePhoto($photoId);

$api->artifacts->editPhoto($photoId, $attributes);

$api->artifacts->uploadPhoto('photo.jpg', 'my picture description');

$api->artifacts->uploadPortfolio('portfolio.jpg', 'my portfolio description');

$info = $api->me->info();

$api->me->editName($lastName, $firstName, $middleName);

$isInSearch = true; // or false;
$api->me->setIsInSearch($isInSearch);

$me = $api->me->info();
$managerId = $me['manager']['id'];
$preferences = $api->manager->preferences($managerId);

// automatically get manager id from your profile
$preferences = $api->manager->preferences($managerId);

$comments = $api->comments->view($applicantId);

$resumeInfo = $api->resume->view($resumeId);
$applicantCommentsUrl = $resumeInfo['owner']['comments']['url']; // https://api.hh.ru/applicant_comments/2743747
// You need to parse id from this url

// Create a comment, that is visible for coworkers
$result = $api->comments($applicantId, 'my comment');

// Create a comment, that is visible only for you
$result = $api->createPrivate($applicantId, 'my comment');

// Edit a comment, that is visible for coworkers
$api->comments->edit($applicantId, $commentId, 'new comment text')

// Edit a comment, that is visible only for you
$result = $api->editPrivate($applicantId, $commentId, 'new comment text');

$api->comments->delete($applicantId, $commentId);

$industries = $api->industries->all();

$negotiations = $api->negotiations->all();

$negotiations = $api->negotiations->active();

$api->negotiations->messages($negotiationId);
// with pagination
$api->negotiations->messages($negotiationId, ['page'=>2]);

$api->negotiations->message($negotiationId, $messageText);

$responses = $api->negotiations->invited($vacancyId);

$responses = $api->negotiations->invitedResponses($vacancyId);
// with pagination
$responses = $api->negotiations->invitedResponses($vacancyId, ['page'=>2]);

$toConsider = $api->negotiations->invitedConsider($vacancyId);

$phoneInterviews = $api->negotiations->invitedPhoneInterviews($vacancyId);

$assessments = $api->negotiations->invitedAssessments($vacancyId);

$interviews = $api->negotiations->invitedInterviews($vacancyId);

$offers = $api->negotiations->invitedOffers($vacancyId);

$hired = $api->negotiations->invitedHired($vacancyId);

$discard = $api->negotiations->invitedDiscardByEmployer($vacancyId);

$response = $api->negotiations->view($negotiationId);

$regions = $api->regions->all();

$resumes = $api->resumes->mine();

$views = $api->resumes->view($resumeId);

$api->resumes->edit($resumeId, ['first_name' => 'New name']);

$attributes = ['first_name' => 'New name'];
$result = $api->resumes->create($attributes);

$views = $api->resumes->views($resumeId);

// with pagination

$views = $api->resumes->views($resumeId, ['page'=>2]);

$negotiations = $api->resumes->negotiations($resumeId);
// with pagination
$negotiations = $api->resumes->negotiations($resumeId, ['page' => 2]);

$api->resumes->publish($resumeId);

$conditions = $api->resumes->conditions($resumeId);

$api->resumes->delete($resumeId);

$status = $api->resumes->status($resumeId);

$jobs = $api->resumes->jobs($resumeId)

// with pagination
$jobs = $api->resumes->jobs($resumeId, ['page' => 2])

$blackList = $api->resumes->getBlackList($resumeId);
// ...
$whiteList = $api->resumes->getWhiteList($resumeId);

$api->resumes->addToBlackList($resumeId, $companyId);
// ...
$api->resumes->addToWhiteList($resumeId, $companyId);

$api->resumes->removeFromBlackList($resumeId, $companyId);
// ...
$api->resumes->removeFromWhiteList($resumeId, $companyId);

$api->resumes->clearBlackList($resumeId);
// ...
$api->resumes->clearWhiteList($resumeId);

$companies = $api->resumes->searchInBlackList($resumeId, 'some-key-word');
//...
$companies = $api->resumes->searchInWhiteList($resumeId, 'some-key-word');

$searches = $api->savedSearches->all();

$searches = $api->savedSearches->view($searchId);

$specializations = $api->specializations->all();

$dictionaries = $api->dictionaries->all();

$suggests = $api->suggests->educational_institutions($text);

$suggests = $api->suggests->companies($text);

$suggests = $api->suggests->fieldsOfStudy($text);

$suggests = $api->suggests->skillSet($text);

$suggests = $api->suggests->positions($text);

$suggests = $api->suggests->areas($text);

$suggests = $api->suggests->vacancySearchKeyword($text);

$stations = $api->metro->all();

$stations = $api->metro->forCity($cityId);

$languages = $api->languages->all();

$faculties = $api->faculties->forInstitution($institutionId);

$api->setLocale('EN');

// chain methods
$api->setLocale('EN')
    ->me
    ->info();

$api->setHost('hh.kz');

// chain methods
$api->setHost('hh.kz')
    ->me
    ->info();