🐘 Riminder API PHP Wrapper
composer require riminder/riminder-php-api
To authenticate against the api, get your API SECRET KEY from your riminder dashboard:
Then create a new Riminder
object with this key:
require __DIR__ . '/vendor/autoload.php';
// Authentication to api
$client = new Riminder('yourShinnyKey');
// Now, you can use the api, Congrats !
require __DIR__ . '/vendor/autoload.php';
// Authentication to api
$client = new Riminder('yourShinnyKey');
$profile = $client->profile->get(new ProfileID('102b6aa635fnf8ar70e7888ee63c0jde0c753dtg'));
$name = $profile['name'];
$profile_id = $profile['profile_id'];
echo "Profile '$profile_id' is named '$name', a beautiful name actually";
If an error occurs while an operation an exception of type RiminderApiException
is raised.
Methods that needs an profile id or reference takes a ProfileID
or a ProfileReference
, they are interchangeable.
$profile_id = new ProfileID('102b6aa635fnf8ar70e7888ee63c0jde0c753dtg');
$profile_reference = new ProfileReference('reference01');
$source_id = '34566aa635fnrtar70e7568ee6345jde0c75ert4';
// This:
$client->profile->get($profile_id, $source_id);
// Works as much as:
$client->profile->get($profile_reference, $source_id);
It's works the same way as profile.
*_id
and *_reference
are marked as *_ident
for simplicity.
-
- Get all filters for given team account :
$client->filter->list();
- Get the filter information associated with filter id :
$client->filter->get($filter_ident);
-
- Retrieve the profiles information associated with some source ids :
$start = new DateTime('2017-01-02'); $end = new DateTime(); $args = [ RiminderField::SOURCE_IDS => ['34566aa635fnrtar70e7568ee6345jde0c75ert4'], RiminderField::DATE_START => $start->getTimestamp(), RiminderField::DATE_END => $end->getTimestamp(), RiminderField::SORT_BY => RiminderSortBy::RANKING, RiminderField::FILTER_REFERENCE => 'reference01' ]; $client->profile->list($args);
- Add a resume to a sourced id :
$client->profile->add($source_id, $file_path, [$profile_reference, $timestamp_reception, $training_metadata]);
- Add all resume from a directory to a sourced id, use
$recurs
to enable recursive mode :
$client->profile->addList($source_id, $file_path, [$is_recurs, $timestamp_reception, $training_metadata]);
It returns an array like:
result[filename] = server_reponse
. Can throwRiminderApiProfileUploadException
- Get the profile information associated with both profile id and source id :
$client->profile->get($profile_ident, $source_id);
- Retrieve the profile documents associated with both profile id and source id :
$client->profile->document->list($profile_ident, $source_id);
- Retrieve the profile parsing data associated with both profile id and source id :
$client->profile->parsing->get($profile_ident, $source_ident);
- Retrieve the profile scoring data associated with both profile id and source id :
$client->profile->scoring->list($profile_ident, $source_id);
- Edit the profile stage of given a filter :
$client->profile->stage->set($profile_ident, $source_id, $filter_ident, $rating);
- Edit the profile rating of given a filter :
$client->profile->rating->set($profile_ident, $source_id, $filter_ident, $rating)
- Check if a parsed profile is valid
$client->profile->json->check($profileData, $trainingMetadata);
- Add a parsed profile to the platform
$client->profile->json->add($source_id, $profileData, $trainingMetadata, $profile_reference, $timestamp_reception);
$profileData
is an array like this:$profileData = [ "name" => "test persona", "email" => "someone@someonelse.com", "address" => "1 rue de somexhereelse", "experiences" => [ [ "start" => "15/02/2018", "end" => "1/06/2018", "title" => "PDG", "company" => "red apple corp", "location" => "Paris", "description" => "Doing IT integration and RPA" ] ], "educations" => [ [ "start" => "2000", "end" => "2018", "title" => "Diplome d'ingénieur", "school" => "UTT", "description" => "Management des systèmes d'information", "location" => "Mars" ] ], "skills" => [ "manual skill", "Creative spirit", "Writing skills", "World domination", "Project management", "French", "Italian", "Korean", "English", "Accounting", "Human resources" ] ];
$trainingMetadata
is a array of array like this:$trainingMetadata = [ [ "filter_reference" => "reference0", "stage" => None, "stage_timestamp" => None, "rating" => 2, "rating_timestamp" => 1530607434 ], [ "filter_reference" => "reference1", "stage" => None, "stage_timestamp" => None, "rating" => 2, "rating_timestamp" => 1530607434 ] ];
-
- Get all sources for given team account:
$client->source->list();
- Get the source information associated with source id:
$client->source->get($source_id);
This package supplies webhooks support as well.
- Check for webhooks integration:
$client->webhooks->check();
- Set an handler for an event (listed with RiminderEvents constants)
$client->webhooks->setHandler($eventName, $callback);
- Check if the event has an handler
$client->webhooks->isHandlerPresent($eventName);
- Remove handler for an event
$client->webhooks->removeHandler($eventName);
- Handle the incoming webhooks request, you need to put as argument HTTP_RIMINDER_SIGNATURE as an argument.
$client->webhooks->handle($encoded_datas);
-
Example on how to handle webhooks
$client = new Riminder('api_key', 'webhook_key'); // Set an handler for webhooks event. // Event name argument is actually not mandatory $callback = function($webhook_data, $event_name) { print($event_name); var_dump($webhook_data); } // RiminderEvents contants can be use as well as string for event name // for example here RiminderEvents::PROFILE_PARSE_SUCCESS can be replaced // by 'profile.parse.success' $client->webhooks->setHandler(RiminderEvents::PROFILE_PARSE_SUCCESS, $callback); // Get the header of the request sent by the webhook. $encoded_header = [HTTP-RIMINDER-SIGNATURE => 'some encoded datas']; // Handle the webhook $client->webhooks->handle($encoded_header);
-
RiminderFields
Contains to fill profile'sargs
array for /profiles constants.RiminderStage
Contains profile stage constants.RiminderSortBy
Contains sorting options constants.RiminderOrderBy
Contains order options constants.RiminderSeniority
Contains profile seniority constants.RiminderTraining_metadata
Contain metadata fields for profile adding constants.RiminderEvents
Constains event name for webhooks
-
RiminderApiException
parent of all thrown exception. Thrown when an error occurs.RiminderApiResponseException
thrown when response http code is not a valid one.getHttpCode()
to get the http code of the response.getHttpMessage()
to get the reason of response error.
RiminderApiArgumentException
thrown when an invalid argument is pass to a methodRiminderApiProfileUploadException
thrown when an error occurs during file upload.getFailedFiles()
to get not sended files list.getFailedFilesWithTheirExp()
to get not sended files with their exception (like:exception_occured_during_tranfert = failed_file_list[filename]
)getSuccefullySendedFiles()
to get successfuly sended files with their response from server (like:server_reponse_for_sucessful_upload = sucess_file_list[filename]
)
For details about method's arguments and return values see api's documentation