PHP code example of seregazhuk / favro-api
1. Go to this page and download the library: Download seregazhuk/favro-api 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/ */
seregazhuk / favro-api example snippets
// You may need to amend this path to locate composer's autoloader
com', 'test');
// set your organization
$favro->useOrganization("My Organization");
// get all collections
$result = $favro->collections->getAll();
// get your organizations
$result = $favro->organizations->getAll();
$organizations = $result['entities'];
// select the first organization
$favro->useOrganization($organizations[0]['organizationId']);
$result = $favro->getRateInfo();
print_r($result);
/*
[
'reset' => 2016-09-03T08:17:24.158Z
'remaining' => 42
'limit' => 50
]
*/
$result = $favro->users->getAll();
[
"limit": 100,
"page": 0,
"pages": 1,
"requestId": "8cc57b1d8a218fa639c8a0fa",
"entities": [
[
"userId": "67973f72db34592d8fc96c48",
"name": "Favro user",
"email": "[email protected] "
]
]
]
$result = $favro->users->getById($userId);
[
"userId": "67973f72db34592d8fc96c48",
"name": "Favro user",
"email": "[email protected] "
]
$result = $favro->organizations->getAll();
[
"limit": 100,
"page": 0,
"pages": 1,
"requestId": "8cc57b1d8a218fa639c8a0fa",
"entities": [
[
"organizationId" : "67973f72db34592d8fc96c48",
"name" : "My organization",
"sharedToUsers": [
[
"userId" : "fB6bJr5TbaKLiofns",
"role" : "administrator",
"joinDate" : "2016-02-10T14:25:58.745Z"
]
]
]
]
]
$result = $favro->organizations->getById($ogranizationId);
[
"organizationId" : "67973f72db34592d8fc96c48",
"name" : "My organization",
"sharedToUsers": [
[
"userId" : "fB6bJr5TbaKLiofns",
"role" : "administrator",
"joinDate" : "2016-02-10T14:25:58.745Z"
]
]
]
$result = $favro->organizations->create($attributes);
[
"organizationId" : "67973f72db34592d8fc96c48",
"name" : "My organization",
"sharedToUsers": [
[
"userId" : "fB6bJr5TbaKLiofns",
"role" : "administrator",
"joinDate" : "2016-02-10T14:25:58.745Z"
]
]
]
$result = $favro->organizations->update($organizationId, $attributes);
[
"organizationId" : "67973f72db34592d8fc96c48",
"name" : "My organization",
"sharedToUsers": [
[
"userId" : "fB6bJr5TbaKLiofns",
"role" : "administrator",
"joinDate" : "2016-02-10T14:25:58.745Z"
]
]
]
$result = $favro->collections->getAll();
[
"limit": 100,
"page": 0,
"pages": 1,
"requestId": "8cc57b1d8a218fa639c8a0fa",
"entities": [
[
"collectionId": "67973f72db34592d8fc96c48",
"organizationId": "zk4CJpg5uozhL4R2W",
"name": "My collection",
"sharedToUsers": [
[
"userId": "ff440e8f358c08513a86c8d6",
"role": "admin"
]
],
"publicSharing": "users",
"background": "purple",
"archived": false,
"shareWidgetsByDefault": true
]
]
]
$result = $favro->collections->getById($collectionId);
$result = $favro->collections->create($attributes);
$result = $favro->collections->update($collectionId, $attributes);
[
"collectionId": "67973f72db34592d8fc96c48",
"organizationId": "zk4CJpg5uozhL4R2W",
"name": "My collection",
"sharedToUsers": [
[
"userId": "ff440e8f358c08513a86c8d6",
"role": "admin"
]
],
"publicSharing": "users",
"background": "purple",
"archived": false,
"shareWidgetsByDefault": true
]
$result = $favro->collections->delete($collectionId);
$result = $favro->widgets->getAll();
[
"limit": 100,
"page": 0,
"pages": 1,
"requestId": "8cc57b1d8a218fa639c8a0fa",
"entities": [
[
"widgetCommonId": "67973f72db34592d8fc96c48",
"organizationId": "zk4CJpg5uozhL4R2W",
"collectionIds": [
"8cc57b1d8a218fa639c8a0fa"
],
"name": "This is a widget",
"type": "board",
"publicSharing": "collection",
"color": "purple",
"sharedToUsers": [
[
"userId": "tXfWe3MXQqhnnTRtw",
"role": "view"
]
]
]
]
]
$result = $favro->widgets->getById($widgetCommonId);
[
"widgetCommonId": "67973f72db34592d8fc96c48",
"organizationId": "zk4CJpg5uozhL4R2W",
"collectionIds": [
"8cc57b1d8a218fa639c8a0fa"
],
"name": "This is a widget",
"type": "board",
"publicSharing": "collection",
"color": "purple",
"sharedToUsers": [
[
"userId": "tXfWe3MXQqhnnTRtw",
"role": "view"
]
]
]
$result = $favro->widgets->create($attributes);
[
"widgetCommonId": "67973f72db34592d8fc96c48",
"organizationId": "zk4CJpg5uozhL4R2W",
"collectionIds": [
"8cc57b1d8a218fa639c8a0fa"
],
"name": "This is a widget",
"type": "board",
"publicSharing": "collection",
"color": "purple",
"sharedToUsers": [
[
"userId": "tXfWe3MXQqhnnTRtw",
"role": "view"
]
]
]
$result = $favro->widgets->update($widgetCommonId, $attributes);
[
"widgetCommonId": "67973f72db34592d8fc96c48",
"organizationId": "zk4CJpg5uozhL4R2W",
"collectionIds": [
"8cc57b1d8a218fa639c8a0fa"
],
"name": "This is a widget",
"type": "board",
"publicSharing": "collection",
"color": "purple",
"sharedToUsers": [
[
"userId": "tXfWe3MXQqhnnTRtw",
"role": "view"
]
]
]
$favro->widgets->delete($widgetCommonId);
// or
$favro->widgets->delete($widgetCommonId, $collectionId);
$result = $favro->columns->getAll($widgetCommonId);
[
"limit": 100,
"page": 0,
"pages": 1,
"requestId": "8cc57b1d8a218fa639c8a0fa",
"entities": [
[
"columnId": "67973f72db34592d8fc96c48",
"organizationId": "zk4CJpg5uozhL4R2W",
"widgetCommonId": "ff440e8f358c08513a86c8d6",
"name": "This is a column",
"position": 0
]
]
]
$result = $favro->columns->getById($columnId);
[
"columnId": "67973f72db34592d8fc96c48",
"organizationId": "zk4CJpg5uozhL4R2W",
"widgetCommonId": "ff440e8f358c08513a86c8d6",
"name": "This is a column",
"position": 0
]
$result = $favro->columns->create($attributes);
[
"columnId": "67973f72db34592d8fc96c48",
"organizationId": "zk4CJpg5uozhL4R2W",
"widgetCommonId": "ff440e8f358c08513a86c8d6",
"name": "This is a column",
"position": 0
]
$result = $favro->columns->update($columnId, $attributes);
[
"columnId": "67973f72db34592d8fc96c48",
"organizationId": "zk4CJpg5uozhL4R2W",
"widgetCommonId": "ff440e8f358c08513a86c8d6",
"name": "This is a column",
"position": 0
]
$result = $favro->columns->delete($columnId);
$result = $favro->cards->getAll($params);
[
"limit": 100,
"page": 0,
"pages": 1,
"requestId": "8cc57b1d8a218fa639c8a0fa",
"entities": [
[
"cardId": "67973f72db34592d8fc96c48",
"organizationId": "zk4CJpg5uozhL4R2W",
"widgetCommonId": "ff440e8f358c08513a86c8d6",
"columnId": "b4d8c6283d9d58f9a39108e7",
"name": "This is a card"
]
]
]
$result = $favro->cards->get($cardId);
[
"cardId": "67973f72db34592d8fc96c48",
"organizationId": "zk4CJpg5uozhL4R2W",
"widgetCommonId": "ff440e8f358c08513a86c8d6",
"columnId": "b4d8c6283d9d58f9a39108e7",
"name": "This is a card"
]
$result = $favro->cards->create($attributes);
[
"cardId": "67973f72db34592d8fc96c48",
"organizationId": "zk4CJpg5uozhL4R2W",
"widgetCommonId": "ff440e8f358c08513a86c8d6",
"columnId": "b4d8c6283d9d58f9a39108e7",
"name": "This is a card"
]
$result = $favro->cards->update($cardId, $attributes);
[
"cardId": "67973f72db34592d8fc96c48",
"organizationId": "zk4CJpg5uozhL4R2W",
"widgetCommonId": "ff440e8f358c08513a86c8d6",
"columnId": "b4d8c6283d9d58f9a39108e7",
"name": "This is a card"
]
$result = $favro->cards->delete($cardId, $everyWhere);
[
"67973f72db34592d8fc96c48",
"67973f72db34592d8fc96c49",
"67973f72db34592d8fc96c50"
]
$result = $favro->tags->getAll($params);
[
"limit": 100,
"page": 0,
"pages": 1,
"requestId": "8cc57b1d8a218fa639c8a0fa",
"entities": [
[
"tagId": "67973f72db34592d8fc96c48",
"organizationId": "zk4CJpg5uozhL4R2W",
"name": "My tag",
"color": "purple"
]
]
]
$result = $favro->tags->get($tagId);
[
"tagId": "67973f72db34592d8fc96c48",
"organizationId": "zk4CJpg5uozhL4R2W",
"name": "My tag",
"color": "purple"
]
$result = $favro->tags->create($attributes);
[
"tagId": "67973f72db34592d8fc96c48",
"organizationId": "zk4CJpg5uozhL4R2W",
"name": "My tag",
"color": "purple"
]
$result = $favro->tags->update($tagId, $attributes);
[
"tagId": "67973f72db34592d8fc96c48",
"organizationId": "zk4CJpg5uozhL4R2W",
"name": "My tag",
"color": "purple"
]
$result = $favro->tags->delete($tagId);
$result = $favro->tasks->getAll($params);
[ "limit": 100,
"page": 0,
"pages": 1,
"requestId": "8cc57b1d8a218fa639c8a0fa",
"entities": [
[
"taskId": "67973f72db34592d8fc96c48",
"taskListId": "8cc57b1d8a218fa639c8a0fa",
"organizationId": "zk4CJpg5uozhL4R2W",
"cardCommonId": "tXfWe3MXQqhnnTRtw",
"name": "This is a task",
"completed": false,
"position": 0
]
]
]
$result = $favro->tasks->get($taskId);
[
"taskId": "67973f72db34592d8fc96c48",
"taskListId": "8cc57b1d8a218fa639c8a0fa",
"organizationId": "zk4CJpg5uozhL4R2W",
"cardCommonId": "tXfWe3MXQqhnnTRtw",
"name": "This is a task",
"completed": false,
"position": 0
]
$result = $favro->tasks->create($attributes);
[
"taskId": "67973f72db34592d8fc96c48",
"taskListId": "8cc57b1d8a218fa639c8a0fa",
"organizationId": "zk4CJpg5uozhL4R2W",
"cardCommonId": "tXfWe3MXQqhnnTRtw",
"name": "This is a task",
"completed": false,
"position": 0
]
$result = $favro->tasks->update($taskId, $attributes);
[
"taskId": "67973f72db34592d8fc96c48",
"taskListId": "8cc57b1d8a218fa639c8a0fa",
"organizationId": "zk4CJpg5uozhL4R2W",
"cardCommonId": "tXfWe3MXQqhnnTRtw",
"name": "This is a task",
"completed": false,
"position": 0
]
$result = $favro->tasks->delete($taskId);
$result = $favro->tasklists->getAll($cardCommonId);
[
"limit": 100,
"page": 0,
"pages": 1,
"requestId": "8cc57b1d8a218fa639c8a0fa",
"entities": [
[
"taskListId": "8cc57b1d8a218fa639c8a0fa",
"organizationId": "zk4CJpg5uozhL4R2W",
"cardCommonId": "tXfWe3MXQqhnnTRtw",
"description": "This is a tasklist",
"position": 0
]
]
]
$result = $favro->tasklists->get($taskListId);
[
"taskListId": "8cc57b1d8a218fa639c8a0fa",
"organizationId": "zk4CJpg5uozhL4R2W",
"cardCommonId": "tXfWe3MXQqhnnTRtw",
"description": "This is a tasklist",
"position": 0
]
$result = $favro->tasklists->create($attributes);
[
"taskListId": "8cc57b1d8a218fa639c8a0fa",
"organizationId": "zk4CJpg5uozhL4R2W",
"cardCommonId": "tXfWe3MXQqhnnTRtw",
"description": "This is a tasklist",
"position": 0
]
$result = $favro->tasklists->update($taskListId, $attributes);
[
"taskListId": "8cc57b1d8a218fa639c8a0fa",
"organizationId": "zk4CJpg5uozhL4R2W",
"cardCommonId": "tXfWe3MXQqhnnTRtw",
"description": "This is a tasklist",
"position": 0
]
$result = $favro->tasklists->delete($taskListId);
$result = $favro->comments->getAll($cardCommonId);
"limit": 100,
"page": 0,
"pages": 1,
"requestId": "8cc57b1d8a218fa639c8a0fa",
"entities": [
[
"commentId": "67973f72db34592d8fc96c48",
"cardCommonId": "ff440e8f358c08513a86c8d6",
"organizationId": "zk4CJpg5uozhL4R2W",
"userId": "b4d8c6283d9d58f9a39108e7",
"comment": "This is a comment",
"created": "2016-04-18T11:18:42.901Z",
"lastUpdated": "2016-04-18T11:18:42.901Z"
]
]
$result = $favro->comments->get($commentId);
[
"commentId": "67973f72db34592d8fc96c48",
"cardCommonId": "ff440e8f358c08513a86c8d6",
"organizationId": "zk4CJpg5uozhL4R2W",
"userId": "b4d8c6283d9d58f9a39108e7",
"comment": "This is a comment",
"created": "2016-04-18T11:18:42.901Z",
"lastUpdated": "2016-04-18T11:18:42.901Z"
]