We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Python module for Manager API | Forum

Topic location: Forum home » Support » General Questions
idayrare corded
idayrare corded Dec 5 '23

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!

Rajesh Rajpo
Rajesh Rajpo Dec 5 '23
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.
William Hopster
William Hopster Dec 5 '23
Producing a Python module for Manager API sounds like a valuable endeavor, and I'm sure it will be appreciated by many users. To address your questions:
While UUIDs may stay consistent between businesses, it's a good practice not to hardcode them, as they might change with Manager upgrades or if endpoints are modified. Looking them up dynamically would be more robust.
You're right that some endpoints aren't shown unless they exist. One approach is to explore the API using a test business or a sandbox environment to discover all available endpoints.
Finally, Retrieving datatype info from self-documentation can be tricky when values are null. You might need to rely on naming conventions or examples provided in the documentation. Alternatively, you can use trial and error in a test environment to understand expected data types.
And if you're diving into API-related topics, exploring the performance testing definition can indeed help ensure your module works efficiently.
Ijana
Ijana May 15
How can I better understand the Factory pattern in Python and its application?
Olivia Grant
Olivia Grant May 15
Greetings, I remember having a long time to figure out this pattern myself and finding it very complicated, but understanding it can greatly improve your approach to creating objects in your code. I suggest you take a look at the developer  module on learning Python and specifically the Factory pattern , In this module, you will find detailed explanations of the pattern concept, examples of how to use it, and assignments to reinforce your knowledge. Studying this module will help you become more confident in using the Factory pattern in your Python projects.
The Forum post is edited by Olivia Grant May 15