npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@eyzmedia/zohoapi

v2.0.1

Published

Zoho Utility functions like s3 based token management, module level operations

Downloads

3

Readme

zohoapi

Gateway library for easy access to Zoho V2 api

Purpose

This is a utility package for handling token mechanism of Zoho crm APIv2 across several projects. The module utilizes s3 as the storage mechanism of the oauth token.

Note: This currently works with local install of the module and not global

  1. Register a client to use with Zoho.
  2. Generate a self-authorized grant and refresh token as explained in the above link.
  3. Create a fill zoho_token.json with the following content and add the result you get in step 2.
{
	"access_token": "########",
	"expires_in": #######,
	"refresh_token":"##########"
}
  1. Create an s3 bucket or use an existing one and upload the file.

The module currently supports four operations - getRecords, getRecord, updateRecord and insertRecord.

Upon installation of the module, a .env file and resources folder containing two files - configuration.properties and oauth_configuration.properties are created in your project. Fill them based your AWS and Zoho credentials.

Install

Navigate to the root of your project folder and

npm install https://github.com/eyzhub/zohoapi.git  --save

Complete .env and files under resources

Usage examples

Zoho = require("zohoapi");
zoho =  new Zoho(); // optional enable debug messages | new Zoho( { debug: true } );
					// optional parallel execution | new Zoho( { records_batch_size: 5 } );
					// optional cache repeating calls | new Zoho( { cache: {} } );
					// trigger garbage collector and compress cache | new Zoho( { cache: {}, compress: true, gc: true } );
  1. Fetch records
let params = { module: "Accounts", page: 1, per_page: 2, has_subform: true };
let result = await zoho.getRecords(params);

if (result.records) {
	let records = result.records;
	console.log(records.length);
	// loop records
}

  1. Get a record
let result =  await zoho.getRecord("Offers", "1972094000016989067");
console.log(result);

if (result.record) {
	let record = result.record;
}
  1. Update a record
let data = [{ isan: "fooo-bar-nouse" }];
let result = await zoho.updateRecord("Filmv1", "1972094000017015005", data);

// should be 200
console.log(result.statusCode);
console.log(result.body);
  1. Insert record
let data = [{ isan: "fooo-bar-nouse", Name: "New film"}];
let result = await zoho.insertRecord("FilmV1", data);
console.log(result.body);
  1. Search records
let criteria = "(Product_Name:starts_with:Filmin DE)"
let params1 = { module: "Products", page: 1, per_page: 1, criteria: criteria };
let result1 = await zoho.searchRecords(params1);		
console.log(result1);
  1. Get all records
let params = { module: "Products"};
let result = await zoho.getAllRecords(params);

if (result.statusCode == 200) {
	let records = result.records;
	let relatedModules = result.related_modules;
	conso.log(relatedModules.length);
	console.log(records.length);
	// loop records
	// loop records of a relatedModule - relatedModules[0]["records"]
}

Note

  1. Use api names for the modules and field names (Tested).
  2. getAllRecords and getRecordsModifiedAfter return related modules of type multiselectlookup. To turn this off, set params.fetch_related = false
  3. subforms: To fectch subforms for all the data, use has_subform: true. To selecitvly get subform pass an object like this: where_subform: {key1: value1, key2: value2 ...}. This will be translated into (key1 == value1) && (key2 == value2)