Python module for Manager API

I am in the process of producing a Python module to access the Manager API. I have enough working for my own purposes, but I hope I could produce something that is useful to many people.

Some questions for @lubos, or anyone who knows:

  1. Are the UUID’s for each endpoint (Payment, InventoryTransfer, etc.) fixed? I see they are the same between businesses, but will they change when the Manager version upgrades? What about if that endpoint changes in some way, does the UUID change then? Basically, should a module hardcode endpoint UUID or look them up every time?
  2. Is there a way to get a list of all endpoints? Some (e.g. various kinds of *Footer) aren’t shown on api.json unless at least one already exists.
  3. I am auto-generating the API from the self-documentation. Is there a way to get the datatype information for the JSON? Many of the values in the default example contain null, so it’s hard to tell if API is expecting a date, list, what kind of list, etc.

Thank you for any information you can provide!

3 Likes

Yes they are, unless of course, Manager undergoes a major redesign of its core data structure in the future–which is highly unlikely in the near term.

The only way to achieve that is to create a test business and create 1 object of each type, then all the UUIDs will be exposed in the API.

The built-in fields are pretty much self explanatory. For example, you have the following basic data types bool, date, datetime and float, and whatever doesn’t fit into any of these categories is a string. On top of that, you also have arrays of records–which is pretty much standard for document lines.

The custom field types are easier to identify since they are what you define them to be–and you will find them in their respective object types in the API.

One more thing, custom fields values are stored as a literal key-value object.

Thank you!

Below is a first version of this API. I am now using it locally for various tasks, but issue reports and pull requests are welcome. Be sure to try all code on a test business first!
https://github.com/isotherm/python-manager-api/

5 Likes

That’s a commendable effort, very thorough indeed.

I hope this catches on.

@isotherm Amazing job! I was thinking of creating a telegram bot this will certainly be useful.

This is updated to v0.1.1 to add a few features and fix various bugs and gotchas. Next release hopefully has client-side caching to improve speed.

Interested users should please star or watch the Github repo to be sure you are aware of any issues or improvements, as I will not always post minor updates here.

To give an idea what is possible, so far we are using this to:

  • Import customers and transactions from e-commerce
  • Reconcile batch payments from e-commerce
  • Reconcile inventory counts for consignment vendors and issue invoices
  • Generate sales tax reports in a spreadsheet that can be directly uploaded
  • Auto reconcile bank and credit card transactions, and pull the associated receipt from email. (The existing import is too picky about dates matching, and can’t do interaccount transfers for credit card payments.)
  • Generate automatic purchase invoices for royalties owed.
4 Likes

I always wanted to learn Python. Now I’ve got a good reason to. Thanks.
Our little business is growing and automation in Excel has reached its limit, so this is great!!

This is updated to v0.1.2, which updates the model to match Manager v23.4.3.750 and the ability to get the user-facing URL of an object. So, after creating an object or reading an existing object, you can display it to the user in a browser, or try to do something automated with headless Chrome, etc.

2 Likes

This is updated to v0.1.3, which allows adding attachments to objects.

1 Like

I am not at all familiar with Python - or any coding really as it’s not my line of work. So not sure if this would work for my needs.

Is your solution pulling data from an external source and importing into Manager or the other way around?
I presume that this solution doesn’t deal with the gui front end as in the webpage view?
Does it matter what CRM one uses. My Helpdesk website uses .Net Framework aspx and Javascript files.

Essentially, what I would like to achieve (if possible is the following).

  1. Enable my clients to view exactly what they would see in the Customer Portal.
  2. Enable client to approve a quote, which in my line of business, could be achieved by them uploading their Purchase Order.
  3. Enable Clients to search in the same way we can do in the Main Manager Program. The Customer Portal has no search feature! Maybe the developer can add this as the functionality is already present in the main Manager program.
  4. Clients need to be automatically chased up to approve/decline a quote or reminded to pay overdue invoices after a set period of time such as 20 days. It would save having to chase up clients!
  5. Email the clients to notify that there is a new quote/invoice waiting for them to view. Essentially the same function as point 4, but for new quotes/invoices. It would make sense for the CRM to manage the Email functionality so everything comes from our CRM’s.

I have a helpdesk system where clients have a login, they can create/edit/view tickets and the system emails them whenever a ticket is created/updated/closed etc. I would like ideally to create a new page in the helpdesk which would effectively show what you would see if you viewed the customer portal, but with the ability to search, upload purchase orders and to receive email notifications reminding them about outstanding quotes/invoices.

I looked today to see if I can work out how the API works to achieve this. However, while I had no issues finding the Sales Invoices via API, I could not work out how to only display Sales Invoices for Customer A for example. In addition, all I am seeing with the Sales Invoices is the Key, Name and Timestamp rather than the Sales Invoice information such as Items being sold, quantity, pricing etc.

