Skip to content

tomasstark/on-demand-sdk-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sterling On Demand API SDK for PHP

This SDK allows you to call the Sterling Talent Solutions On Demand API.

Requirements

PHP 5.4.0 and later

Export credentials

The example script as well as the Integration tests, require valid credentials. For these scripts, the 'credentials' environmental variable needs to be set to your API credentials. These credentials are a base64 hash of "[apiusername]:[password]".

For example, the base64 hash of "[email protected]:somepassword" is "dXNlcm5hbWVAeW91cmNvbXBhbnkuY29tOnNvbWVwYXNzd29yZA=="

Installation & Usage

Credentials

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/sterlingts/on-demand-sdk-php.git"
    }
  ],
  "require": {
    "sterlingts/on-demand-sdk-php": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once(__DIR__ . '/autoload.php');
    require_once(__DIR__ . '/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/autoload.php');
require_once(__DIR__ . '/vendor/autoload.php');


//start Config
$isProd = false; //set to true to use production endpoints
$credentials = $_SERVER['credentials']; //pulls auth credentials from env
define(JSON_PRETTY_PRINT, true); //prettifies _toString() JSON output
//end Config

$env = ($isProd) ? "api" : "api-int";

/// AUTHORIZE
if (empty($credentials)) {
    exit('credentials not set');
}

$authClient = new Oda\Client\AuthClient("https://{$env}.kennect.com/oauth/token", $credentials);

try {
    $authResponse = $authClient->auth();
} catch (Exception $e) {
    print_r($e);
    exit('Exception when calling AuthClient->auth: '. $e->getMessage(). PHP_EOL);
}

$configuration = Oda\Client\Configuration::getDefaultConfiguration();
$configuration->addDefaultHeader("Authorization", "Bearer " . $authResponse->getAccessToken());
$configuration->setHost("https://{$env}.kennect.com/v1");

// SET UP API CLIENT
$apiClient = new Oda\Client\ApiClient($configuration);
$apiInstance = new Oda\Client\Api\DefaultApi($apiClient);

//TRY AN ENDPOINT
//GET PACKAGES
try {
    $packageResponses = $apiInstance->packagesGet();
} catch (Exception $e) {
    print_r($e);
    exit('Exception when calling DefaultApi->packagesGet: '. $e->getMessage(). PHP_EOL);
}

echo("Number of Packages:". count($packageResponses). PHP_EOL);

foreach ($packageResponses as $packageResponse) {
    echo($packageResponse->__toString(). PHP_EOL);
}
?>

For more code examples, see also: example.php

Documentation for API Endpoints

All URIs are relative to https://api-int.kennect.com/v1

Class Method HTTP request Description
DefaultApi billingCodesGet GET /billing-codes Get a list of valid billing codes
DefaultApi candidatesGet GET /candidates Get a list of Candidates
DefaultApi candidatesIdDocumentsGet GET /candidates/{id}/documents List documents attached to a candidate
DefaultApi candidatesIdDocumentsPost POST /candidates/{id}/documents Attach a document to a candidate
DefaultApi candidatesIdGet GET /candidates/{id} Get a specific Candidate
DefaultApi candidatesIdLinksPost POST /candidates/{id}/links Get links to the Candidate portal for use by the Candidate
DefaultApi candidatesIdPut PUT /candidates/{id} Update a candidate
DefaultApi candidatesIdTrustPost POST /candidates/{id}/trust Trust a candidate
DefaultApi candidatesPost POST /candidates Create a candidate
DefaultApi chargesPost POST /charges Create a capture
DefaultApi healthGet GET /health Check the health of the API
DefaultApi identitiesIdGet GET /identities/{id} Get a verified identity
DefaultApi identitiesIdRetryPost POST /identities/{id}/retry Retry creating an identity and get a new set of questions
DefaultApi identitiesIdVerificationPut PUT /identities/{id}/verification Verify an identity by providing correct answers
DefaultApi identitiesPost POST /identities Get a list of questions needing to be answered before an identity can be created
DefaultApi packagesGet GET /packages Get a list of Packages
DefaultApi packagesIdPriceGet GET /packages/{id}/price Get the estimated price of a Package
DefaultApi referenceCodesGet GET /reference-codes Return a list of valid Reference Codes
DefaultApi screeningsIdAdverseActionsPost POST /screenings/{id}/adverse-actions Create an adverse action on a Screening
DefaultApi screeningsIdDetailsGet GET /screenings/{id}/details Get a specific screening
DefaultApi screeningsIdDocumentsAttachmentIdGet GET /screenings/{id}/documents/{attachmentId} Get a Screening attachment in PDF form
DefaultApi screeningsIdDocumentsGet GET /screenings/{id}/documents
DefaultApi screeningsIdDocumentsPost POST /screenings/{id}/documents Attach a document to a Screening
DefaultApi screeningsIdGet GET /screenings/{id} Get a specific screening
DefaultApi screeningsIdInvitePost POST /screenings/{id}/invite Create an invite
DefaultApi screeningsIdReportGet GET /screenings/{id}/report Get a Screening report in PDF form
DefaultApi screeningsIdReportLinksPost POST /screenings/{id}/report-links Create a one-time use report link
DefaultApi screeningsIdReportPdfGet GET /screenings/{id}/report.pdf Get a Screening report in PDF form
DefaultApi screeningsPost POST /screenings Create a Screening
DefaultApi subscriptionsIdDelete DELETE /subscriptions/{id} Delete a subscription
DefaultApi subscriptionsIdEventsGet GET /subscriptions/{id}/events Get a list of events related to a given subscription
DefaultApi subscriptionsIdGet GET /subscriptions/{id} Get a subscription
DefaultApi subscriptionsPost POST /subscriptions Create a subscription
DefaultApi tokensPost POST /tokens Creates a temporary access token
DefaultApi trustedUsersIdGet GET /trusted-users/{id} Get trust information about a verified user
DefaultApi trustedUsersPost POST /trusted-users Trust a verified user
DefaultApi trustsIdDelete DELETE /trusts/{id} Untrust a Trusted User

Documentation For Models

Documentation For Authorization

jwt-authorizer

  • Type: OAuth
  • Flow: password
  • Authorization URL:
  • Scopes:
  • user: User Scope

Author

About

PHP SDK for Sterling's On Demand API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published