#$Id$# from books.model.CreditNote import CreditNote from books.model.Address import Address from books.model.Email import Email from books.model.LineItem import LineItem from books.model.CreditNoteRefund import CreditNoteRefund from books.model.Comment import Comment from books.model.Invoice import Invoice from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") credit_notes_api = zoho_books.get_creditnotes_api() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() param = {'status': 'open'} credit_note_id = credit_notes_api.get_credit_notes(param).get_creditnotes()[0].get_creditnote_id() contact_api = zoho_books.get_contacts_api() contact_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() contact_person_api = zoho_books.get_contact_persons_api() contact_persons_id = contact_person_api.get_contact_persons(contact_id).get_contact_persons()[0].get_contact_person_id() invoice_api = zoho_books.get_invoices_api() invoice_id = invoice_api.get_invoices().get_invoices()[0].get_invoice_id() items_api = zoho_books.get_items_api() item_id = items_api.list_items().get_items()[0].get_item_id() template_id = credit_notes_api.list_credit_note_template()[0].get_template_id()
#$Id$# from books.model.Journal import Journal from books.model.LineItem import LineItem from books.service.ZohoBooks import ZohoBooks import os access_token = os.environ.get('ACCESS_TOKEN') organization_id = os.environ.get('ORGANIZATION_ID') zoho_books = ZohoBooks(access_token, organization_id) journal_api = zoho_books.get_journals_api() journal_id = journal_api.get_journals().get_journals()[0].get_journal_id() param = {'filter_by': 'AccountType.Expense'} chart_of_accounts_api = zoho_books.get_chart_of_accounts_api() expense_account_id = chart_of_accounts_api.get_chart_of_accounts( param).get_chartofaccounts()[1].get_account_id() # get journal list parameter = {'total_less_than': 100.0} #print journal_api.get_journals() print journal_api.get_journals(parameter) # get journal print journal_api.get(journal_id) #create a journal
#$Id$# #auggie from books.model.Contact import Contact from books.model.Email import Email from books.model.Address import Address from books.model.ContactPerson import ContactPerson from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") contact_api = zoho_books.get_contacts_api() contact_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() settings_api = zoho_books.get_settings_api() currency_id = settings_api.get_currencies().get_currencies()[0].get_currency_id() # to list contacts parameter = {'sort_column':'last_name'} print contact_api.get_contacts(parameter) # to get a contact print contact_api.get(contact_id) # to create contact contact = Contact() contact.set_contact_name('anin') contact.set_payment_terms(15) contact.set_payment_terms_label('Net 15')
from books.model.EstimateSetting import EstimateSetting from books.model.CreditnoteSetting import CreditnoteSetting from books.model.Currency import Currency from books.model.ExchangeRate import ExchangeRate from books.model.Tax import Tax from books.model.OpeningBalance import OpeningBalance from books.model.Account import Account from books.model.Autoreminder import Autoreminder from books.model.ManualReminder import ManualReminder from books.model.TaxGroup import TaxGroup from books.service.ZohoBooks import ZohoBooks import os access_token = os.environ.get('ACCESS_TOKEN') organization_id = os.environ.get('ORGANIZATION_ID') zoho_books = ZohoBooks(access_token, organization_id) settings_api = zoho_books.get_settings_api() organizations_api = zoho_books.get_organizations_api() users_api = zoho_books.get_users_api() items_api = zoho_books.get_items_api() currency_id = settings_api.get_currencies().get_currencies()[0].get_currency_id() #List preferences print settings_api.list_preferences() #Update preference preference = Preference() preference.set_convert_to_invoice(False)
#$Id$# from books.model.ContactPerson import ContactPerson from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") contact_person_api = zoho_books.get_contact_persons_api() contact_api = zoho_books.get_contacts_api() contact_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() contact_person_id = contact_person_api.get_contact_persons( contact_id).get_contact_persons()[0].get_contact_person_id() #list contact persons print contact_person_api.get_contact_persons(contact_id) #get contact person details print contact_person_api.get(contact_person_id) # create contact person d = ContactPerson() d.set_salutation('Mr') d.set_first_name('bata') d.set_last_name('kumar') d.set_email('*****@*****.**') d.set_phone('999887')
#$Id$# from books.model.Invoice import Invoice from books.model.Address import Address from books.model.Email import Email from books.model.LineItem import LineItem from books.model.PaymentGateway import PaymentGateway from books.model.CustomField import CustomField from books.model.PaymentAndCredit import PaymentAndCredit from books.model.InvoicePayment import InvoicePayment from books.model.InvoiceCredited import InvoiceCredited from books.model.Comment import Comment from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") invoice_api = zoho_books.get_invoices_api() #invoice_id = invoice_api.get_invoices().get_invoices()[0].get_invoice_id() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() contact_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() invoice_ids = invoice_api.get_invoices().get_invoices()[0].get_invoice_id( ) + ',' + invoice_api.get_invoices().get_invoices()[1].get_invoice_id() ''' template_id = invoice_api.list_invoice_templates().get_templates()[0].get_template_id() ''' items_api = zoho_books.get_items_api() item_id = items_api.list_items().get_items()[0].get_item_id()
#$Id$# from books.model.Transaction import Transaction from books.model.CreditNoteRefund import CreditNoteRefund from books.model.VendorPayment import VendorPayment from books.model.CustomerPayment import CustomerPayment from books.model.Bill import Bill from books.model.Expense import Expense from books.model.Invoice import Invoice from books.service.ZohoBooks import ZohoBooks import os access_token = os.environ.get('ACCESS_TOKEN') organization_id = os.environ.get('ORGANIZATION_ID') zoho_books = ZohoBooks(access_token, organization_id) bank_transaction_api = zoho_books.get_bank_transactions_api() accounts_api = zoho_books.get_bank_accounts_api() account_id = accounts_api.get_bank_accounts().get_bank_accounts()[1].get_account_id() transaction_type = 'sales_without_invoices' transaction_id = bank_transaction_api.get_bank_transactions().get_transactions()[0].get_transaction_id() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() settings_api = zoho_books.get_settings_api() currency_id = settings_api.get_currencies().get_currencies()[0].get_currency_id() vendor_payments_api = zoho_books.get_vendor_payments_api()
#$Id$# from books.model.ContactPerson import ContactPerson from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") contact_person_api = zoho_books.get_contact_persons_api() contact_api = zoho_books.get_contacts_api() contact_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() contact_person_id = contact_person_api.get_contact_persons(contact_id).get_contact_persons()[0].get_contact_person_id() #list contact persons print contact_person_api.get_contact_persons(contact_id) #get contact person details print contact_person_api.get(contact_person_id) # create contact person d = ContactPerson() d.set_salutation('Mr') d.set_first_name('bata') d.set_last_name('kumar') d.set_email('*****@*****.**') d.set_phone('999887') d.set_mobile('9998887766')
from books.model.Invoice import Invoice from books.model.Address import Address from books.model.Email import Email from books.model.LineItem import LineItem from books.model.PaymentGateway import PaymentGateway from books.model.CustomField import CustomField from books.model.PaymentAndCredit import PaymentAndCredit from books.model.InvoicePayment import InvoicePayment from books.model.InvoiceCredited import InvoiceCredited from books.model.Comment import Comment from books.service.ZohoBooks import ZohoBooks import os access_token = os.environ.get('ACCESS_TOKEN') organization_id = os.environ.get('ORGANIZATION_ID') zoho_books = ZohoBooks(access_token, organization_id) invoice_api = zoho_books.get_invoices_api() #invoice_id = invoice_api.get_invoices().get_invoices()[0].get_invoice_id() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() contact_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() invoice_ids = invoice_api.get_invoices().get_invoices()[0].get_invoice_id() + ',' + invoice_api.get_invoices().get_invoices()[1].get_invoice_id() ''' template_id = invoice_api.list_invoice_templates().get_templates()[0].get_template_id() ''' items_api = zoho_books.get_items_api() item_id = items_api.list_items().get_items()[0].get_item_id()
#$Id$# from books.model.Estimate import Estimate from books.model.Address import Address from books.model.Email import Email from books.model.ContactPerson import ContactPerson from books.model.LineItem import LineItem from books.model.CustomField import CustomField from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") estimate_api = zoho_books.get_estimates_api() estimate_id = estimate_api.get_estimates().get_estimates()[0].get_estimate_id() estimate_ids = estimate_api.get_estimates().get_estimates()[0].get_estimate_id( ) + ',' + estimate_api.get_estimates().get_estimates()[1].get_estimate_id() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() items_api = zoho_books.get_items_api() item_id = items_api.list_items().get_items()[0].get_item_id() template_id = estimate_api.list_estimate_template().get_templates( )[0].get_template_id() # to list Estimates print estimate_api.get_estimates()
#$Id$# from books.model.ChartOfAccount import ChartOfAccount from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") chart_of_accounts_api = zoho_books.get_chart_of_accounts_api() account_id = chart_of_accounts_api.get_chart_of_accounts().get_chartofaccounts()[0].get_account_id() # list chart of accounts parameters = {'filter_by':'AccountType.Active'} print chart_of_accounts_api.get_chart_of_accounts() print chart_of_accounts_api.get_chart_of_accounts(parameters) # Get an Account print chart_of_accounts_api.get(account_id) # Create an account account = ChartOfAccount() account.set_account_name('DD1') account.set_account_type('other_asset') account.set_currency_id('') account.set_description('Fixed Deposit') print chart_of_accounts_api.create(account)
#$Id$# from books.model.CustomerPayment import CustomerPayment from books.model.Invoice import Invoice from books.service.ZohoBooks import ZohoBooks import os access_token = os.environ.get('ACCESS_TOKEN') organization_id = os.environ.get('ORGANIZATION_ID') zoho_books = ZohoBooks(access_token, organization_id) customer_payments_api = zoho_books.get_customer_payments_api() payment_id = customer_payments_api.get_customer_payments().get_customer_payments()[0].get_payment_id() customer_id = customer_payments_api.get_customer_payments().get_customer_payments()[0].get_customer_id() invoice_api = zoho_books.get_invoices_api() invoice_id = invoice_api.get_invoices().get_invoices()[0].get_invoice_id() accounts_api = zoho_books.get_bank_accounts_api() account_id = accounts_api.get_bank_accounts().get_bank_accounts()[0].get_account_id() # List customer payments print customer_payments_api.get_customer_payments() # Get a customer payment print customer_payments_api.get(payment_id) # Create a payment_customer
#$Id$# import requests from books.model.Contact import Contact from books.model.Email import Email from books.model.Address import Address from books.model.ContactPerson import ContactPerson from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("1202c2fa92ed3b23db3f93c84e21624d", "317312245") # To get the auth token programmatically, use: # https://accounts.zoho.com/apiauthtoken/nb/create?SCOPE=ZohoBooks/booksapi&EMAIL_ID=[ZohoID/EmailID]&PASSWORD=[Password] # # To get the organization id programmatically, use: # https://books.zoho.com/api/v3/organizations?authtoken=[AUTHTOKEN] contact_api = zoho_books.get_contacts_api() # to get a contact from contacts list first_contact = contact_api.get_contacts().get_contacts()[0] print("contact_id = ", first_contact.contact_id) print("contact_name = ", first_contact.contact_name) # to list contacts #parameter = {'sort_column':'last_name'} #contact_api.get_contacts(parameter) # to get a contact test_contact = contact_api.get(first_contact.contact_id)
#$Id$# from books.model.Estimate import Estimate from books.model.Address import Address from books.model.Email import Email from books.model.ContactPerson import ContactPerson from books.model.LineItem import LineItem from books.model.CustomField import CustomField from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") estimate_api = zoho_books.get_estimates_api() estimate_id = estimate_api.get_estimates().get_estimates()[0].get_estimate_id() estimate_ids = estimate_api.get_estimates().get_estimates()[0].get_estimate_id() + ',' + estimate_api.get_estimates().get_estimates()[1].get_estimate_id() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() items_api = zoho_books.get_items_api() item_id = items_api.list_items().get_items()[0].get_item_id() template_id = estimate_api.list_estimate_template().get_templates()[0].get_template_id() # to list Estimates print estimate_api.get_estimates() # to get an estimate
#$Id$# from books.model.Invoice import Invoice from books.model.Address import Address from books.model.Email import Email from books.model.LineItem import LineItem from books.model.PaymentGateway import PaymentGateway from books.model.CustomField import CustomField from books.model.PaymentAndCredit import PaymentAndCredit from books.model.InvoicePayment import InvoicePayment from books.model.InvoiceCredited import InvoiceCredited from books.model.Comment import Comment from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") invoice_api = zoho_books.get_invoices_api() #invoice_id = invoice_api.get_invoices().get_invoices()[0].get_invoice_id() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() contact_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() invoice_ids = invoice_api.get_invoices().get_invoices()[0].get_invoice_id() + ',' + invoice_api.get_invoices().get_invoices()[1].get_invoice_id() ''' template_id = invoice_api.list_invoice_templates().get_templates()[0].get_template_id() ''' items_api = zoho_books.get_items_api() item_id = items_api.list_items().get_items()[0].get_item_id() attachment = ['/{file_directory}/fil1.txt', '/{file_directory}/fil2.txt']
#$Id$# from books.model.Bill import Bill from books.model.LineItem import LineItem from books.model.Address import Address from books.model.PaymentAndCredit import PaymentAndCredit from books.model.BillPayment import BillPayment from books.service.ZohoBooks import ZohoBooks import os access_token = os.environ.get('ACCESS_TOKEN') organization_id = os.environ.get('ORGANIZATION_ID') zoho_books = ZohoBooks(access_token, organization_id) bill_api = zoho_books.get_bills_api() bill_id = bill_api.get_bills().get_bills()[1].get_bill_id() vendor_api = zoho_books.get_vendor_payments_api() vendor_id = vendor_api.get_vendor_payments().get_vendor_payments()[0].get_vendor_id() param = {'filter_by': 'AccountType.Expense'} chart_of_accounts_api = zoho_books.get_chart_of_accounts_api() account_id = chart_of_accounts_api.get_chart_of_accounts(param).get_chartofaccounts()[1].get_account_id() attachment = '/{file_directory}/emp.pdf' # List bills parameter = {'status':'open'} print bill_api.get_bills() print bill_api.get_bills(parameter) # Get a bill
#$Id$# from books.model.Project import Project from books.model.User import User from books.model.Task import Task from books.model.TimeEntry import TimeEntry from books.model.Comment import Comment from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") projects_api = zoho_books.get_projects_api() project_id = projects_api.get_projects().get_projects()[0].get_project_id() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() task_id = projects_api.get_tasks(project_id).get_tasks()[0].get_task_id() user_id = projects_api.get_users(project_id).get_users()[0].get_user_id() time_entry_id = projects_api.get_time_entries().get_time_entries()[0].get_time_entry_id() #Projects #List Projects param = {'filter_by': 'Status.All'} print projects_api.get_projects(param) print projects_api.get_projects() # Get project
#$Id$# from books.model.BankRule import BankRule from books.model.Criteria import Criteria from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") bank_rules_api = zoho_books.get_bank_rules_api() accounts_api = zoho_books.get_bank_accounts_api() account_id = accounts_api.get_bank_accounts().get_bank_accounts()[0].get_account_id() target_account_id = accounts_api.get_bank_accounts().get_bank_accounts()[1].get_account_id() rule_id = bank_rules_api.get_rules(account_id).get_bank_rules()[0].get_rule_id() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() # get rules list print bank_rules_api.get_rules(account_id) # get a rule print bank_rules_api.get(rule_id) #create a rule rule=BankRule() rule.set_rule_name('rule 9')
#$Id$# from books.model.Contact import Contact from books.model.Email import Email from books.model.Address import Address from books.model.ContactPerson import ContactPerson from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") contact_api = zoho_books.get_contacts_api() contact_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() settings_api = zoho_books.get_settings_api() currency_id = settings_api.get_currencies().get_currencies( )[0].get_currency_id() # to list contacts parameter = {'sort_column': 'last_name'} print contact_api.get_contacts(parameter) # to get a contact print contact_api.get(contact_id) # to create contact contact = Contact() contact.set_contact_name('anin') contact.set_payment_terms(15) contact.set_payment_terms_label('Net 15')
#$Id$# from books.model.Bill import Bill from books.model.LineItem import LineItem from books.model.Address import Address from books.model.PaymentAndCredit import PaymentAndCredit from books.model.BillPayment import BillPayment from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") bill_api = zoho_books.get_bills_api() bill_id = bill_api.get_bills().get_bills()[1].get_bill_id() vendor_api = zoho_books.get_vendor_payments_api() vendor_id = vendor_api.get_vendor_payments().get_vendor_payments()[0].get_vendor_id() param = {'filter_by': 'AccountType.Expense'} chart_of_accounts_api = zoho_books.get_chart_of_accounts_api() account_id = chart_of_accounts_api.get_chart_of_accounts(param).get_chartofaccounts()[1].get_account_id() attachment = '/{file_directory}/emp.pdf' # List bills parameter = {'status':'open'} print bill_api.get_bills() print bill_api.get_bills(parameter) # Get a bill print bill_api.get(bill_id)
from books.model.User import User from books.model.Item import Item from books.model.InvoiceSetting import InvoiceSetting from books.model.NotesAndTerms import NotesAndTerms from books.model.EstimateSetting import EstimateSetting from books.model.CreditnoteSetting import CreditnoteSetting from books.model.Currency import Currency from books.model.ExchangeRate import ExchangeRate from books.model.Tax import Tax from books.model.OpeningBalance import OpeningBalance from books.model.Account import Account from books.model.Autoreminder import Autoreminder from books.model.ManualReminder import ManualReminder from books.model.TaxGroup import TaxGroup from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") settings_api = zoho_books.get_settings_api() organizations_api = zoho_books.get_organizations_api() users_api = zoho_books.get_users_api() items_api = zoho_books.get_items_api() currency_id = settings_api.get_currencies().get_currencies()[0].get_currency_id() #List preferences print settings_api.list_preferences() #Update preference preference = Preference() preference.set_convert_to_invoice(False)
#$Id$# from books.model.BankRule import BankRule from books.model.Criteria import Criteria from books.service.ZohoBooks import ZohoBooks import os access_token = os.environ.get('ACCESS_TOKEN') organization_id = os.environ.get('ORGANIZATION_ID') zoho_books = ZohoBooks(access_token, organization_id) bank_rules_api = zoho_books.get_bank_rules_api() accounts_api = zoho_books.get_bank_accounts_api() account_id = accounts_api.get_bank_accounts().get_bank_accounts()[0].get_account_id() target_account_id = accounts_api.get_bank_accounts().get_bank_accounts()[1].get_account_id() rule_id = bank_rules_api.get_rules(account_id).get_bank_rules()[0].get_rule_id() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() # get rules list print bank_rules_api.get_rules(account_id) # get a rule print bank_rules_api.get(rule_id) #create a rule
#$Id$# from books.model.RecurringInvoice import RecurringInvoice from books.model.PaymentGateway import PaymentGateway from books.model.LineItem import LineItem from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") recurring_invoice_api = zoho_books.get_recurring_invoices_api() recurring_invoice_id = recurring_invoice_api.get_recurring_invoices( ).get_recurring_invoices()[0].get_recurring_invoice_id() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() items_api = zoho_books.get_items_api() item_id = items_api.list_items().get_items()[0].get_item_id() # to list recurring invoices print recurring_invoice_api.get_recurring_invoices() # get a recurring invoice print recurring_invoice_api.get_recurring_invoice(recurring_invoice_id) # create a recurring invoice recurring_invoice = RecurringInvoice() recurring_invoice.set_recurrence_name('Venkat')
#$Id$# from books.model.VendorPayment import VendorPayment from books.model.Bill import Bill from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") vendor_payments_api = zoho_books.get_vendor_payments_api() payment_id = vendor_payments_api.get_vendor_payments().get_vendor_payments()[0].get_payment_id() vendor_id = vendor_payments_api.get_vendor_payments().get_vendor_payments()[0].get_vendor_id() accounts_api = zoho_books.get_bank_accounts_api() account_id = accounts_api.get_bank_accounts().get_bank_accounts()[0].get_account_id() bill_api = zoho_books.get_bills_api() bill_id = bill_api.get_bills().get_bills()[0].get_bill_id() # list vendor payments parameter={'filter_by':'PaymentMode.Cash'} #print vendor_payments_api.get_vendor_payments(parameter) print vendor_payments_api.get_vendor_payments() # Get a vendor payment print vendor_payments_api.get(payment_id) # Create a vendor payment vendor_payment = VendorPayment() vendor_payment.set_vendor_id(vendor_id)
#$Id$# from books.model.BaseCurrencyAdjustment import BaseCurrencyAdjustment from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") base_currency_adjustment_api = zoho_books.get_base_currency_adjustment_api() base_currency_adjustment_id = base_currency_adjustment_api.get_base_currency_adjustments( ).get_base_currency_adjustments()[0].get_base_currency_adjustment_id() #List base currency adjustment parameter = {'filter_by': 'Date.All', 'sort_column': 'adjustment_date'} print base_currency_adjustment_api.get_base_currency_adjustments() print base_currency_adjustment_api.get_base_currency_adjustments(parameter) #Get a base currency adjustment print base_currency_adjustment_api.get(base_currency_adjustment_id) # List account details for base currency adjustments settings_api = zoho_books.get_settings_api() currency_id = settings_api.get_currencies().get_currencies( )[0].get_currency_id() parameter = { 'currency_id': currency_id, 'adjustment_date': '2014-04-21', 'exchange_rate': 20.0,
#$Id$# from books.model.Estimate import Estimate from books.model.Address import Address from books.model.Email import Email from books.model.ContactPerson import ContactPerson from books.model.LineItem import LineItem from books.model.CustomField import CustomField from books.service.ZohoBooks import ZohoBooks import os access_token = os.environ.get('ACCESS_TOKEN') organization_id = os.environ.get('ORGANIZATION_ID') zoho_books = ZohoBooks(access_token, organization_id) estimate_api = zoho_books.get_estimates_api() estimate_id = estimate_api.get_estimates().get_estimates()[0].get_estimate_id() estimate_ids = estimate_api.get_estimates().get_estimates()[0].get_estimate_id( ) + ',' + estimate_api.get_estimates().get_estimates()[1].get_estimate_id() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() items_api = zoho_books.get_items_api() item_id = items_api.list_items().get_items()[0].get_item_id() template_id = estimate_api.list_estimate_template().get_templates( )[0].get_template_id() # to list Estimates
#$Id$# from books.model.VendorPayment import VendorPayment from books.model.Bill import Bill from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") vendor_payments_api = zoho_books.get_vendor_payments_api() payment_id = vendor_payments_api.get_vendor_payments().get_vendor_payments( )[0].get_payment_id() vendor_id = vendor_payments_api.get_vendor_payments().get_vendor_payments( )[0].get_vendor_id() accounts_api = zoho_books.get_bank_accounts_api() account_id = accounts_api.get_bank_accounts().get_bank_accounts( )[0].get_account_id() bill_api = zoho_books.get_bills_api() bill_id = bill_api.get_bills().get_bills()[0].get_bill_id() # list vendor payments parameter = {'filter_by': 'PaymentMode.Cash'} #print vendor_payments_api.get_vendor_payments(parameter) print vendor_payments_api.get_vendor_payments() # Get a vendor payment print vendor_payments_api.get(payment_id) # Create a vendor payment
#$Id$# from books.model.CustomerPayment import CustomerPayment from books.model.Invoice import Invoice from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") customer_payments_api = zoho_books.get_customer_payments_api() payment_id = customer_payments_api.get_customer_payments().get_customer_payments()[0].get_payment_id() customer_id = customer_payments_api.get_customer_payments().get_customer_payments()[0].get_customer_id() invoice_api = zoho_books.get_invoices_api() invoice_id = invoice_api.get_invoices().get_invoices()[0].get_invoice_id() accounts_api = zoho_books.get_bank_accounts_api() account_id = accounts_api.get_bank_accounts().get_bank_accounts()[0].get_account_id() # List customer payments print customer_payments_api.get_customer_payments() # Get a customer payment print customer_payments_api.get(payment_id) # Create a payment_customer customer_payments = CustomerPayment() customer_payments.set_customer_id(customer_id) invoices = []
#$Id$# from books.model.RecurringInvoice import RecurringInvoice from books.model.PaymentGateway import PaymentGateway from books.model.LineItem import LineItem from books.service.ZohoBooks import ZohoBooks import os access_token = os.environ.get('ACCESS_TOKEN') organization_id = os.environ.get('ORGANIZATION_ID') zoho_books = ZohoBooks(access_token, organization_id) recurring_invoice_api = zoho_books.get_recurring_invoices_api() recurring_invoice_id = recurring_invoice_api.get_recurring_invoices( ).get_recurring_invoices()[0].get_recurring_invoice_id() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() items_api = zoho_books.get_items_api() item_id = items_api.list_items().get_items()[0].get_item_id() # to list recurring invoices print recurring_invoice_api.get_recurring_invoices() # get a recurring invoice print recurring_invoice_api.get_recurring_invoice(recurring_invoice_id) # create a recurring invoice
#$Id$# from books.model.RecurringInvoice import RecurringInvoice from books.model.PaymentGateway import PaymentGateway from books.model.LineItem import LineItem from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") recurring_invoice_api = zoho_books.get_recurring_invoices_api() recurring_invoice_id = recurring_invoice_api.get_recurring_invoices().get_recurring_invoices()[0].get_recurring_invoice_id() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() items_api = zoho_books.get_items_api() item_id = items_api.list_items().get_items()[0].get_item_id() # to list recurring invoices print recurring_invoice_api.get_recurring_invoices() # get a recurring invoice print recurring_invoice_api.get_recurring_invoice(recurring_invoice_id) # create a recurring invoice recurring_invoice = RecurringInvoice() recurring_invoice.set_recurrence_name('Venkat') recurring_invoice.set_customer_id(customer_id)
#$Id$# from books.model.Project import Project from books.model.User import User from books.model.Task import Task from books.model.TimeEntry import TimeEntry from books.model.Comment import Comment from books.service.ZohoBooks import ZohoBooks import os access_token = os.environ.get('ACCESS_TOKEN') organization_id = os.environ.get('ORGANIZATION_ID') zoho_books = ZohoBooks(access_token, organization_id) projects_api = zoho_books.get_projects_api() project_id = projects_api.get_projects().get_projects()[0].get_project_id() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() task_id = projects_api.get_tasks(project_id).get_tasks()[0].get_task_id() user_id = projects_api.get_users(project_id).get_users()[0].get_user_id() time_entry_id = projects_api.get_time_entries().get_time_entries( )[0].get_time_entry_id() #Projects #List Projects param = {'filter_by': 'Status.All'} print projects_api.get_projects(param)
#$Id$# from books.model.BankAccount import BankAccount from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") bank_accounts_api = zoho_books.get_bank_accounts_api() account_id = bank_accounts_api.get_bank_accounts().get_bank_accounts()[0].get_account_id() statement_id = bank_accounts_api.get_last_imported_statement(account_id).get_statement_id() # list view of accounts param = {'filter_by':'Status.Active'} print bank_accounts_api.get_bank_accounts() print bank_accounts_api.get_bank_accounts(param) # Get account details print bank_accounts_api.get(account_id) # Create a bank account bank_account = BankAccount() bank_account.set_account_name('account 1') bank_account.set_account_type('bank') bank_account.set_currency_id('') bank_account.set_description('thanks') bank_account.set_bank_name('')
#$Id$# from books.model.BankAccount import BankAccount from books.service.ZohoBooks import ZohoBooks import os access_token = os.environ.get('ACCESS_TOKEN') organization_id = os.environ.get('ORGANIZATION_ID') zoho_books = ZohoBooks(access_token, organization_id) bank_accounts_api = zoho_books.get_bank_accounts_api() account_id = bank_accounts_api.get_bank_accounts().get_bank_accounts( )[0].get_account_id() statement_id = bank_accounts_api.get_last_imported_statement( account_id).get_statement_id() # list view of accounts param = {'filter_by': 'Status.Active'} print bank_accounts_api.get_bank_accounts() print bank_accounts_api.get_bank_accounts(param) # Get account details print bank_accounts_api.get(account_id) # Create a bank account bank_account = BankAccount()
#$Id$# from books.model.BaseCurrencyAdjustment import BaseCurrencyAdjustment from books.service.ZohoBooks import ZohoBooks import os access_token = os.environ.get('ACCESS_TOKEN') organization_id = os.environ.get('ORGANIZATION_ID') zoho_books = ZohoBooks(access_token, organization_id) base_currency_adjustment_api = zoho_books.get_base_currency_adjustment_api() base_currency_adjustment_id = base_currency_adjustment_api.get_base_currency_adjustments( ).get_base_currency_adjustments()[0].get_base_currency_adjustment_id() #List base currency adjustment parameter = {'filter_by': 'Date.All', 'sort_column': 'adjustment_date'} print base_currency_adjustment_api.get_base_currency_adjustments() print base_currency_adjustment_api.get_base_currency_adjustments(parameter) #Get a base currency adjustment print base_currency_adjustment_api.get(base_currency_adjustment_id) # List account details for base currency adjustments settings_api = zoho_books.get_settings_api() currency_id = settings_api.get_currencies().get_currencies( )[0].get_currency_id() parameter = {
#$Id$# from books.model.Journal import Journal from books.model.LineItem import LineItem from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") journal_api = zoho_books.get_journals_api() journal_id = journal_api.get_journals().get_journals()[0].get_journal_id() param = {'filter_by': 'AccountType.Expense'} chart_of_accounts_api = zoho_books.get_chart_of_accounts_api() expense_account_id = chart_of_accounts_api.get_chart_of_accounts(param).get_chartofaccounts()[1].get_account_id() # get journal list parameter = {'total_less_than':100.0} #print journal_api.get_journals() print journal_api.get_journals(parameter) # get journal print journal_api.get(journal_id) #create a journal journal = Journal() journal.set_journal_date('2014-06-10') journal.set_reference_number('') journal.set_notes('loan')
#$Id$# from books.model.BaseCurrencyAdjustment import BaseCurrencyAdjustment from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") base_currency_adjustment_api = zoho_books.get_base_currency_adjustment_api() base_currency_adjustment_id = base_currency_adjustment_api.get_base_currency_adjustments().get_base_currency_adjustments()[0].get_base_currency_adjustment_id() #List base currency adjustment parameter = { 'filter_by': 'Date.All', 'sort_column': 'adjustment_date'} print base_currency_adjustment_api.get_base_currency_adjustments() print base_currency_adjustment_api.get_base_currency_adjustments(parameter) #Get a base currency adjustment print base_currency_adjustment_api.get(base_currency_adjustment_id) # List account details for base currency adjustments settings_api = zoho_books.get_settings_api() currency_id = settings_api.get_currencies().get_currencies()[0].get_currency_id() parameter = {'currency_id': currency_id, 'adjustment_date': '2014-04-21', 'exchange_rate': 20.0, 'notes': 'sdfs'}
#$Id$# from books.model.Expense import Expense from books.service.ZohoBooks import ZohoBooks import os access_token = os.environ.get('ACCESS_TOKEN') organization_id = os.environ.get('ORGANIZATION_ID') zoho_books = ZohoBooks(access_token, organization_id) expenses_api = zoho_books.get_expenses_api() expense_id = expenses_api.get_expenses().get_expenses()[0].get_expense_id() accounts_api = zoho_books.get_bank_accounts_api() account_id = accounts_api.get_bank_accounts().get_bank_accounts( )[0].get_account_id() param = {'filter_by': 'AccountType.Expense'} chart_of_accounts_api = zoho_books.get_chart_of_accounts_api() expense_account_id = chart_of_accounts_api.get_chart_of_accounts( param).get_chartofaccounts()[1].get_account_id() settings_api = zoho_books.get_settings_api() currency_id = settings_api.get_currencies().get_currencies( )[0].get_currency_id() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() vendor_api = zoho_books.get_vendor_payments_api()
#$Id$# from books.model.VendorPayment import VendorPayment from books.model.Bill import Bill from books.service.ZohoBooks import ZohoBooks import os access_token = os.environ.get('ACCESS_TOKEN') organization_id = os.environ.get('ORGANIZATION_ID') zoho_books = ZohoBooks(access_token, organization_id) vendor_payments_api = zoho_books.get_vendor_payments_api() payment_id = vendor_payments_api.get_vendor_payments().get_vendor_payments()[0].get_payment_id() vendor_id = vendor_payments_api.get_vendor_payments().get_vendor_payments()[0].get_vendor_id() accounts_api = zoho_books.get_bank_accounts_api() account_id = accounts_api.get_bank_accounts().get_bank_accounts()[0].get_account_id() bill_api = zoho_books.get_bills_api() bill_id = bill_api.get_bills().get_bills()[0].get_bill_id() # list vendor payments parameter={'filter_by':'PaymentMode.Cash'} #print vendor_payments_api.get_vendor_payments(parameter) print vendor_payments_api.get_vendor_payments() # Get a vendor payment print vendor_payments_api.get(payment_id) # Create a vendor payment
#$Id$# from books.model.CreditNote import CreditNote from books.model.Address import Address from books.model.Email import Email from books.model.LineItem import LineItem from books.model.CreditNoteRefund import CreditNoteRefund from books.model.Comment import Comment from books.model.Invoice import Invoice from books.service.ZohoBooks import ZohoBooks import os access_token = os.environ.get('ACCESS_TOKEN') organization_id = os.environ.get('ORGANIZATION_ID') zoho_books = ZohoBooks(access_token, organization_id) credit_notes_api = zoho_books.get_creditnotes_api() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() param = {'status': 'open'} credit_note_id = credit_notes_api.get_credit_notes( param).get_creditnotes()[0].get_creditnote_id() contact_api = zoho_books.get_contacts_api() contact_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() contact_person_api = zoho_books.get_contact_persons_api() contact_persons_id = contact_person_api.get_contact_persons( contact_id).get_contact_persons()[0].get_contact_person_id() invoice_api = zoho_books.get_invoices_api() invoice_id = invoice_api.get_invoices().get_invoices()[0].get_invoice_id()
#$Id$# from books.model.Transaction import Transaction from books.model.CreditNoteRefund import CreditNoteRefund from books.model.VendorPayment import VendorPayment from books.model.CustomerPayment import CustomerPayment from books.model.Bill import Bill from books.model.Expense import Expense from books.model.Invoice import Invoice from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") bank_transaction_api = zoho_books.get_bank_transactions_api() accounts_api = zoho_books.get_bank_accounts_api() account_id = accounts_api.get_bank_accounts().get_bank_accounts()[1].get_account_id() transaction_type = 'sales_without_invoices' transaction_id = bank_transaction_api.get_bank_transactions().get_transactions()[0].get_transaction_id() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() settings_api = zoho_books.get_settings_api() currency_id = settings_api.get_currencies().get_currencies()[0].get_currency_id() vendor_payments_api = zoho_books.get_vendor_payments_api() payment_id = vendor_payments_api.get_vendor_payments().get_vendor_payments()[0].get_payment_id() vendor_id = vendor_payments_api.get_vendor_payments().get_vendor_payments()[0].get_vendor_id()
#$Id$# from books.model.CreditNote import CreditNote from books.model.Address import Address from books.model.Email import Email from books.model.LineItem import LineItem from books.model.CreditNoteRefund import CreditNoteRefund from books.model.Comment import Comment from books.model.Invoice import Invoice from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") credit_notes_api = zoho_books.get_creditnotes_api() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() param = {'status': 'open'} credit_note_id = credit_notes_api.get_credit_notes( param).get_creditnotes()[0].get_creditnote_id() contact_api = zoho_books.get_contacts_api() contact_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() contact_person_api = zoho_books.get_contact_persons_api() contact_persons_id = contact_person_api.get_contact_persons( contact_id).get_contact_persons()[0].get_contact_person_id() invoice_api = zoho_books.get_invoices_api() invoice_id = invoice_api.get_invoices().get_invoices()[0].get_invoice_id() items_api = zoho_books.get_items_api() item_id = items_api.list_items().get_items()[0].get_item_id()
#$Id$# from books.model.RecurringExpense import RecurringExpense from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("{auth_token}", "{organization_id}") recurring_expenses_api = zoho_books.get_recurring_expenses_api() recurring_expense_id = recurring_expenses_api.get_recurring_expenses().get_recurring_expenses()[0].get_recurring_expense_id() accounts_api = zoho_books.get_bank_accounts_api() account_id = accounts_api.get_bank_accounts().get_bank_accounts()[0].get_account_id() param = {'filter_by': 'AccountType.Expense'} chart_of_accounts_api = zoho_books.get_chart_of_accounts_api() expense_account_id = chart_of_accounts_api.get_chart_of_accounts(param).get_chartofaccounts()[1].get_account_id() settings_api = zoho_books.get_settings_api() currency_id = settings_api.get_currencies().get_currencies()[0].get_currency_id() contact_api = zoho_books.get_contacts_api() customer_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() vendor_api = zoho_books.get_vendor_payments_api() vendor_id = vendor_api.get_vendor_payments().get_vendor_payments()[0].get_vendor_id() # list recurring expenses print recurring_expenses_api.get_recurring_expenses()
#$Id$# import requests from books.model.Contact import Contact from books.model.Email import Email from books.model.Address import Address from books.model.ContactPerson import ContactPerson from books.service.ZohoBooks import ZohoBooks zoho_books = ZohoBooks("1202c2fa92ed3b23db3f93c84e21624d", "317312245") # To get the auth token programmatically, use: # https://accounts.zoho.com/apiauthtoken/nb/create?SCOPE=ZohoBooks/booksapi&EMAIL_ID=[ZohoID/EmailID]&PASSWORD=[Password] # # To get the organization id programmatically, use: # https://books.zoho.com/api/v3/organizations?authtoken=[AUTHTOKEN] contact_api = zoho_books.get_contacts_api() # to get a contact from contacts list first_contact = contact_api.get_contacts().get_contacts()[0] print("contact_id = ", first_contact.contact_id) print("contact_name = ", first_contact.contact_name) # to list contacts #parameter = {'sort_column':'last_name'} #contact_api.get_contacts(parameter) # to get a contact
#$Id$# import os from books.model.Contact import Contact from books.model.Email import Email from books.model.Address import Address from books.model.ContactPerson import ContactPerson from books.service.ZohoBooks import ZohoBooks access_token = os.environ.get('ACCESS_TOKEN') organization_id = os.environ.get('ORGANIZATION_ID') zoho_books = ZohoBooks(access_token, organization_id) contact_api = zoho_books.get_contacts_api() contact_id = contact_api.get_contacts().get_contacts()[0].get_contact_id() settings_api = zoho_books.get_settings_api() currency_id = settings_api.get_currencies().get_currencies( )[0].get_currency_id() # to list contacts parameter = {'sort_column': 'last_name'} print(contact_api.get_contacts(parameter)) # to get a contact print(contact_api.get(contact_id)) # to create contact