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 %}