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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

How to insert data in Table " Contact (5050) " for external APP

(0) ShareShare
ReportReport
Posted on by 65

Hi,

I have a external Application , can i instert data in Contact (5050) Table outside of Business Central  ?

Thanks.

I have the same question (0)
  • Verified answer
    jdecottignies Profile Picture
    217 on at

    Hi,

    You can create a page of type API with source table as Customer, like this:

    page 50100 "API TestContact"
    {
        PageType = API;
        Caption = 'contact';
        APIPublisher = 'someApiPublisher';
        APIGroup = 'testapi';
        APIVersion = 'v1.0';
        EntityName = 'contact';
        EntitySetName = 'contacts';
        SourceTable = Contact;
        DelayedInsert = true;
    
        layout
        {
            area(Content)
            {
                repeater(GroupName)
                {
                    field(name; Name)
                    {
                        Caption = 'name';
                    }
                    field(address; Address)
                    {
                        Caption = 'address';
                    }
                }
            }
        }
    }

    Now if you want to insert in Contact you have to make an API Call to

    api.businesscentral.dynamics.com/.../someApiPublisher/testapi/v1.0/companies(<YourCompagnyID>)/contacts

    With POST Method and as a body:

    {
        "name": "someName",
        "address": "someAddress"
    }

    Bold words in url are defined in your Api Page Properties

    To retrieve <YourCompanyID> you must call Company/ endpoint before

    In Postman if you hit SEND with this configuration:

    pastedimage1579020761708v1.png

    it creates this contact

    pastedimage1579020793487v2.png

    Note that you cannot add a value to a field that does not exist on you page api object.

    If you want to post a contact and set his Phone Number, you'll have to add the "Phone No." field on your page

  • Armando Northware  Profile Picture
    65 on at

    I do this but ..

    Postman return this :

    {

       "error": {

           "code": "RequestDataInvalid",

           "message": "Request data is invalid."

       }

    }

  • Armando Northware  Profile Picture
    65 on at

    Do you need Authorization ?

  • Armando Northware  Profile Picture
    65 on at

    I resolve this but i have another error , how to get de ID Company ?

    {

       "error": {

           "code": "BadRequest_NotFound",

           "message": "Bad Request - Error in query syntax.  CorrelationId:  5cb-994-65-85-6ec3b62de."

       }

    }

  • Armando Northware  Profile Picture
    65 on at

    Thanks , I could already make the post

  • jdecottignies Profile Picture
    217 on at

    In Sandbox environment you can use Basic authentication:

    Username = Your BC UserName in your user card page

    Password = API Key field of your user card.

    For production you'll need OAUTH Authentication

  • Armando Northware  Profile Picture
    65 on at

    Thanks .

    I could already make the post .

    but  i need UPDATE data in the same way , how to do this?

  • jdecottignies Profile Picture
    217 on at

    Did you try to use PATCH method instead of POST ?

  • Armando Northware  Profile Picture
    65 on at

    No , but yo need in Contact the field "No." in  page extension you cant's use this column.

    "The name of field controls in pages of the type API must be alphanumeric.AL(AL0528) " o how to do the UPDATE

  • Armando Northware  Profile Picture
    65 on at

    Im use PATCH method and return this :

    {

       "error": {

           "code": "BadRequest_MethodNotAllowed",

           "message": "'PATCH' requests for 'contacts' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services.  CorrelationId:  f86724-94f-429-9829-d83853db."

       }

    }

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 2,238

#2
YUN ZHU Profile Picture

YUN ZHU 773 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 630

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans