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 :
Small and medium business | Business Central, N...
Suggested Answer

Getting data from a Dynamics Nav web service

(1) ShareShare
ReportReport
Posted on by 77
Hi,
Is there any way to connect to Dynamics NAV 2018 Odata V4 web service with Business Central Saas?
I am trying to get the data from a web service, this is the code I use:
var
    Client: HttpClient;
    Request: HttpRequestMessage;
    Response: HttpResponseMessage;
    Content: HttpContent;
    JsonResponse: Text;
    JsonObject: JsonObject;
    RecordJson: JsonObject;
    ServiceUrl: Text;
    Username: Text;
    Password: Text;
    companyinfo: Record "Company Information";
begin
    companyinfo.FindSet();
    ServiceUrl := 'http://192.168.1.1:7049/DynamicsTest/ODataV4/Company(' + companyinfo.companyserviceweb + ')/customers';
    Username := 'SERVER\SYSTEMTEST';
    Password := '123456';
    Client.DefaultRequestHeaders.Clear();
    Client.DefaultRequestHeaders.Add('Authorization', 'Basic' + Base64Encode(Username + ':' + Password));
    Request.SetRequestUri(ServiceUrl);
    Request.Method := 'GET';
    if Client.Send(Request, Response) then begin
        Content := Response.Content();
        Content.ReadAs(JsonResponse);
        JsonObject.ReadFrom(JsonResponse);
        Message(JsonResponse);
    end else begin
        Error('Error: ' + Format(Response.HttpStatusCode));
    end;
end;
 
If I connect from the browser it asks for the credentials and I add them, it allows me to access the web service, but I can't get the information from the web service.

     
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    99,983 Super User 2026 Season 1 on at
    This is a local IP address, http://192.168.1.1.
    BC cannot access the local PC, including local folders, etc.
    If you make it public on the public Internet, BC should be able to access it. I think this is the problem.
     
    Hopefully other experts can give you better advice.
     
    Thanks.
    ZHU
  • Gerardo Rentería García Profile Picture
    26,096 Most Valuable Professional on at
    Hi
    I agree with what our colleague mentioned.
    Here some useful information. 
    BR
    GR

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,796 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 965 Super User 2026 Season 1

#3
Teagen Boll Profile Picture

Teagen Boll 664 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans