{"id":85810,"date":"2018-06-20T13:52:54","date_gmt":"2018-06-20T13:52:54","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/active-collab-api\/"},"modified":"2018-06-20T14:05:52","modified_gmt":"2018-06-20T14:05:52","slug":"active-collab-api","status":"closed","type":"plugin","link":"https:\/\/wordpress.org\/plugins\/active-collab-api\/","author":16149594,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"0.1","stable_tag":"trunk","tested":"","requires":"","requires_php":"","requires_plugins":"","header_name":"Active Collab API","header_author":"Raja Dileep Kumar","header_description":"Integration Activecollab","assets_banners_color":"","last_updated":"2018-06-20 14:05:52","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/www.github.com\/rajadileepkumar","header_author_uri":"https:\/\/utthunga.com","rating":5,"author_block_rating":0,"active_installs":0,"downloads":708,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["installation","description","faq"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":"1"},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":[],"screenshots":[]},"plugin_section":[],"plugin_tags":[],"plugin_category":[],"plugin_contributors":[],"plugin_business_model":[],"class_list":["post-85810","plugin","type-plugin","status-closed","hentry","plugin_committers-dileepkumarraja"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/active-collab-api.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=installation-->\n<p>If you choose to install this application with Composer instead of pulling down the git repository you will need to add a composer.json file to the location you would like to pull the repository down to featuring:<\/p>\n\n<pre><code>`json\n<\/code><\/pre>\n\n<p>{\n    \"require\": {\n        \"activecollab\/activecollab-feather-sdk\": \"^3.0\"\n    }\n}\n    `<\/p>\n\n<p>Run a <code>composer update<\/code> to install the package.<\/p>\n\n<p><em>Note<\/em>: If you used an older version of Active Collab API wrapper and loaded it using <code>dev-master<\/code>, lock it to version 2.0 by setting require statement to <code>^2.0<\/code> and calling <code>composer update<\/code>.<\/p>\n\n<!--section=description-->\n<h3>Connecting to Active Collab Cloud Accounts<\/h3>\n\n<pre><code>`php\n<\/code><\/pre>\n\n<p>&lt;?php<\/p>\n\n<p>require_once '\/path\/to\/vendor\/autoload.php';<\/p>\n\n<p>\/\/ Provide name of your company, name of the app that you are developing, your email address and password.\n$authenticator = new \\ActiveCollab\\SDK\\Authenticator\\Cloud('ACME Inc', 'My Awesome Application', 'you@acmeinc.com', 'hard to guess, easy to remember');<\/p>\n\n<p>\/\/ Show all Active Collab 5 and up account that this user has access to.\nprint_r($authenticator-&gt;getAccounts());<\/p>\n\n<p>\/\/ Show user details (first name, last name and avatar URL).\nprint_r($authenticator-&gt;getUser());<\/p>\n\n<p>\/\/ Issue a token for account #123456789.\n$token = $authenticator-&gt;issueToken(123456789);<\/p>\n\n<p>\/\/ Did we get it?\nif ($token instanceof \\ActiveCollab\\SDK\\TokenInterface) {\n    print $token-&gt;getUrl() . \"\\n\";\n    print $token-&gt;getToken() . \"\\n\";\n} else {\n    print \"Invalid response\\n\";\n    die();\n}\n    <code>&lt;h3&gt;Connecting to Self-Hosted Active Collab Accounts&lt;\/h3&gt;<\/code>php\nrequire_once '\/path\/to\/vendor\/autoload.php';<\/p>\n\n<p>\/\/ Provide name of your company, name of the app that you are developing, your email address and password. Last parameter is URL where your Active Collab is installed.\n$authenticator = new \\ActiveCollab\\SDK\\Authenticator\\SelfHosted('ACME Inc', 'My Awesome Application', 'you@acmeinc.com', 'hard to guess, easy to remember', 'https:\/\/my.company.com\/projects');<\/p>\n\n<p>\/\/ Issue a token.\n$token = $authenticator-&gt;issueToken();<\/p>\n\n<p>\/\/ Did we get what we asked for?\nif ($token instanceof \\ActiveCollab\\SDK\\TokenInterface) {\n    print $token-&gt;getUrl() . \"\\n\";\n    print $token-&gt;getToken() . \"\\n\";\n} else {\n    print \"Invalid response\\n\";\n    die();\n}\n    `<\/p>\n\n<h3>SSL problems?<\/h3>\n\n<p>If curl complains that SSL peer verification has failed, you can turn it off like this:<\/p>\n\n<pre><code>`php\n<\/code><\/pre>\n\n<p>\/\/ Cloud\n$authenticator = new \\ActiveCollab\\SDK\\Authenticator\\Cloud('ACME Inc', 'My Awesome Application', 'you@acmeinc.com', 'hard to guess, easy to remember', false);\n$authenticator-&gt;setSslVerifyPeer(false);<\/p>\n\n<p>\/\/ Self-hosted\n$authenticator = new \\ActiveCollab\\SDK\\Authenticator\\SelfHosted('ACME Inc', 'My Awesome Application', 'you@acmeinc.com', 'hard to guess, easy to remember', 'https:\/\/my.company.com\/projects', false);\n$authenticator-&gt;setSslVerifyPeer(false);<\/p>\n\n<p>\/\/ Client\n$client = new \\ActiveCollab\\SDK\\Client($token);\n$client-&gt;setSslVerifyPeer(false);\n    `<\/p>\n\n<p><strong>Note:<\/strong> Option to turn off SSL peer verification has been added in Active Collab SDK 3.1.<\/p>\n\n<h3>Constructing a client instance<\/h3>\n\n<p>Once we have our token, we can construct a client and make API calls:<\/p>\n\n<pre><code>`php\n<\/code><\/pre>\n\n<p>$client = new \\ActiveCollab\\SDK\\Client($token);\n    `<\/p>\n\n<p>Listing all tasks in project #65 is easy. Just call:<\/p>\n\n<pre><code>`php\n<\/code><\/pre>\n\n<p>$client-&gt;get('projects\/65\/tasks');\n    `<\/p>\n\n<p>To create a task, simply send a POST request:<\/p>\n\n<pre><code>`php\n<\/code><\/pre>\n\n<p>try {\n    $client-&gt;post('projects\/65\/tasks', [\n      'name' =&gt; 'This is a task name',\n      'assignee_id' =&gt; 48\n    ]);\n} catch(AppException $e) {\n    print $e-&gt;getMessage() . '<br \/><br \/>';\n    \/\/ var_dump($e-&gt;getServerResponse()); (need more info?)\n}\n    `<\/p>\n\n<p>To update a task, PUT request will be needed:<\/p>\n\n<pre><code>`php\n<\/code><\/pre>\n\n<p>try {\n    $client-&gt;put('projects\/65\/tasks\/123', [\n        'name' =&gt; 'Updated named'\n    ]);\n} catch(AppException $e) {\n    print $e-&gt;getMessage() . '<br \/><br \/>';\n    \/\/ var_dump($e-&gt;getServerResponse()); (need more info?)\n}\n    `<\/p>\n\n<pre><code>post()`` and ``put()`` methods can take two arguments:\n<\/code><\/pre>\n\n<ol>\n<li><code>command<\/code> (required) - API command,<\/li>\n<li><code>variables<\/code> - array of request variables (payload)<\/li>\n<\/ol>\n\n<p>To remove a task, call:<\/p>\n\n<pre><code>`php\n<\/code><\/pre>\n\n<p>try {\n    $client-&gt;delete('projects\/65\/tasks\/123');\n} catch(AppException $e) {\n    print $e-&gt;getMessage() . '<br \/><br \/>';\n    \/\/ var_dump($e-&gt;getServerResponse()); (need more info?)\n}\n    `<\/p>\n\n<pre><code>delete()`` method only requires ``command`` argument to be provided.\n<\/code><\/pre>\n\n<p>For full list of available API command, please check <a href=\"https:\/\/developers.activecollab.com\/api-documentation\/\">Active Collab API documentation<\/a>.<\/p>\n\n<!--section=faq-->\n<dl>\n<dt>Installation Instructions<\/dt>\n<dd><p>If you choose to install this application with Composer instead of pulling down the git repository you will need to add a composer.json file to the location you would like to pull the repository down to featuring:<\/p>\n\n<pre><code>`json\n<\/code><\/pre>\n\n<p>{\n    \"require\": {\n        \"activecollab\/activecollab-feather-sdk\": \"^3.0\"\n    }\n}\n    `<\/p>\n\n<p>Run a <code>composer update<\/code> to install the package.<\/p>\n\n<p><em>Note<\/em>: If you used an older version of Active Collab API wrapper and loaded it using <code>dev-master<\/code>, lock it to version 2.0 by setting require statement to <code>^2.0<\/code> and calling <code>composer update<\/code>.<\/p><\/dd>\n\n<\/dl>","raw_excerpt":"Connecting to Active Collab Cloud Accounts","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/85810","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=85810"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/dileepkumarraja"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=85810"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=85810"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=85810"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=85810"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=85810"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=85810"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}