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

I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    60,999 Super User 2025 Season 2 on at
  • Suggested answer
    Nitin Verma Profile Picture
    21,708 Moderator on at

    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

  • Muhammad Faizan Subhani Profile Picture
    30 on at

    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
    Gianfranco C. Profile Picture
    370 on at

    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

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,151

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,443 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,092 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans