PhonebookApi - PHP client for Messente Phonebook API
PHP 5.5 and later
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/messente/messente-phonebook-php.git"
}
],
"require": {
"messente/messente-phonebook-php": "*@master"
}
}
Then run composer install
Download the files and include autoload.php
:
require_once('/vendor/autoload.php');
To run the unit tests:
composer install
./vendor/bin/phpunit
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
use Messente\Phonebook\Configuration;
use Messente\Phonebook\Api\BlacklistApi;
use GuzzleHttp\Client;
// Configure HTTP basic authorization: basicAuth
$config = Configuration::getDefaultConfiguration()
->setUsername('YOUR_MESSENTE_API_USERNAME')
->setPassword('YOUR_MESSENTE_API_PASSWORD');
$apiInstance = new BlacklistApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new Client(),
$config
);
try {
$response = $apiInstance->fetchBlacklist();
echo $response;
} catch (Exception $e) {
echo 'Exception when calling fetchBlacklist: ', $e->getMessage(), PHP_EOL;
}
// try {
// $apiInstance->addToBlacklist(['phoneNumber' => '+37255555555']);
// } catch (Exception $e) {
// echo 'Exception when calling addToBlacklist: ', $e->getMessage(), PHP_EOL;
// }
// try {
// $apiInstance->isBlacklisted('+37255555555');
// } catch (Exception $e) {
// echo 'Exception when calling isBlacklisted: ', $e->getMessage(), PHP_EOL;
// }
// try {
// $apiInstance->removeFromBlacklist('+37255555555');
// } catch (Exception $e) {
// echo 'Exception when calling removeFromBlacklist: ', $e->getMessage(), PHP_EOL;
// }
?>
All URIs are relative to https://api.messente.com/v1
Class | Method | HTTP request |
---|---|---|
BlacklistApi | addToBlacklist | POST /phonebook/blacklist |
BlacklistApi | fetchBlacklist | GET /phonebook/blacklist |
BlacklistApi | isBlacklisted | GET /phonebook/blacklist/{phone_number} |
BlacklistApi | removeFromBlacklist | DELETE /phonebook/blacklist/{phone_number} |
- ErrorItem
- ErrorResponse
- FetchBlacklistSuccess
- NumberToBlacklist
- ResponseErrorCode
- ResponseErrorTitle
- Type: HTTP basic authentication