Giter Club home page Giter Club logo

yii2-zoho-api-client's Introduction

Yii2 Zoho REST API Client

A Client for Zoho RESTful API's

Powered By Yii2 Type

Packagist Version GitHub Packagist Stars GitHub top language Packagist Downloads GitHub stars GitHub last commit Maintenance saythanks

forthebadge

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist deadmantfa/yii2-zoho-api-client "^v1.0.x"

or add

"deadmantfa/yii2-zoho-api-client": "^v1.0.x"

to the require section of your composer.json file.

Configuration

Once the extension is installed, add it to your configuration :

Please note the redirect url for OAUTH2 to work properly, please add it to your client on Zoho before continuing further. Replace <YOUR_DOMAIN_NAME> with an actual domain or localhost

<YOUR_DOMAIN_NAME>/zoho/default/auth?authclient=zoho

In your params.php or params-local.php define the following

    'zoho-api-client-id' => '<ZOHO_API_CLIENT_ID>',
    'zoho-api-client-secret' => '<ZOHO_API_CLIENT_SECRET>',
    'zoho-organization-id' => '<ZOHO_ORGANIZATION_ID>',
    'zoho-redirect-uri' => '<YOUR_DOMAIN_NAME>/zoho/default/auth?authclient=zoho'

Add the following in one of these file

app/common/config/main.php or app/backend/config/main.php

    'modules' => [
        'zoho' => [
            'class' => \deadmantfa\yii2\zoho\Module::class,
        ],
    ],
    'components' => [
        'authClientCollection' => [
            'class' => \yii\authclient\Collection::class,
            'clients' => [
                'zoho' => [
                    'class' => \deadmantfa\yii2\zoho\auth\ZohoAuthClient::class,
                    'clientId' => $params['zoho-api-client-id'],
                    'clientSecret' => $params['zoho-api-client-secret'],
                    'returnUrl' => $params['zoho-redirect-uri'],
                ],
            ],
        ],
        'zoho'=> [
            'class' => \deadmantfa\yii2\zoho\components\ZohoApiClient::class,
            'apiBaseUrl'=>'https://inventory.zoho.com/api/v1/',
            'organizationId'=>$params['zoho-organization-id']
        ]
    ];  

For Migration add the following to

app/console/config/main.php

use yii\console\controllers\MigrateController;

    'controllerMap' => [
        'migrate' => [
            'class' => MigrateController::class,
            'migrationPath' => [
                '@app/migrations',
                '@yii/rbac/migrations', // Just in case you forgot to run it on console (see next note)
            ],
            'migrationNamespaces' => [
                'deadmantfa\yii2\zoho\migrations',
            ],
        ],
    ],

Then run the following command

./yii migrate

Usage

To use the zoho api we need to first authorize and generate access_token and refresh_token

(http://<YOUR_DOMAIN_NAME>/zoho)

Follow the screenshots below

Step 1

Step 2

Step 3

After generating the access token and refresh token you can now call any api which is provided by Zoho

Yii::$app->zoho->get('items', []);
Yii::$app->zoho->post('items', []);
Yii::$app->zoho->put('items', []);
Yii::$app->zoho->delete('items', []);

Zoho Rest API Documentation

Dependencies

yii2-zoho-api-client's People

Contributors

deadmantfa avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

vivekaris

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.