Can't save objects to xero.
See original GitHub issueI try to do this
contacts = xero_client.contacts.all()
for contact in contacts:
if contact.get("Name") == supplier_name:
contact["Addresses"][0]["City"] = "Manhattan"
xero_client.contacts.save(contact)
# HERE I am trying to mark the invoice as paid.
invoices = xero_client.invoices.get(invoice_number)
for invoice in invoices:
if invoice.get("Contact").get("Name") == supplier_name:
invoice["Status"] = "PAID"
xero_client.invoices.save(invoice)
but it’s throwing this error in both cases.
xero_client.contacts.save(contact)
File "/Library/Python/2.7/site-packages/xero/manager.py", line 187, in wrapper
raise XeroBadRequest(response)
File "/Library/Python/2.7/site-packages/xero/exceptions.py", line 24, in __init__
for elem in data['Elements']
KeyError: 'Elements'
can someone please help me solve this.
Issue Analytics
- State:
- Created 8 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Issues importing inventory items or opening balances
See why you might be getting an error when you try to import inventory items or opening balances into Xero.
Read more >Fix problems with importing and exporting invoices
In the Business menu, select Invoices. · Select the Xero Export Failed tab. · Select the checkbox next to one or more invoices...
Read more >i am trying to add a contact but there is no save button
I am trying to add a new contact so I can invoice them but when i put in all the details there is...
Read more >Import inventory items into Xero
In the Business menu, select Products and services. · Click Import, then select Items. · Under Upload items, click Select file to locate...
Read more >Why wont my invoices auto save? - Xero Central
not the answer I was looking for, normally when I'm creating an invoice it auotsaves but occasionally it won't. There has to be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If someone makes a PR I’ll merge it
There’s actually a further issue with (at least one of) the date fields because when the above issue was fixed the API then complained about the date being in the wrong format. Re-saving the datetime to a simple date (in my script not in pyxero) fixed that problem