Skip to content

Instantly share code, notes, and snippets.

View dubeyji10's full-sized avatar
💭
Cogito, ergo sum

Abhishek Dubey dubeyji10

💭
Cogito, ergo sum
View GitHub Profile
@dubeyji10
dubeyji10 / insertConversation.py
Created May 17, 2022 07:34
insert using api into custom module named conversation
import requests
import json
'''
{{accounts-domain}}/crm/v2/{{custom-module-name}}
in this case conversation
'''
url = "https://www.zohoapis.in/crm/v2/conversation"
@dubeyji10
dubeyji10 / insertInvoiceInfo.py
Created May 17, 2022 11:18
for inserting data into invoice info
import requests
import json
'''
-> {{custom-module-name-2}} corressponds to invoice_info in postman client
dummy data insert into new custom module named invoice info
this is an auto increment field on invoice id
'''
@dubeyji10
dubeyji10 / sampleInsert_withNewAuthor.py
Created May 18, 2022 10:56
insert data but with different user
import requests
import json
'''
in this payload has a created by field in json with neccessary fields
so creation is done by that user
"Created_By": {
"name": "your-user-name",
@dubeyji10
dubeyji10 / insert_InvoiceItems.py
Created May 18, 2022 10:58
to insert invoice items using api
import requests
import json
url = "https://www.zohoapis.in/crm/v2/invoice_items"
payload = json.dumps({
"data": [
{
"Name": "00000000000000000003",
"Total_Months": 2,
@dubeyji10
dubeyji10 / cleaned_clients_json_example.json
Created May 19, 2022 12:17
example - json schema of clients
{
"id": 14,
"contact_person1": "Ajay Laddha",
"contact_person2": "",
"company_name": "Neha Collection",
"company_grade": "D",
"phone_no": null,
"mobile_no1": "7567369544",
"mobile_no2": null,
"email": "[email protected]",
@dubeyji10
dubeyji10 / prepareclientsjson.ipynb
Created May 19, 2022 12:17
prepareClientsJson.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dubeyji10
dubeyji10 / json_dumps.sql
Last active May 23, 2022 07:36
Creating json dumps of sql records - safer than extracting csv
/* example of clients table */
/* without use of json_object */
SELECT table2.* FROM ( SELECT 'Name', 'added_on', 'phone_no', 'local_id' , 'Email', 'clients_user_id' UNION ALL ( select company_name as Name,CONCAT(replace(DATE_FORMAT(added_on,'%Y-%m-%d %T'),' ','T'),"+05:30") as added_on,(select case when ifnull(phone_no,'') <> 0 then phone_no else '' end) as phone_no,id as local_id,email as Email,user_id as clients_user_id from clients ) ) table2;
set @json_file2 = (
select group_concat(table1.data1, table1.data2 ) from
(
select concat('{"','clients_user_id','"',':','"',user_id,'",') as data1 ,concat('"','Name','"',':','"',company_name,'"}',char(10)) as data2 from clients
@dubeyji10
dubeyji10 / sql_schema.sql
Created May 24, 2022 07:01
backup of db
/*
create a test db
use that db
to test and export sql dump
*/
/* create a table clients */
CREATE TABLE clients (
@dubeyji10
dubeyji10 / invoice_info_dumps.sql
Created May 24, 2022 10:54
invoice_info_dumps.sql
ALTER TABLE invoice_info CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
/* errors - - - - address field not validated */
set @json_ob_8 = (
select REGEXP_REPLACE(
GROUP_CONCAT(json_object (
'Name',CAST(id as CHAR),
'Address' ,Address,
'Email' ,Email ,
@dubeyji10
dubeyji10 / json_dumps_invoiceItems.sql
Created May 25, 2022 06:15
fixing of charset of tables
/* leads charset fixation */
ALTER TABLE leads CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
/* create a view to write out table of requirement*/
/* -------------------------------------------------- */
CREATE VIEW `leadsJsonView_2` AS
select
concat(
'{',
'"',