Introduction to Business Central Connect Apps
Hello. And welcome to this video in which I will talk about connect. Apps for Microsoft, Dynamics, 365. Business, central, we'll. Go into a brief introduction, of connect apps and api's and. I'll show you how to use api's, and work with them my. Name is Daniel Rimmel suave and I'm a partner, with cloud ready software, one of the highest fee development, centers who can help you with just about anything, related to Microsoft, Dynamics, 365. Business, central I'd. Like to take this opportunity to thank my, fellow partner, at CRS I enjoy Coffman who. Has put together the material, for this video. The. Objectives, for this video are first, I'll, introduce the concept, of connect apps they. Have quite a unique place in the larger business, central ecosystem. Next. Since, connect, apps are built on api's, I will, talk about what api's, are and how they are relevant for business central, the. Third objective is, to give you a bunch of useful examples. Of how api's, work and how, you can access business central, data and business logic. Finally. I'll briefly go over Microsoft. Graph which, is Microsoft's. Platform to, publish api's, across. Multiple systems. Before. We get started let's take a moment and talk about Microsoft. Dynamics, 365. Business, central and provide, some context. To their concept, of apps, business. Central, is a business, management solution, that helps companies connect, their financials, sales. Services. And operations, to. Streamline, business processes, improve. Customer, interactions, and make better decisions. Business. Central is available, in the cloud and users, across various, types of devices and, it, is always up to date with the latest features. With. This modern business platform, you can easily tailor, the user experience. Extend. And build applications. So they fit your specific needs. An. Amex 365. Business central is one of the strongest, offerings, that, are available in the very rich ecosystem. That Microsoft, has created, especially. For, the SMB, space. Microsoft. Has made a big investment to integrate, business central with their Azure services, in SAS, products, such as office 365. Flow, power, bi and other power. Apps. Together. With the standardization, of connectors, and gateways and. The potential, of common data model and services, this integration. Is a very important, area of focus for Microsoft, so. The expectation, is that there will be a lot, of development, around those capabilities. Microsoft. Partners have the opportunity, to create products. And services, using. All of those standard SAS products, but they can also go beyond that, and build extended, functionality, that. Integrates, seamlessly with business, central. To. Learn more about this topic please watch the video about the Dynamics, 365. Business, central partner opportunity. Business. Central can be extended, by building, what we call apps we've. Categorized, this into three types of apps that you can build we. Look at these three app types from the perspective, of a customer, scenario, rather. Than focusing, on the technology, itself. When. We talk about embed, apps we. Are talking, about an end-to-end solution, where the entire experience, is provided, in a single solution you. Can think about a complete, package, that provides all necessary elements, for a legal firm or, a dentist. Office in these, types of scenarios you need ERP, you, need finance, management, you need inventory all, of those elements are then provided in a complete package. Due. To the way that embed absolute, provision. It is possible, to allow the partner, to directly modify, the base application, but. An embed app can be 100% extensions. V2 without any modifications. To the base application. Embed. Apps are not meant to be differentiated, purely, from a technology point, of view the. Details about embed apps are still being finalized, and we expect to provide more content, about this topic later. This year. From. A customer perspective add-on. Apps are apps that enable ISV partners, in.
Vardhan Is to extend business central with additional, capabilities. Built right into the experience, that, the end-user is used to and feels comfortable in. Common. Scenarios, are shipping inventory. Planning extended. Capabilities, around order creation. Banking. Payroll, anything, that goes beyond the capabilities. Of standard, dynamics 365. Business, central. Add-ons. Are rather unique to, online financial, system, most, competing, systems stop, at api's, but. Microsoft is taking this one important, step further by. Providing the, development, environment to actually, extend, the native capabilities. To. Learn more about add-on, apps please, watch the video titled an introduction. To and how to publish Dynamics, 365. Business, central add-on. Apps. Connect. Apps are for when a customer, needs to connect to different systems, payroll. Is a common, scenario where. There will be a separate, payroll system, and that system connects. To business central to send and journalize, for the financial, implications of, those, human. Resource lines. Another. Common scenarios is an e-commerce solution, where a website, connects, to a business central to, exchange item. And order information there are many other. Such, scenarios, where you would need to connect to business central from. An external system. Microsoft. Has made a major investment. In api's for you to use and in, this video I will show you the principles, of how that works, so you can get started building your own connect, apps. Our. First objectives, is to introduce connect, apps a. Connect. App establishes. A point-to-point, connection. Between Microsoft. Dynamics, 365. Business, central and a, third party solution, or service, this connection, is typically created using a standard, REST API to. Interchange data. Any. Coding language, capable, of calling REST API s can be used to develop your, connect app. Business. Central exposes, more than 40 standard, api's at this moment and more. Will be added over time. Online. Service, offerings, like payroll, expense, management, webshops, project. Planning etc, typically. Have many connection, points connect. Apps allow you to make connections, between those online service offerings, in your. Business solution, this. Connection, can be achieved on a data level without. Needing to do development inside, business center. Therefore. Reusing, those connection, points provides you with an opportunity to, reuse, your investment, from rest integrations. With other cloud services. Optionally. You can add a custom interface, in Dynamics, 365. Business, central which, determines, how your data needs to flow between business. Central and your online service, offering if you. Need to extend stained or business central capabilities. We advise you to watch the video about head-on apps. Creating. Your integration. Through an API provides. Simple access, to the supported, functionality. In, a common endpoint, giving. You a simplified, experience. For. Creating a single app with integrations, across, multiple Microsoft, products, these. Endpoints, use Azure, Active Directory authentication. To. Get access. This. Slide shows some examples of, connect apps that could benefit from being integrated, to Dynamics, 365. Business, central using connect apps. The. First example, is payroll, where the, payroll, system would read the chart of accounts you. Synchronize, employee, information. When you push payroll, transactions. To the Dynamics, 365. Business central ledger and. Expense. System, you, would collect and reconcile, transactions. In wahlid opted expense, apps. Web. Shops where you synchronize, items, customers, and other entities, to create sales orders and invoices and. Finally, financial. Systems, where. You read financial data you, provide value-added. Services, such as funding, and loans. Now. What's the difference between an add-on app versus, a connect, app.
And. On apps allow you to use the powerful customization capabilities. In. Business and, using. The provided development. Tools like Visual Studio code, and the, in client designer if your, connect app requires, a specific setup in business. Central then, you have the option to add objects. Building. Add-on apps requires, you to have deeper, knowledge of the logic and the data model of business central while, at the same time it allows you to integrate your solution, into business central. With. Connect apps you are not bound to the development, environment of, business central. Instead. You choose any development, platform, that is capable of taking advantage, of the simplicity of rest api's. Building. Connect apps you don't have to modify the user interface, of business, or business, logic of Business Central and, you will get an integration, on a data level only. Connect. Apps can be combined with add-on, apps in fact those two can complement, each other quite nicely. For. A next objective let's, take a look at api's. I. Don't. Want to go into too. Much detail about the technology, behind api's, but. This slide shows the highlights, if, you are interested, in any of these there are many websites where, you can read all about it what. I do want to mention are these, three points. API. Is in relation, to business central and in fact in relation, to all resources that are posted, on Microsoft, graph are. Based on restful, web services these. Web Services are stateless which makes them ideal for cloud computing and they are preferred, over soap web services, because they typically, use less bandwidth. They. Use HTTP. Requests. To call about web services, so there, is no need to install any additional libraries. Or software. Api's. Are used to get put. Post and. Delete, data I wanted. To mention those because you will see those in the examples, that I will show you in this video. The. Entities, in business central for which api's, have been published, like. Customer, and vendor item. GL. Account etc have, their own unique URL with. That URL you can get deep information. Of that entity in other. Words every, record in a table has its own URL with. Which you can get access to the data in the fields of a particular, record the. Tables of business central that are disclosed, by an API are, listed on the next slide. API. Is for business central are kept simpler, than the corresponding, back-end entities, they, do not expose, the full functionality, and internal, processing, fields, in, case you need more fields, added to the API is than it is possible, to request those from Microsoft, and they, might be able to add them in the future, and. In the future it will also be possible to create custom, api's when.
This Capability becomes. Available we'll, provide a separate, video about how to do. Custom, api's. Api's. Are built on the OData framework, and expose that standard, web services. This. Is the current list of available a pis for business central this. List is categorized, by functional, area, and it provides access to all major entities. In those functional, areas. There. Are well over 40, API is available and, more are being added in the very near future I'm. Not going to talk about each ABI in individually. But, this is a good start to some of the most important, entities, in business central a great. Deal of work has been put into making these API is easy for developers to use the. Ultimate goal is to provide as many of these api's, as possible, without, having to know or understand, the inner workings of business centrally. You. Can choose between several, endpoints. The Microsoft. Graph endpoint, and, the business central common endpoints, are used for production, you. Can also connect, directly to a tenant, with a tenant, specific, endpoint a tenant. Specific, endpoint, should contain the domain, of the Azure Active Directory tenant. In the URL. Authentication. With a Microsoft, graph endpoint. And the business central common, endpoint. Is done with Azure Active Directory credentials. Of the user, for. Direct tenant endpoints, you can also use basic, authentication, using. The web service access key of the user. When. You want to integrate with multiple, multiple, Microsoft. Products, then, the Microsoft, graph endpoint. Is the pervert endpoint for, scenarios where you only integrate, with business central you. Could choose the common, endpoint of business central and for development, and testing purposes, you, can use the direct tenant endpoint. In. The. Next section I will demonstrate how you can use the business central, api's, I'll. Tell you how to get a trial tenant, and how to set up your tenant, for API, access, then. We'll take a look at consuming, the web services, using a popular tool called, postman. To. Get started with api's, you need a business, central tenant if you don't already have one I'll explain how you can get one in this slide in the next a business. Central trial tenant, is linked to your office 365. Account, so. You need that account before you can create a business central tenant in. Case, you want a fresh office 365. Tenant to use you can request one from demos. Microsoft. Comm, an. Office 365. Demo tenant, contains, a list of users and will expire, after 90 days so. Inside demo at microsoft.com, you. Log in with your Microsoft, Partner, account and then. From the environments, menu, you select create. A tenant. Selecting. A location that has Business Central for, example, North America, if you, select, a location that does not have business, central you, will not be able to create a business central. Tenant. So, in here just select North, America or you, know another country, that you know if your, country doesn't have business. Central create. A tenant for Microsoft, 365. Business, demo content and then. From, the environments, menu you, select my environments. And then, you click the Create a, tenant, and then, after a while this, might take a minute you'll, see a new tenant pop up on this, screen. And. One. Thing you'll have, to, be. Aware of is that this username, admin. At and, then. A long, number dot on microsoft.com. And, the, password, will be important, when we go and, connect. To the. Web services, later on. With. Your office 365 email, called, the work email you can request a trial business central tenant, from trials, dot dynamics, com after.
The Setup has completed you can start to use the api's on this tenant. So. Go to trials. Dynamics. Comm, select. Business central, and you will only see business, central if you've selected a location for, which business, central has been published and then. You provide the email from, the new office, 365. Demo tenant, that you just created so. That's that email, address right here. And. Then you provide a phone number and then you click on get started you, can then login with the same email and the password from, the same demo tenant and now. You can login to business, central dot dynamics. Comm, and then, you follow the wizard to get the trial tenant started and that creates a new company, in that new. Tenant. Getting. Access to the tenant we. Are going to use basic, authentication because. This is a tenant, specific, endpoint, for. Development, purposes for. Production, purposes you would use Azure Active Directory and, you, use one of the common endpoint. URLs. And so, for our purposes, for, development, purposes we, can use basic, authentication against. The tenant specific, endpoint, so. In order for us to use basic, authentication we, need to generate a, web service, access key, and this, web service access key can be found in business central on the user card, by. Default the web service, access key is empty, and you'll need to generate, it for the first time. The. Endpoint, is a tenant, specific, endpoint, URL. That, contains the, domain name and so, the user domain, name comes, from that same spot so in, your tenant, this. Has m 365. And then along numbered on, microsoft.com. Those. Three elements after the @ symbol, that. Is the domain that, you will, substitute. In. The user domain, here for the endpoint, and so, I'll show what that looks like. Let's. Go into, our as. Your VM and just. Take a look at what that looks like. So. When I open a web browser and, I. Go into, business. Central dot dynamics, com, I. Can. Log in to my account so, this is that admin, at and, then the number on, microsoft.com. And. When I say it sign into there I will, connect to the trial tenant for business central. If. I look into settings, my settings, I have, selected. To Coronis USA company. When this trial. Tenant, was created, the, wizard created the kanto so company, and then, I selected. The Coronas company, because the Coronas company, has test data and the new company the kanto so company has, no data whatsoever, so I like to show some data later. On in the demos and so I selected, the Kronus USA, Inc. Test. Company, and so in, here, I then, go to the, user so I go into search I, go. To users, and, when I click on users, I see the list of users currently in the system I only, have admin, and that's not a coincidence because, the tenant was made with. The admin. At M, 365. With that number add dot, on microsoft.com. Account. So, when I look in here there's this web services, access fast, app, for. Me I already, have a value, in here, because I've generated. This previously. You. Can also click on change web service, and, when you click on that this, it regenerates. A new value and then you would copy that value for, the. Access. Key. Into. Postman. Now. It's time to connect them to the api's of the trial tenant to demonstrate, that I use the tool postman, the postman.
Tool Is an HTTP. Client for, testing, web services, they. Call it an API development, environment, or a de, it's. Really. Useful. To use because you have the ability there's. At Cape the capability, of creating. An environment, and having. Some environment. Variables. And so that, is those, variables, are then saved and you can refer to those variables, in URLs, and in other, settings. And you, can also create a number, of web service, requests, that think it can, be saved. As well so, if we go to. Get. Postman, com, that's, where you can download the tool and set. It up from there so. Let's. Go back into. The. Azure VM. And. I can show you where that is so, over, here we now. We. Can now create. Go. To get postman, and get. Postman, you have a download, the app link, and that will. Then install. It and so I've already pre-installed this. This. Is what postman, looks like you'll. See on the left hand side examples. Examples. Has a number. Of web service calls in them I've, saved, this in a file so I imported. That and then, another piece that we have on the right hand side here is the environment. And. So I have a template, environment. And when I look at the settings I have, a number, of. Variables. That are set. Up for this environment and the, one that I have already. Pre-populated. Is, the, URL and. If you look at the URL you. See that's the endpoint, URL with. The N 365. With that number on, microsoft.com. Endpoint. URL. The. Password. Is that, web service key, that we got from the user card in business central and. Admin, is the username so from, business central we're, actually. Using. This. Web service access, key as the password. Value. And we're, using this username as the, username in the, web service calls. Right. So. That's it that's how you set up post. Me and so, the first thing that we can do is we can go into the. URL and when we access, the URL we just have you know we access, this URL that's the base value. And, we click on send that, we'll get the list of api's, that. Are currently, available and, you can see here the name accounts, age accounts, payable, balance. Sheet cash, flow statement, these are a list of all, the api's, that are currently available. In, our, business. Central tenant. I can, also go into the metadata, which is the same URL, slash. Dollar, meta metadata, and what, that provides is the, XML, that describes, those. Api's. In terms, of properties, and and. And, data types and that sort of thing so you. Can, retrieve.
The. Properties, of the. API metadata. And use, that in your programming, for. A connect, app so this is important, information, for you to, get out of the. API. List out, of the endpoint. The. Next. Values. That we are going to use is. The company so the same URL, slash companies. When. We send that into. Api's. Into. The endpoint, we, get two. Companies, so the first one is my company that's the kanto so company. That was created by the wizard when we created the trial tenant, and the, other one is the Coronas USA, Inc, company. Which is part of the. Demo. Database and. So what we want to do is we, want to get information out, of business central, and since, business, central is always, specific. To the company, we, want to know. Exactly. The. Company, information so. Every time that we access. A web service, out of business central, we have to specify a company and so what, you'll notice in the return values, for all of these Web Services is we, always get one, of these IDs, and the ID is always one of those goods and those, goods are creative, for each and every record that is. Returned. Out of business, central and so for, us to be able to access those. Reza knows. Those, resources. We. Use the. ID value. To, access, it and so, what, we can do is we can copy this. And. We. Have in our environment. Excuse. Me in our environment, we. Have, a, variable. For a company ID and, so. If I paste this in there and I update, my environment. I can. Now go in here and say, okay, I want my company's, filtered. On that company ID and so when I click on send all, I'm getting back is a single. Jason. Node as, you can see. In, the other one we got an array so the, value is an array of. Jason. Values. In. The companies with that ID as the parameter, I only, get the single node back and, we. Can even go further than that, where, we say okay I want to have a single, property out of this. API. By. Saying I want, from. My endpoint. A list of companies, with. That specific. Value. And I, just want the, name property. Returned to me so when I send this back you, can see I get some JSON back where, I have a contacts, and a value so now the. The value, the key value pair is the, value, is. Coronas, USA, Inc. So, in the Jaison that comes back from a single company I get, ID with, a value, system version, with a value, name with a version and, if I get just, the name then, in here, I will, get value, Kronus USA. If. I were to say I want to get the display name only, the display, name. We. Can go in here and say this play. Name. And when I send that. It. Should get the, value Kronus, USA. Inc. So. Bad example. Let's go system, version. Just. To show, you that you can get a different value out of face so, the value, is now something else. Name. And display name was a bad example because they have the same value so, another. Thing, you. Can actually get, just the value itself, so, instead, of getting a, Jason. Node, back we, can actually get the raw value, of the value itself. And. That just returns that text string, so, you can imagine when you're building a Kinect app you, can actually go in there and build your URL, in such a way that you just get the. Raw value, of a property of an API. Back. Or you, get the JSON back, and then you have to program to to, get the value out of the Jason so you. Can both go both ways is, very flexible. Before. We go into more examples, I want to explain, some basics, of how to use business central, api's. First. Of all you can find detailed. Documentation. Of each API online, on Doc's top my kirsov calm, and. To get a list of the available api, she can just call the endpoint and, to see the metadata, with detailed, information you add slash, dollar, metadata, to the endpoint URL the. Resource, api is, represent. A resource, type, calling. A resource API will return a list of all instances, of the resource type for instance all. Customers. Or all items. Every. Single resource that list has a unique, ID I showed you the unique ID and the return value, of the companies and. If you want to read or modify, a specific. Resource, you need to provide the unique ID in the, IPA. API. In. The API, endpoint, URL, also. When you want to read a descendant. Of a resource, for example the lines of a sales order you, need to provide the unique ID of the parent resource, so, it's it works kind of like a filter and in, subsequent, demos. Willed. It will dig deeper, and deeper and drill down into how to get a parent child node. Back out of API. So. All the resources, as I said before live. In the context, of a company think. Of the company as the root resource, and all entities that belong to that company, our child resources. And so, all those api's, have. Endpoint, slash companies, with. The unique ID of that company, and then, we go deeper into the resources, that belong underneath, it so, it's like a hierarchical.
Relationship. Between those resources. It's. Also possible, to filter, the list of returned resources. For, example, all general, ledger accounts, in a specific category and, the, syntax for filtering, resources. Follows, the Microsoft, REST API. Guidelines. And so. We. Are going to go into, quite. A complex. Example. About payroll and so that will be the, next step. The. Payroll example, demo is an imaginary, connect, app to integrate, a payroll system, to Business Central let's. Set the stage before we go back to our VM. Imagine. If you will the following scenario, we. Have a business, central tenant in the cloud with all of our ERP functionality. We. Have a separate, payroll system also in the cloud is it, does its thing it calculates. Taxes, it does withholdings, all, that good stuff the. Payroll system reads the companies and the accounts, from the business central tenant. And then. It sends the payroll journal lines including. Dimensions, back into, business central. It's. Important, to note that for, this integration, we have not made any changes, to business central, all, that, we are doing is look at standard, business central api's, and, we are trying to identify the ones that we need to, integrate this the, to system so let's go to the azure VM. We. Are back in postman, and as. You'll remember we've. Read the api's we have read the API metadata. We. Know how to read, companies, we've identified the, company, in which, we, want to make the changes. And. We know now how to access, individual. Properties, of those api's, and so, the next step for our connect, app is to read the accounts. And that, accounts are the general, ledger accounts. So. When I run this this is again in the base endpoint. Companies. We specify, the company, ID /. Accounts. When. We send this we. Should get the entire list of G allocates, out of business central, this, list might be overwhelming, so, maybe what we want to do is we only want to see the liabilities. Because we want to create a journal. Line that, creates a liability to. Pay a salary, to. Enter. A filter you, specify. A parameter. A filter, parameter, so. If you look at the difference between these two I have, a get, accounts. This, is just the Euro companies specify, the company, ID / accounts. And then I want to set a filter and, so the filter you add a question, mark and then you set the parameter, and so my filter, parameter, is dollar. Filter, equals. Where category. Equals. Liabilities. So. If I look at my accounts list I have, a category value, here and, what we want to do is get just, the liability, so when, I get when, I send this request out I. Get. A list of GL, accounts, for, which the category, is liabilities. For all instances. So these, are just the liability, accounts, so, here, you see accounts. Payable yes, the income tax payable. Fut. A payable. Withholding. Payable, and here, we have an employees. Payable, account, so, that's the one that we want and so. What we do is we, take. The ID and. What we've done before is copy. This ID go. Into the template, or, postmen has a shortcut, for that so when you right-click on that you can actually set, the variable, and, so what we want to do is, set. The account ID in here and, when I go into. The. Template. For. The environment. I see. That the account, ID variable, now has that. Same value so in 9 for b76. This. Guy 9 for, b7, 6e etc, so, I'm trusting that that's the right one. To create a, journal. You have to know a little, bit about business. Central, in, order for us to create a journal line we, also have to have what's, called a journal badge and, so before we start creating journal, lines we have to make sure that, we have a journal, itself. For. This we have an, API for journals, so when I click on this example here the journals, again, this is the base URL company's, company, ID and now I have the. API for journals. If, I send this request I should. Get a list of all the journals that are currently in the system so, we have monthly, and we, have defaults, but, we want to have a, journal. Specific. For payroll. Entries. And so what, we have is we, have a. Requirement, to. Create, one of those journals, and so now what, we want to do is we want to post some so, before, you see that all these requests, are get requests, since. We are now creating a record a resource, in business central now, we have to use post.
Again. We use companies, with, a company, ID, specifying. Journals, and now we have to specify their. Values. And, so what, we want to create is a, journal. That is called payroll journal with, a display, name of payroll journal, batch, so, when I send this request in I. Should. Now get a response. Saying, I now have a, journal. Batch in business. Central that's called payroll journal and I have a nice ID to, go with it so let's, take. That ID and save. That into one of our variables. That's. Going, to go into, the journal, ID. Verify. This. I'm, going to trust it from ID. Oh. That's. The value, it, saves it at my variables, so, now when I rerun, the. Journals. I. The same request out now. I see that my payroll journal, is in, fact created, and, I can even double check this by going into business central. Dynamics. Come login. With my password, and my email. Now. I can search for journals. Click. On general journals, and, while. Out here is my payroll journal, so when I click on payroll journal, I can. See that there are no journal, lines in here the, posting, date and the GL account account, type are. Pre-populated. When you open, this screen that's, not really aligned. So. Let's, go back in here and, check. Whether, the, journal, lines, API. Actually, returns the same information, so when. I send this request out this, is companies, with a company, ID journals. With the journal ID that we've saved slash. Journal, lines so we can see the hierarchical. Relationship. We have companies, underneath, companies, who have journals, and related. To journals, we now have journal, lines and as you can see values. Is empty. Now. One thing in business central, and journal. Lines is that you have to have dimensions. Dimensions. Is also an API that you can read and. When we read the dimensions. We can see that we have two dimensions one for department, and one for customer group one. Of them is mandatory, so, let's set the, value, for the dimensions. Dimension. ID. Let's. Read the dimension, values, for that dimension, so, company's, company, ID dimensions, dimension, ID that's the one we just saved, and now we're going to go into dimension, values, dimension, values, is a child, of, dimensions. So that's the relationship between two. Now. We can read that we have production. And sales and administration in. The. Dimension values for department. In order, for us to create a journal line now we have, to use the same API that, we've looked at before right right that's the journal lines API only, this time we're going to post and, so when we post we have to specify the values, in a body so, at. This point we are going to use the account ID that's the value, that we've saved in our template we, have a posting, date we have a document, number an external. Document number, and this. Is the description salary, for Daniel I'm, not a cheap resource, depending. On the, currency. Of course and for, dimensions, we just specify. Department, and sales. Now. Let's say we. Are setting. This up for, today. So that, is. Six, and, this. Is. One. Let's, see if this works. It. Seems to have completed, so what, I can see now is that we have an ID for. The journal line. Let's. Save that. ID. And. We. Should have. Everything. Done so we can see that the dimensions, are part. Of the, journal line, the. Salary, is entered, in salary, for Daniel is also entered so let's go back into. Business central and verify. That, this came through correctly. We can see that indeed we have a document, number, the.
GL Account is the. GL. Account for. The. Employees. Payable, a. Description. Is salary for Daniel and it. Is set for. $1,000,000. So. This. Proves, that we have, a working API. We, can create journal lines we can set values, in there and. We can even go back in here and say we, want to get, rid of that journal line so let's see we have values. For journal ID you, have a value for journal line ID and. When I send this request in because, a million. Dollars is overpaid. It. Didn't return anything, so let's see what happened in Business, Central and, if we reopen, this batch, we. Can now verify, that that, line has disappeared so it no longer exists, so it must have been successfully. Deleted. And. This kind of concludes, our payroll. Example. So let's get back to the presentation. The. Business central api's, follow. The Microsoft, REST API guidelines. For filtering, as I've, shown you in the example when we filtered, the list of accounts for. More information, about filtering, and go to the, github, API. Guidelines. Repository. To. Eat more about it. The. API endpoint. Is based, on the OData, platform. The. Endpoint on business central is always, on you don't have to configure anything for it and as, you can see the endpoint does not specify the tenant, itself, the, aad authentication. Takes care of identifying. The tenant API. Endpoints. Can also be used with on-premises. Installations. By. Default it is disabled. But you can enable it by changing the setting in the server settings, the. Setting for API services, can be found on the OData services. Tab in the administration. Console this, is also applicable to docker, containers, that you may created, for local development, the. Response, of a business central API has a structure, with a number of fixed characteristics. As we. Have seen in the postman examples, every resource has an ID in the form of a gooood this. Is a unique identifier that, is assigned to the resource, that must be used in the URL to. Get a single resource, remember. We first retrieved, the full list of companies, and then, when we wanted to provide the ID for, the company that we wanted to use we. Provided, the ID for, that company, in the URL. Another. Important, piece of API puzzle, is the OData D tag property. In all resources, this. Is known as the entity tag which, is part of the HTTP. Protocol. Business. Central uses etags, for optimistic, concurrency control, to. Prevent simultaneous. Updates, of a resource overriding, each other an e-tag. Is an identifier, that is assigned to a specific version of the resource when. The resource changes, a new and different etag, is assigned to that resource so. When you want to update an existing record you have to provide the e-tag, of the resource, that you want to modify to make sure that you are updating the last version, or the latest version. Business. Central keeps track of modifications. And provides, an extra, property called last. Modified, date time, with every resource, let's. Go back to the azure VM, and I'll, show you the e-tag in postman. So. Back in postman, I want, to show you that, employee list so. Back, in this endpoint. Companies. We specified, a company, ID and now we're looking at employees. When. I send, this request I get a list of all, the employees that we currently have, and. The first one is William, Roberts I see the display name is William Roberts. And. What I want to do is I, want. To change. His first name to Bill, what.
We're Going to do. Is. Use. The patch command, so a patch is a command, to use for, update, so William. Roberts. We. Want to change that, -. Bill, bill. Roberts so, let's send that in and. Now. We can see the. Control display, name is read-only so, that's a bad request so let's go back and see maybe. If we can look, at that so display name is William Roberts we have a given name William, we, have a surname, Roberts. So, let's, change, this, to say, given. Name. And. Now it accepts, it so it says the given name is Bill the surname is Robert the display, name is Bill Roberts Ed puts those two together. Now. As. You. Can see, we. Have ID of, that employee. Which. I had to save. In the employee, ID in order for us to be able to modify. The. Record but, we also have an e-tag, so. One thing in the patch command, in the. Headers there. Is a thing called if match currently. We have that set to asterisk, so. We're basically telling it to ignore, the. Value. Of the e-tag now, when. I changed, it the, e-tag, was, changed, to jzq. 0:03. But. The old value, was. J, zq. O 3fx. So. It's. Slightly. Different, than this one so let's see what happens, if. I. Use. The, value, of the e-tag. Now. I have to copy, it. Let's. Go into the header. And. We paste it in here and I just happen. To know, that. I need to remove. The backslash, now. If I send. This command I. Get. The message another, user has already changed, the record and that's, not unexpected because. Remember when we first got the employees, it said. William Roberts and I know we, know that this is an old version of the record because we just changed the first name to Bill and so, the e tag keeps. Track of that so when we said the e-tag must be the, same as, that. Old version, now, it says another user has already changed the record because it, interprets. That as you're, trying to update an, old, version of the record, so. That's what, that etag does the e tag kind of makes. Sure that you, can only change the record if you're, looking at the, right version a.
Resource. Can contain a link to related entities. An. Example, is a sales, invoice which has related invoice, lines or related, customer, information this. Can be used in the URL to include, the related data in the returned resource, or to, link directly to it as a child, member, I'll, demonstrate that, with two, examples, so, in here. On your screen in yellow, you see the navigation property. Of the, API definition the, metadata, of. So. If we go back into. Postman. Remember. When we got the api's. This. Is just a list of all the API so it doesn't provide. Any information, about the relationship between the two for that we had the metadata, so. When you look at the metadata. And. For, instance you search for. Journal. Lines. It. Has three results. The. First result is an entity set that's underneath, the company the. Second, one is Journal. Lines that. Has a negative, property. Underneath company, well I must have. Jumped. Right to the other one and. Then the third one is where. The journal, lines is related. To journals, so you can have the, journal, and then, journal, lines related, to the journal so part of identifying. The journal lines is by, having that link into the journal so you do journals, you, specify, the journal ID then. You do journal lines and that retrieves, the, journal lines that are related, to that resource, and so, this is in the mate metadata. That's, where you can find the information on, how. Those relationships, work. The. Expand, feature. Combines, the Parent Resource and, one of its related entities, as defined, in the navigation, links so. Let. Me show you an, example of. That. So. Let's go down the list of examples. Over here we have sales invoices, this. Is a familiar structure, right with our URL. Companies. With the company ID and this gives me back all the sales invoices, from, that company. So. Now I have a list of sales. Invoices, and, let's just grab the first one so. We copy. The. ID, of. That sales invoice. ID. Right. So this is the list of all, the, invoices, if. I, do. The same API. But now I specify, the sales invoice ID I should, get just, that sales. Invoice right. So this is that one, single, in a sales invoice and then, of course we have sales invoice lines that are related, to that sales. Invoice ID, and. When we send, that request in I get, one. Line so, I'm not lying I have, an item ID, and. I have a bunch of other things. Now. About the navigation properties. We. Can use the dollar, expand. Parameter. To. Define. What you want to do so we, know that from the metadata, that we have sales invoices, and that, we have sales invoice, lines that is related to sales invoice so by using the. Expand, parameter, right see the, question. Mark on the, left hand side is that API. On the right hand side are the parameters, so, now I set the parameter, for, expand, to. Go fetch, the sales invoice lines that are related, to the sales invoice.
So. When I send that I. Can. See this is the same sales, invoice, right. That's that inv, 103. Of five, that's. The same one that we had here. 305. But. In addition. To. The. Invoice. Header, information. Now. I also, have the. Sales invoice lines information. And so that's the same room guests chair, so, remember, in the sales invoice lines the room guests chair that's, the invoice. Line that, was in there so now we have the sales invoice plus the lines in a single, request. Another. Way to, get related, information, is to. Have, linked. Information. So, now we have sales invoices, and we. Have a customer. Number link so, this is a way to get the, customer, information, from, that sales invoice, so the. Request. Is to provide, customer, information, what. Customer information the. Customer, that's on this particular, invoice so when I send this, request in what. I get back is customer. Information and this. Is the alpine ski house and that is all. Customer. Information. The. Next interesting, functionality, is the deep insert, which, enables, creating, a tree of related, entities, in a single request. So if I go back into our. VM. What. You would expect, normally. Is to. Create, sales. Invoice, by using. The sales invoices, and, then create a post request in the, body you then provide, some header. Information and, then, you have a sales invoice line request, where, you specify the. Sales invoice, lines in a post request where, you specify the invoice, ID and that creates. The. Sales. Invoice lines related, to that header at. The same token you can also use a deep, insert, where. You create, a single. API, request, where. You say external, document, number invoice they do data etc this is the header information and, then, you specify sales. Invoice, lines right. That's the sales invoice lines. API. That's related, to my sales invoices, where. You specify, an, item. ID and. Quantity. And so. When you run this that creates an invoice with, a line already specified. For. That item ID. Now. When calling these api's it can happen that an exception, occurs the. Business central platform returns. Error codes in different categories each. Error code starts, with a category, name followed, by an underscore and then, the error code this allows you to distinguish, between the exception, types and give, the user a message, for example the user should handle authentication. And authorization.
Exceptions. By providing, different credentials but. Internal, of application. Exceptions, should be handled. Internally and, the user should not see error message, that they can't handle and, so for reading. More about the, error codes here's the link on Doc's. Ap, ice should, be a very reliable resource. To work with updates, to the API will never contain, breaking, changes, for. Instance removing. A field or requiring extra, parameters. Instead. There will be a new version of the API which will be reflected, in the URL in case, there is a new, version it will be communicated. In all changes. For. Development, and testing, user name and password, simple, authentication is, used, but. For production. As your active directory is, used, the, permissions, are managed by Dynamics 365. Business, central user. Permissions, and the scope is also managed through graph and your. Active Directory. Final. Section of this video is about graph there. Is enough to say about this topic to fill an entire set, of videos for. This particular, video that I will keep it very brief into the point. Microsoft. Graph is the gateway to data, and logic across, a variety of Microsoft. SAS products, and services, provides. A programmability, model, that can be used to take advantage, of the enormous amount of data and apps across, Microsoft's. Offerings. Microsoft. Graph provides access to a large number of api's, think, about as your services, office. 365. Services, such as Outlook, and exchange, onedrive. OneNote. SharePoint. And of course the office applications themselves. And. Many many many, more the. Power of graph is in, the relationship, between all. The resources, that are provided, on this platform you can, imagine a person with an Outlook account can, belong to a group in teams and share office 365. Files and documents, on SharePoint you. Can build apps that can utilize the relationships, between the products, and services, and perform. Any action, that you can imagine with those resources, through the api's, Graf. Comes, with an explorer that you can use to examine the relationships, and see how you can combine those for your benefit, some, popular requests, revolve, of course around people and their interaction, with each other, there, are api's to get profile, information, related, files and photos access. To mail and calendar events and so on and so forth. The. Way that the api's, are provided, on graph is by using one. Endpoint, to access, all of it. HTTP. Slash, graph. Microsoft. Come inside. In the screen you see a number of. Requests. That you can enter for those things that I just mentioned and of, course for business central api's will also become available, in graph all, in, a common endpoint to access all of those resources. It's. Then up to you to connect the dots and build the next awesome apps. Consumers. These days are not bound by their home computer, anymore they have a multitude of devices, at their disposal and they could not care less where, they access, their stuff as long. As it works properly and it connects them together seamlessly. Graph. Was envisioned, to be agnostic, when it comes to development environment. Device. No. Matter what your development, platform, of choices, no matter what device you target, as long. As you can build apps that can consume these api's, you, can create connect, apps than, the only limit that remains is whatever you can imagine. So. I've given you a lot, of information let's. Just, summarize this, a little bit main. Takeaways, are that connect. Apps integrate, through new rest, ap is the. Alternative, to add-ons, depending, on requirements.
The. Authentication. Model is the azure active, directory. We. Have a common, end points that's API dot business central dot dynamics, comm, and it. Will also be exposed, in Microsoft, graph. What. Is in store next, Microsoft. Is going to add bound, actions, in the API and of, course they are constantly, adding additional, api's. They. Are going to publish the api's, in Microsoft, graph, they'll. Add Delta supports, optimized, Active, Directory management. Experience, and support. The dynamics, 365. Business central. On-premises. How. To proceed. From here get. A tenant and play with the API s-- get, started by using the first link on your screen for, a quick connection directly as access. The tenant URL, and use the basic authentication, by, way of the web service access key which I've shown you in this video give. Microsoft, some back if there are any missing entities, if, you'd like to see some entities, be added, to the api's, maybe. There are some fields that you're missing that you would like to get access to maybe. You have some requested, methods some bound actions, that you want to. Add to the api's go. To the github repository and. Enter, a an. Issue they, will look at it and see if they, can add it and then of course start. Building connect apps go, to the link at the bottom of your screen the. AKMs. Slash a business, central connect, apps and be, part of the first wave that. Was, really it for, this video leave, this slide up with. Some really good resources for, you to browse for yourself, there. Are some information, about OData, there's, some, information. About the business central, api references. And of. Course Microsoft graph. You. Go to Microsoft, graph there. Is a ton of information, to see on there, as well. That's. All for this video follow. This last link to learn about business central, apps I want. To thank you so much for taking the time to watch this video hopefully, you have found it a good use of your time have. A wonderful rest, of your day.