PHP code example of wedesignit / hotelprofessionals-api-client

1. Go to this page and download the library: Download wedesignit/hotelprofessionals-api-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/ */

    

wedesignit / hotelprofessionals-api-client example snippets


use WeDesignIt\HotelprofessionalsApiClient\Client;
use WeDesignIt\HotelprofessionalsApiClient\Hotelprofessionals;

// Can be obtained through HP.
$apiKey = "2|xyzthisapikeywontwork";
// Establish the connection.
$client = Client::init($apiKey);
$hp = Hotelprofessionals::init($client);

// Quick check if everything is properly setup.
$hp->authenticate();

$client = Client::init($apiKey, 'https://integratie.hotelprofessionals.nl/api/v1/')

$client = Client::init($apiKey, 'https://integratie.hotelprofessionals.nl/api/v1/', [
    'basicAuth' => 'yourBasicAuthSecret',
])

var_dump(urldecode($request->getRequestTarget()))

$client = Client::init($apiKey, 'https://integratie.hotelprofessionals.nl/api/v1/', [
    'debugMode' => true,
])

// list all available department categories
$hp->departmentCategory()->list();
// get a specific department category
$hp->departmentCategory()->show(1449);

// list all available Departments
$hp->department()->list();
// get a specific department
$hp->department()->show(56);

// list all available occupations
$hp->occupation()->list();
// get a specific occupation
$hp->occupation()->show(739);

// list all available experiences
$hp->experience()->list();
// get a specific experiences
$hp->experience()->show(1449);

// list all available languages
$hp->language()->list();
// get a specific languages
$hp->language()->show(1449);

// list all available education
$hp->education()->list();
// get a specific education
$hp->education()->show(1449);

// list all available employment types
$hp->employmentType()->list();
// get a specific employment type
$hp->employmentType()->show(1449);

// list all available function features
$hp->functionFeature()->list();
// get a specific function feature
$hp->functionFeature()->show(1449);

// list all available countries
$hp->country()->list();
// get a specific country
$hp->country()->show(149);

// list all available Employers
$hp->employer()->list();
// get a specific Employer
$hp->employer()->show(432);

// list all job listings (including for sub account(s) if current account is a parent)
$hp->jobListing()->list();

// get a specific job listing
$jobListingResource = $hp->jobListing()->show(10552);

// store a job listing (see documentation for full structure)
$attributes = [
    'job_listings' => [
        'title' => [
            'nl' => 'Nieuwe vacature', 
            'en' => 'New job listing', 
        ]    
    ],
];
$newJobListingResource = $hp->jobListing()->store($attributes);
$newId = $newJobListingResource['data']['id'];

// update a job listing
$attributes['title']['en'] = 'New job listing title, in the English locale';
$updatedJobListingResource = $hp->jobListing()->update($newId, $attributes);

// publish a job listing (if not already published)
$hp->jobListing()->publish(10552);

// delete a job listing (generally not recommended)
$hp->jobListing()->delete($newId);

// return page 3 of the department list.
$hp->department()->page(3)->list();

// Main array holds sub-arrays:
$filters = [
    [
        // The column to filter on. Required.
        'column' => $columnToFilter, 
        // The value to apply. Required.
        'value' => $valueToFilter,
        // The delimiter for filtering. Optional, defaults to '='.
        'delimiter' => '=',  
    ],
];
 

$filters = [
    [
        'column' => 'status',
        'value' => 'published',
        'delimiter' => '=',
    ],
];

$hp->jobListing()->filter($filters)->list();