web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Creating and Updating entities using REST API in Python -- completely out of my depth

(0) ShareShare
ReportReport
Posted on by 5

 Hi there,

I am completely new to Dynamics 365 so there's a lot of terminology that I don't understand, and reading through the documentation has been overwhelming and mostly (seemingly) unhelpful towards my specific use case. I am also unsure how much of this use case is possible through the API. With that in mind, I apologize if my language is unclear.

I am hoping to create an application for D365 F&O that would complete the following steps through the API:

  1. Create a new legal entity
  2. Add a dashboard image to the legal entity
  3. Insert new legal entity into an existing Organization Hierarchy, then publish changes
  4. Edit ledger for legal entity
    1. Add main account for each "Posting" under "accounts for currency revaluation"
  5. Update Posting validation Posting Type
  6. Use a "Data project" called "Copy into legal entity projects"
    1. run a project called "Create New Company" to copy a base company's data into the new legal entity
    2. run a project called "Copy - Methods of Payments" to copy same base company's payment methods into the new legal entity
  7. Generate new number sequence by selecting all existing number sequences
  8. Import purchase order workflow into legal entity from source company (using Procurement and Sourcing Workflows)
    1. export workflow from source company as a downloadable xml file
    2. import xml into new legal entity
    3. mark imported workflow as Default and make it active
  9. Use a custom Data Project under "Copy into legal entity projects" called "Journal Names"
    1. copy source company journal names into new legal entity
  10. Update Sales Tax Currency Code
  11. Under General Ledger > Chart of accounts > Dimensions > [Custom Dimension], make [Custom Dimension] active
  12. Use a custom Data Project under "Copy into legal entity projects" called "Copy - GL Parameters"
    1. copy source company General Ledger Parameters into new legal entity
  13. Set additional General ledger Parameters
    1. enable/disable Reversed charge depending on certain criteria
  14. Set Procurement and sourcing Parameters (General)
    1. set "Purchase type" under "DEFAULT VALUES"
    2. set "Prompt quantity field value when posting documents" under "SETUP"
    3. set "Purchase order prices/amount" under "VENDOR"
    4. set "Activate change management" under "CHANGE MANAGEMENT FOR PURCHASE ORDERS"
    5. set "Copy PO line dimension to header" under "DIMENSIONS"
  15. Set Procurement and sourcing Parameters (Delivery)
    1. set "Accept underdelivery" and "Accept overdelivery" under "GENERAL"
    2. set "Number of batch documents" under "BATCH"
  16. Edit "Purchase Requisition expenditure reviewers"
  17. Edit "Vendor invoice expenditure reviewers"
  18. Add new legal entity to Procurement Policies
  19. Under "Accounts Payable", copy all vendors from source company to new legal entity
  20. Update Ledger Period status under "Ledger calendars"

Understandably this is a lot of steps, and I have tried to be as concise as possible while also providing the proper names that I can see within D365.

The main question I would like answered is if there are endpoints for each of these steps that would allow me to automate them using API requests. I have read through significant portions of the Microsoft documentation on D365 Finance & Operations, but I have found very few references to specific endpoints. Ideally I would love to see just a list of API endpoints.

Again, my knowledge of D365 is quite limited as I am very new to it. Any ideas that would point me in the right direction for automating any or all of these steps would be greatly appreciated.

