Notifications
Announcements
No record found.
Hello, I want consume a External API to auto complete customer address on Business Central , I would like to know what is the best option to do this . APi is https://getaddress.io/Documentation .
Hello,
We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist. If you need assistance with debugging or coding I would recommend discussing this on one of our communities.
www.yammer.com/dynamicsnavdev
dynamicsuser.net/.../developers
I will open this up to the community in case they have something to add.
Thanks.
codeunit 50100 "GetAddressIntegration" { procedure GetAddressFromPostcode(Postcode: Text; var Customer: Record Customer) var HttpClient: HttpClient; HttpResponse: HttpResponseMessage; ResponseText: Text; JsonObj: JsonObject; JsonToken: JsonToken; AddressesArray: JsonArray; Url: Text; ApiKey: Text; begin ApiKey := 'YOUR_API_KEY'; // Store securely in a setup table or key vault Url := 'https://api.getAddress.io/find/' + Postcode + '?api-key=' + ApiKey; if not HttpClient.Get(Url, HttpResponse) then Error('Failed to connect to getAddress.io API.'); if not HttpResponse.IsSuccessStatusCode then Error('API Error: %1', HttpResponse.HttpStatusCode); HttpResponse.Content.ReadAs(ResponseText); JsonObj.ReadFrom(ResponseText); // Extract first address for simplicity (you could add a selection UI) if JsonObj.Get('addresses', JsonToken) then begin AddressesArray := JsonToken.AsArray(); if AddressesArray.Get(0, JsonToken) then begin SplitAddress(JsonToken.AsValue().AsText(), Customer); end; end else Message('No addresses found for postcode %1.', Postcode); end; local procedure SplitAddress(AddressText: Text; var Customer: Record Customer) var Parts: List of [Text]; begin // Address comes as a single string, e.g., "10 Downing Street, London, SW1A 2AA" Parts := AddressText.Split(', '); if Parts.Count >= 1 then Customer.Address := CopyStr(Parts.Get(1), 1, MaxStrLen(Customer.Address)); if Parts.Count >= 2 then Customer.City := CopyStr(Parts.Get(2), 1, MaxStrLen(Customer.City)); if Parts.Count >= 3 then Customer."Post Code" := CopyStr(Parts.Get(3), 1, MaxStrLen(Customer."Post Code")); // County isn’t always explicit; you could extend logic or use API’s formatted_address end; }
Hi
Yes, you can consume external APIs like getAddress.io in BC to auto-complete customer addresses. The most effective approach is to use AL code with HttpClient and pair it with a custom page extension to trigger the lookup.
Implementation Notes:
Here’s a screenshot showing how to structure the HttpClient call and parse the JSON response:
Helpful References: How to Connect to External APIs – Business Central Geek GitHub – API Consumption Examples REST API Web Services – Microsoft Learn If you find this helpful, feel free to mark this as the suggested or verified answer. Cheers Jeffrey
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
OussamaSabbouh 3,329
Jainam M. Kothari 2,250 Super User 2025 Season 2
YUN ZHU 1,365 Super User 2025 Season 2