From 9507d99928a8685af68c97355de6bca5a1b8cd71 Mon Sep 17 00:00:00 2001 From: thisaramanohara Date: Fri, 23 Jun 2023 18:54:57 +0530 Subject: [PATCH] Can retrieve all the contacts --- app.py | 12 ++++++++++++ templates/base.html | 1 + 2 files changed, 13 insertions(+) diff --git a/app.py b/app.py index 02990843..554a6724 100644 --- a/app.py +++ b/app.py @@ -220,6 +220,18 @@ def get_invoices(): "code.html", title="Invoices", code=code, sub_title=sub_title ) +@app.route("/contacts") +@xero_token_required +def get_contacts(): + xero_tenant_id = get_xero_tenant_id() + accounting_api = AccountingApi(api_client) + contacts = accounting_api.get_contacts(xero_tenant_id) + code = serialize_model(contacts) + sub_title = "Total Contacts found: {}".format(len(contacts.contacts)) + return render_template( + "code.html", title="Contacts", code=code, sub_title=sub_title + ) + @app.route("/login") def login(): diff --git a/templates/base.html b/templates/base.html index 138bf484..d12d96b3 100644 --- a/templates/base.html +++ b/templates/base.html @@ -12,6 +12,7 @@ Export Token | Create Contact | Create Multiple Contacts | +Contacts | Invoices | Refresh Token | {% block content %}{% endblock %}