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

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

D365 Business Central, we need to create records into Items using C# code

(0) ShareShare
ReportReport
Posted on by 2,100

Hello All,

We need a requirement to create our own C# WebAPI project that will connect Business Central and inserts/updates data into Items.
After doing a search, we found that this is possible using Business Central APIs like given in the link below.
Here, we are not able to understand,
  • How should we connect to Business Central?
  • How can we call items API and what the parameters are?
  • How can we see list of available APIs?
  • Why do we need to create other connect apps?
If somebody has the C# code snippet/example please share with us, it will be really helpful for us.
OR Are there any SDKs available same as like CRM SDKs?
I have the same question (0)
  • Suggested answer
    JAngle Profile Picture
    131 on at
    RE: D365 Business Central, we need to create records into Items using C# code

    Your questions answered in order -

    1. For connect apps I believe OAUTH2 is the requirement. So a user license will be needed. The connection itself can be a URL or defined endpoint. Here is a guide on connections: docs.microsoft.com/.../endpoints-apis-for-dynamics

    2. Here is the GET method for the standard BC API: docs.microsoft.com/.../dynamics_item_get

    3. The link from 1 or 2 has a “Table of Contents” button to show a full defined list. It is possible to use ODATA or SOAP web services too. Searched for the web services page in the application for that. You can then add objects to handle certain scenarios.

    4. If the existing set of connections don’t meet requirements and if you want to sell on the connection to others. Connect apps as a concept is more for passing it on to other ppl and sticking to a defined set of requirements. Integrations in general don’t have to use is. Depends what you want to achieve overall.

    No C# snippet but this old video shows some of that language in use for a NAV web service integration so will assist: https://youtu.be/umcwT6TmWX8

    A details on how to develop will either be on MS Learn or do some search engine work. Always have Business Central or NAV at the start of the search.

  • JorgeRamirez Profile Picture
    21 on at
    RE: D365 Business Central, we need to create records into Items using C# code

    Here is my answer:

    How should we connect to Business Central?

    The best way to connect is using web services using ODATA. There are several web services already active for the current table, in the BC sandbox do a search for web service and use the ODATA or SOAP links in there. If you need to create your own just create a card and add your object in that list and Business Central will automatically enable a web service for you. Use Postman to test it, just add the userid and the password which is the web service code (you can find it under any user´s security profile)

    How can we call items API and what the parameters are?

    Every web service is different but use this it will save you a lot of time, trust me. No need to add a reference in C#:

    using System.Net;

    using System.Net.Http;

    using System.Net.Http.Headers;

    using System.Text.Json;

    using System.Threading.Tasks;

    using WebAPIClient;

    namespace ConsoleApp4

    {

       class Program

       {

           private static readonly HttpClient client = new HttpClient();

           private static async Task ProcessRepositories()

           {

               client.DefaultRequestHeaders.Accept.Clear();

               var stringTask = client.GetStringAsync("api.businesscentral.dynamics.com/.../Company(\'"   "CRONUS MX"   "\')/<YourWebService>");

               var msg = await stringTask;

    As simple as this.

    How can we see list of available APIs?

    Search for web service in business central it will display the list.

    Why do we need to create other connect apps?

    I'm not sure what you mean by this, but just create in AL your table, your card and your list using VB code, then add it to the web service page in BC. Run the C# VB Code in Visual Studio.

    If you have questions feel free to contact me.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,377

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,696 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,512 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans