PHP code example of carerix / cxrest-client

1. Go to this page and download the library: Download carerix/cxrest-client 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/ */

    

carerix / cxrest-client example snippets


use Carerix\Api\Rest\Client;
use Carerix\Api\Rest\Manager;
use Carerix\Api\Rest\Entity;

$client = new Client();

$manager = new Manager($client);
$manager->autoDiscoverEntities();

$manager->setUsername(CUSTOMER_NAME);
$manager->setPassword(API_TOKEN);

Entity::setManager($manager);

use Carerix\Api\Rest\Entity\CREmployee;
use Carerix\Api\Rest\Entity\CRUser;

// get user by ID
$user = CRUser::find(125);

// apply for a job
$params = array('x-cx-pub' => PUBLICATION_ID_GOES_HERE);

$employee = new CREmployee();
$employee
    ->setFirstName('John')
    ->setLastName('Smith');
$employee->apply($params);