I will do my best to answer any questions as I am sure there are many ways that I can elaborate.

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    303,730 Super User 2026 Season 1 on at

    Hi demarshall,

    Reading the steps you want to accomplish is overwhelming to me. ;)

    What is the exact reason for automating this? Do you expect to create a legal entity on recurring basis? Why do you want to do it with an external application?

    You can interact with the application by using data entities. You can read, insert and update information, but if the data entity supports it, also some actions can be executed. Probably not for all your steps there are data entities available. In case you are missing data entities, you can development new ones or extend existing entities.

    If you can tell the business reason for automation of creating legal entities, I can share my knowledge what we did at another customer having over 2000 legal entities for client accounting.

  • demarshall Profile Picture
    5 on at

    Hi Andre,

    Thank you so much for the prompt response.

    This would be on a recurring basis as needed. In concept, the program would receive and parse a word document with the details to create the legal entity -- this document is from an external body so I don't have any say over that unfortunately. My understanding is that going through these steps manually just once takes upwards of 3 hours, so I have been tasked with automating the process to save quite a few hours of tedious labor.

    My hope is to automate this with Python as that is my primary programming language, and at the beginning of this project it seemed to be the best avenue. I am very curious to hear about developing new entities and extending existing ones.

    Let me know if I can clarify anything further.

    Regards,

    Davis

  • MYGz Profile Picture
    2,334 on at

    Hi demarshall,

    This will take a whole lot of code understanding of various modules and lot of testing before hitting it right.

    Considering you already know how to do it functionally, how about using selenium(or similar) to achieve this?

  • demarshall Profile Picture
    5 on at

    Hi MYGz,

    I have considered using Selenium or a similar library, however my concerns around that solution are twofold:

    - Any changes made to D365 by Microsoft or the client would break the solution -- considering the number of steps in this solution, it seems highly likely that this could happen.

    - Again considering the number of steps and loading times, a Selenium solution would be highly inefficient and would not save as much time.

    I am willing to go through all the testing and understanding if I can come out with a much more ideal solution. Perhaps that is wishful thinking, I am open to being corrected on my above concerns.

  • Alex VN Profile Picture
    1,994 on at

    Hi Demarshall,

    With this kind of request I would suggest you to do both side development for a more efficient result:

    - Creating custom service and implement X++ code to do the action that you need to do. You can use runnable class to test the function from D365FO first

    - Then implement REST API call to call the service from Python program as your listed action might not be available out of box.

    Ref:

    docs.microsoft.com/.../custom-services

    Hope it helps.

  • demarshall Profile Picture
    5 on at

    Hi Alex,

    That is a very helpful suggestion, thank you.

    Is there an easy way to tell which actions may not be available out of box? Other than attempting to use the REST API for an entity and it returning an error?

  • André Arnaud de Calavon Profile Picture
    303,730 Super User 2026 Season 1 on at

    It is hard to mention which data entities and actions are available and suitable for your needs. It would require some investigation. Every missing entity or where the standard is not working correctly, would then need a customization.

    As mentioned, in the past, I worked at an implementation where new legal entities were added quite regular; almost daily. That was on an AX2012 implementation where for almost all our required tables there were no standard data entities. Now in Dynamics 365, there are much more standard data entities.

    We solved it in the next way:

    - Per country we had a template legal entity with all related settings.

    - A new periodic option was developed to import an Excel sheet with basic information to create a legal entity with also the required ledger settings. Per LE, there was a choice for what CoA to use. Also the LE was added to a organization hierarchy for security management purposes.

    - For copying the setup from the template company, this customer used Connectivity Studio from To-Increase as they already had this solution and developing new data entities was too much time consuming. Connectivity Studio offered flexibility for different scenarios as all is based on configuration instead of development.

  • demarshall Profile Picture
    5 on at

    Thanks again for the response Andre.

    How can I discover for myself which data entities and actions are available? Unfortunately the added cost of Connectivity Studio will likely not be an option.

    Could you also elaborate on what you mean by a "periodic option was developed"?

  • demarshall Profile Picture
    5 on at

    Hi Alex,

    One additional question for you: is the only way to create a custom service through using Visual Studio? It seems like that may be the case.

  • André Arnaud de Calavon Profile Picture
    303,730 Super User 2026 Season 1 on at

    There are a huge number of data entities available in the standard application. A person with experience will be able to find a lot and knows how to search. If you start with limited knowledge, it is hard to find your way. You will need to invest some time to validate all or hire someone who can help you.

    The periodic option was a runnable class which could be opened from a menu which did have a dialog with a few parameters, such as the file name with legal entities to insert and some other generic information. These fields could also be provided within the file. Based on the information, we created the legal entities with already some base information.

    Your preference seems to be with data entities, which is OK. If you also have a template company, you can use some data management tools to copy data between legal entities. Anyway, the biggest challenge for you would be to find the correct entities and in case of missing ones, start a development cycle to add new ones.  

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 616

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 460 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 331 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans