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...
Suggested answer

Business Central API integration with DHL API Service URL, API Key and API Secret

(0) ShareShare
ReportReport
Posted on by

Hello Experts,

I would like to get the shipment status update in Business Central itself instead of redirecting into shipment agent website. Hence I want to integrate DHL API service with BC. DHL has enabled the API Services for me and shared the API Key & API Secret. 

I want to get the response from DHL API Service by a button click in Business Central page. How can integrate DHL API service with BC using DHL API Service URL, API Key and API Secret?

Thanks in advance for sharing your thoughts.

Best Regards,

Ranjith E S 

  • Suggested answer
    Gianfranco C. Profile Picture
    370 on at
    RE: Business Central API integration with DHL API Service URL, API Key and API Secret

    i have also integrated the calls to DHL. i am using user and password (the example ones are demo-key, demo-secret), i think they are the same for the ones you mean API-Key API-Secret. the code i use is this:

    procedure DHL_HttpRequest()
    begin
        Token := AddHttpBasicAuthHeader('demo-key', 'demo-secret);
        RequestMessage.SetRequestUri(URL);
        
        Headers := Client.DefaultRequestHeaders();
        Headers.Add('Authorization', Token);
        Headers.Add('Message-Reference', LowerCase(DelChr(BlankGuid, '=', '{}')));
        
        PostRequest(RequestMessage, 'application/json');
        Client.Send(RequestMessage, ResponseMessage);
    end;
    
    local procedure AddHttpBasicAuthHeader(UserValue: Text; PasswordValue: Text): Text
        var
            Base64Convert: Codeunit "Base64 Convert";
            AuthString: Text;
            UserPassLbl: Label '%1:%2', Locked = true;
            BasicLbl: Label 'Basic %1', Locked = true;
        begin
            AuthString := StrSubstNo(UserPassLbl, UserValue, PasswordValue);
            AuthString := Base64Convert.ToBase64(AuthString);
            AuthString := StrSubstNo(BasicLbl, AuthString);
            exit(AuthString)
        end;
        
        local procedure PostRequest(var RequestMessageEdit: HttpRequestMessage; ContentType: Text)
        var
            RequestContent: HttpContent;
            ContentHeaders: HttpHeaders;
        begin
            RequestContent.WriteFrom(Body);
    
            RequestContent.GetHeaders(ContentHeaders);
            ContentHeaders.Remove('Content-Type');
            ContentHeaders.Add('Content-Type', ContentType);
    
            RequestMessageEdit.Method('POST');
            RequestMessageEdit.Content(RequestContent);
        end;
        
      
        
    
    

    Don't forget to help the community by Verifying the answer and Like it if your question has been answered. It will let others know that the topic has verified answer.

    Thanks & Regards,
    Gian

  • Muhammad Faizan Subhani Profile Picture
    30 on at
    RE: Business Central API integration with DHL API Service URL, API Key and API Secret

    Hi Ranjith,

    You can check DHL API Postman Workspace, They provide all the API(s) in it. consume or required api in the action with http client.

  • Suggested answer
    Nitin Verma Profile Picture
    21,544 Moderator on at
    RE: Business Central API integration with DHL API Service URL, API Key and API Secret

    Hi ,

    You need to consume those API into BC check with below link

    community.dynamics.com/.../how-to-consume-rest-api-url-in-microsoft-d365-business-central

  • Suggested answer
    Mohana Yadav Profile Picture
    60,209 Super User 2025 Season 1 on at
    RE: Business Central API integration with DHL API Service URL, API Key and API Secret

    You can check these links

    www.youtube.com/watch

    learn.microsoft.com/.../httpclient-data-type

    vld-nav.com/nyt-api-integration-to-bc

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,141 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,881 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans