PHP code example of monsieursloop / woleet-php-sdk
1. Go to this page and download the library: Download monsieursloop/woleet-php-sdk 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/ */
monsieursloop / woleet-php-sdk example snippets
nfigure HTTP basic authorization: BasicAuth
$config = WooletClient\Configuration::getDefaultConfiguration()
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
// Configure API key authorization: JWTAuth
$config = WooletClient\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = WooletClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new WooletClient\API\AnchorApi(
// 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 GuzzleHttp\Client(),
$config
);
$body = new \WooletClient\Model\Anchor(); // \WooletClient\Model\Anchor | Anchor object to create.
try {
$result = $apiInstance->createAnchor($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AnchorApi->createAnchor: ', $e->getMessage(), PHP_EOL;
}
// Configure HTTP basic authorization: BasicAuth
$config = WooletClient\Configuration::getDefaultConfiguration()
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
// Configure API key authorization: JWTAuth
$config = WooletClient\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = WooletClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new WooletClient\API\AnchorApi(
// 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 GuzzleHttp\Client(),
$config
);
$anchor_id = "anchor_id_example"; // string | Identifier of the anchor to delete.
try {
$apiInstance->deleteAnchor($anchor_id);
} catch (Exception $e) {
echo 'Exception when calling AnchorApi->deleteAnchor: ', $e->getMessage(), PHP_EOL;
}
// Configure HTTP basic authorization: BasicAuth
$config = WooletClient\Configuration::getDefaultConfiguration()
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
// Configure API key authorization: JWTAuth
$config = WooletClient\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = WooletClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new WooletClient\API\AnchorApi(
// 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 GuzzleHttp\Client(),
$config
);
$anchor_id = "anchor_id_example"; // string | Identifier of the anchor to retrieve.
try {
$result = $apiInstance->getAnchor($anchor_id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AnchorApi->getAnchor: ', $e->getMessage(), PHP_EOL;
}
// Configure HTTP basic authorization: BasicAuth
$config = WooletClient\Configuration::getDefaultConfiguration()
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
// Configure API key authorization: JWTAuth
$config = WooletClient\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = WooletClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new WooletClient\API\AnchorApi(
// 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 GuzzleHttp\Client(),
$config
);
$anchor_id = "anchor_id_example"; // string | Identifier of the anchor.
try {
$result = $apiInstance->getAnchorAttestation($anchor_id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AnchorApi->getAnchorAttestation: ', $e->getMessage(), PHP_EOL;
}
// Configure HTTP basic authorization: BasicAuth
$config = WooletClient\Configuration::getDefaultConfiguration()
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
// Configure API key authorization: JWTAuth
$config = WooletClient\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = WooletClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new WooletClient\API\AnchorApi(
// 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 GuzzleHttp\Client(),
$config
);
$page = 0; // int | Index of the page to retrieve (from 0).
$size = 20; // int | Number of anchor identifiers per page.
$hash = "hash_example"; // string | `hash` to search for: all public anchors whose `hash` property is equal are returned.
$signed_hash = "signed_hash_example"; // string | `signedHash` to search for: all public anchors whose `signedHash` property is equal are returned.
try {
$result = $apiInstance->searchAnchorIds($page, $size, $hash, $signed_hash);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AnchorApi->searchAnchorIds: ', $e->getMessage(), PHP_EOL;
}
// Configure HTTP basic authorization: BasicAuth
$config = WooletClient\Configuration::getDefaultConfiguration()
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
// Configure API key authorization: JWTAuth
$config = WooletClient\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = WooletClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new WooletClient\API\AnchorApi(
// 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 GuzzleHttp\Client(),
$config
);
$page = 0; // int | Index of the page to retrieve (from 0).
$size = 20; // int | Number of anchors per page.
$direction = "ASC"; // string | Sorting direction: ASC for ascending DESC for descending.
$sort = "created"; // string | Sorting property: possible values are limited to `created`, `hash` and `signedHash`.
$name = "name_example"; // string | `name` to search for: all anchors whose `name` property contains this sub-string are returned.<br> **WARNING: Searching by name can timeout on a large anchor set.**
$hash = "hash_example"; // string | `hash` to search for: all anchors whose `hash` property is equal are returned.
$signed_hash = "signed_hash_example"; // string | `signedHash` to search for: all anchors whose `signedHash` property is equal are returned.
$tags = array("tags_example"); // string[] | Tags to search for: all anchors having all of these tags sets are returned.
try {
$result = $apiInstance->searchAnchors($page, $size, $direction, $sort, $name, $hash, $signed_hash, $tags);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AnchorApi->searchAnchors: ', $e->getMessage(), PHP_EOL;
}
// Configure HTTP basic authorization: BasicAuth
$config = WooletClient\Configuration::getDefaultConfiguration()
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
// Configure API key authorization: JWTAuth
$config = WooletClient\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = WooletClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new WooletClient\API\AnchorApi(
// 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 GuzzleHttp\Client(),
$config
);
$body = new \WooletClient\Model\Anchor(); // \WooletClient\Model\Anchor | Anchor object to update.
$anchor_id = "anchor_id_example"; // string | Identifier of anchor to update.
try {
$result = $apiInstance->updateAnchor($body, $anchor_id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AnchorApi->updateAnchor: ', $e->getMessage(), PHP_EOL;
}