PHP code example of zibios / wrike-php-library
1. Go to this page and download the library: Download zibios/wrike-php-library 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/ */
zibios / wrike-php-library example snippets
/**
* Resources access methods
*/
$api = ApiFactory::create(<PermanentToken>); // @see zibios/wrike-php-sdk
$api->account()->getAll();
$api->account()->updateDefault($params);
$api->attachments()->getAll();
$api->attachments()->getAllForFolder($folderId);
$api->attachments()->getAllForTask($taskId);
$api->attachments()->getById($attachmentId);
$api->attachments()->getByIds([$attachmentId]);
$api->attachments()->update($attachmentId, $params);
$api->attachments()->uploadForFolder($attachmentId, $params);
$api->attachments()->uploadForTask($attachmentId, $params);
$api->attachments()->delete($attachmentId);
$api->attachments()->download($attachmentId);
$api->attachments()->downloadPreview($attachmentId);
$api->attachments()->getPublicUrl($attachmentId);
$api->colors()->getAll();
$api->comments()->getAll();
$api->comments()->getAllForFolder($folderId);
$api->comments()->getAllForTask($taskId);
$api->comments()->getById($commentId);
$api->comments()->getByIds([$commentId]);
$api->comments()->update($commentId, $params);
$api->comments()->createForFolder($folderId, $params);
$api->comments()->createForTask($taskId, $params);
$api->comments()->delete($commentId);
$api->contacts()->getAll();
$api->contacts()->getById($contactId);
$api->contacts()->getByIds([$contactId]);
$api->contacts()->update($contactId, $params);
$api->customFields()->getAll();
$api->customFields()->getById($customFieldId);
$api->customFields()->getByIds([$customFieldId]);
$api->customFields()->update($customFieldId, $params);
$api->customFields()->create($params);
$api->dependencies()->getAllForTask($taskId);
$api->dependencies()->getById($dependencyId);
$api->dependencies()->getByIds([$dependencyId]);
$api->dependencies()->update($dependencyId, $params);
$api->dependencies()->createForTask($taskId, $params);
$api->dependencies()->delete($dependencyId);
$api->folders()->getAll();
$api->folders()->getAllForFolder($folderId);
$api->folders()->getById($folderId);
$api->folders()->getByIds([$folderId]);
$api->folders()->update($folderId, $params);
$api->folders()->createForFolder($folderId, $params);
$api->folders()->copy($folderId, $params);
$api->folders()->delete($folderId);
$api->groups()->getAll();
$api->groups()->getById($groupId);
$api->groups()->update($groupId, $params);
$api->groups()->create($params);
$api->groups()->delete($groupId);
$api->ids()->getAll($params); // $params
/**
* Params normalizer
*/
$params = $api->normalizeParams([
'foo' => 'test',
'bar' => ['test' => 'test'],
]);
// Array
// (
// [foo] => test
// [bar] => {"test":"test"}
// )
/**
* Basic API usage
*/
$params = $api->normalizeParams([
'fields' => ['metadata'],
'metadata' => ['key' => 'importantMetadataKey'],
]);
$allContacts = $api->contacts()->getAll($params);
$params = $api->normalizeParams([
'metadata' => [
[
'key' => 'metadataKey',
'value' => 'metadataValue',
]
],
]);
$updatedContact = $api->contacts()->update($contactId, $params);
/**
* Upload Attachment Request ams([
'resource' => fopen(__FILE__, 'rb'),
'name' => 'name.png',
]);
$updatedContact = $api->attachments()->uploadForFolder($folderId, $params);
$updatedContact = $api->attachments()->uploadForTask($taskId, $params);
/**
* Download Attachment Requests returns none transformed Psr\Http\Message\ResponseInterface
*/
$response = $api->attachments()->download($attachmentId);
$response = $api->attachments()->downloadPreview($attachmentId);
/**
* Advanced API usage
*
* $api->recreateForNew*() - returns new Api instance
*/
$api = ApiFactory::create(<PermanentToken>); // @see zibios/wrike-php-sdk
$newApi = $api->recreateForNewAccessToken(<PermanentToken>);
$responseTransformer = new RawResponseTransformer();
$newApi = $api->recreateForNewResponseTransformer($responseTransformer);
$apiExceptionTransformer = new RawExceptionTransformer();
$newApi = $api->recreateForNewApiExceptionTransformer($apiExceptionTransformer);
bash
git clone [email protected] :zibios/wrike-php-library.git
cd wrike-php-library