I just feel like it’s pointless re-inventing the wheel as the Customer Portal already shows virtually all the information that the customer needs to see. The only problem is that it doesn’t allow them to upload a purchase order, do searches and there is no email notification reminders of outstanding quotes/invoices or for new quotes/invoices.

Would it be possible for this Python module to link to the Customer Portal (or via api to show what the customer portal would show within whatever CRM we wish to use) and just add the extra functionality missing in the Customer Portal. This would make a lot more sense as the customer portal has nearly all the functionality require in that it displays only the quotes, invoices relevant for that customer, allows them to print the invoices as pdf’s using the browser pdf printer etc. If the API could somehow use the Customer Portal and just enhance it?

I see your most recent version - This is updated to v0.1.3, which allows adding attachments to objects - hopefully this could enable customers to upload purchase orders?

I just want to update where I am with this. I have created the following coding on a page on my helpdesk:

<iframe src="https://accounting-program-url/customer-portal" style="border: none; width: 100%; height: 600px;"></iframe>

I am delighted to report that this works flawlessly in showing quotes, orders, invoices and allows customers to print pdf invoices all within my helpdesk. One line of code has basically 95% of what my clients need to see! Very pleased. Originally I was not going to go with this method because I need more than view functionality. But when I saw how time consuming it would be to create the api, I am reconsidering as the customer portal does 95% of what I need and it’s stupid to re-invent the wheel.

I don’t know if Manager provides an embeddable widget or iframe for the Customer Portal? It would make sense to use the widget to get the height/width etc working optimally. @lubos can you advise on this point? My coding just uses a default height of 600px.

Given that I can embed the Customer portal on my helpdesk, I will look at the option of either using the api to connect back to Manager to approve quotes, upload purchase orders, or I think it might be easier if the customer could upload the purchase order to the helpdesk as the helpdesk already supports file upload functionality. All I would need to work out is how to present the view to the customer so that they can see the Customer Portal and simultaneously see an option to upload a purchase order that would reference whatever they are seeing.

So disregard my previous post. I don’t think an api is the best way for me to proceed. I suspect the best way would be to customise the view of the page embedding the customer portal and somehow link up with the Ticket view on that same page for uploading purchase orders. Maybe another embed lol.

1 Like

Hi, finally got to experimenting with Python and your module.
Unfortunately, my Python knowledge is very basic at the moment, and I can’t resolve this error about the module named ‘requests’ being “missing”.
Is this an external (third party) module I need to install or something else?

Sorry, I did a little searching and resolved the issue.
I needed to use…

  1. pip install requests
    then another missing module “pydantic” was missing. So, I…
  2. pip install pydantic

And it worked like a charm.
Thanks.

Sorry, I didn’t have a requirements.txt in the project, but I just added a basic one. It is on git, or it will come in the next release. You did the right things.

Hi Isotherm,

Great start, as we use Python, Go and RUST extensively. This project will help us greatly. We will also send upstream through pull requests any features we add and bugs we fix along the way.

Thanks for your help.
I’m experimenting with a little project to generate a unique SKU for a new inventory item using a tkinter GUI.

My code returns a validation error when trying to read the inventory data from the Manager.io API. The error message pydantic.error_wrappers.ValidationError: 1 validation error for InventoryItem indicates that there is an issue with the data returned by the API when trying to get an InventoryItem object.

The specific validation error CustomFields2 -> Decimals -> 973a30fe-448f-41e3-97ce-f2755c7e67fe none is not an allowed value (type=type_error.none.not_allowed) suggests that the value for the Decimals custom field with ID 973a30fe-448f-41e3-97ce-f2755c7e67fe is None, which is not an allowed value.

Do you think this issue could be caused by incorrect data in the Manager.io API or by a mismatch between the data returned by the API and the expected data format in the manager_api module?

Cheers

In your experience, how stable is the Manager API? Since there’s no official documentation.

I’m evaluating building on top of it for my company’s ERP. But I’m considering Xero too but it’s a SaaS and they can change the billing of it wildly.

My understanding is it has been reasonably stable for years but

The API is a bit unusual but seems to not change much and in general be backward compatible. Also, if you purchase server edition then you can continue using a certain version and keep the API frozen for as long as you like, making any upgrades and fixes for API changes on your schedule.

We have used it for almost a year now (using the above Python module) to synchronize various aspects, including Shopify customers/sales/taxes, reconcile bank and credit card statements, parse random emails and invoices that provide no API, etc.

Note that some things (e.g. report content) are not currently accessible via API. For this, we open a browser tab with the report and request user to “Copy to clipboard” and paste. It is a bit patchwork, but for us it is worth it to not use a cloud service.

Please search the forum for API and @Lubos. There will be an API 2.0 released soon that as stated by the developer is significantly different to the extent that people wanting to now to learn the current system are advised to wait for the new API system.