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

Community site session details

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

NAVHttp Client Request Failed

(0) ShareShare
ReportReport
Posted on by 55

Hi Team,

While processing an external API in BC, I get the status code 0 and response "NavHttp Client Request Failed".

But while I am calling same uri in Postman, I get a proper response and status code is 200.

Can you please advise on this,

Thank you for your help!

.issue1.png

pastedimage1631447854419v2.png

Thank you

Regards

Revanth

I have the same question (0)
  • RevanthM Profile Picture
    55 on at
    RE: NAVHttp Client Request Failed

    Thank you very much @Andrey.

  • Verified answer
    Andrey Baludin Profile Picture
    3,941 on at
    RE: NAVHttp Client Request Failed

    In the headers of Postman request which works you can see extra hidden headers including "Accept" : '*\*'

    pastedimage1631537539759v1.png

    So just add this to your request and it works :

    local procedure testImageDownload()
        var
            Client: HttpClient;
            ResponseMessage: HttpResponseMessage;
            Headers: HttpHeaders;
            ResponseText: Text;
        begin
            ResponseText := '';
    
            Headers := Client.DefaultRequestHeaders;
            Headers.Add('Accept', '*/*');
            if not Client.Get('https://static.grainger.com/rp/s/is/image/Grainger/19YH59_AS01?$S7PRODUCT$', ResponseMessage) then
                Error('Not ok');
    
            ResponseMessage.Content().ReadAs(ResponseText);
    
            if not ResponseMessage.IsSuccessStatusCode() then
                ResponseText := StrSubstNo('%1 %2', ResponseMessage.HttpStatusCode(), ResponseText);
    
            Message(ResponseText);
        end;

  • RevanthM Profile Picture
    55 on at
    RE: NAVHttp Client Request Failed

    Hi @Andrey,

    Here is the url - static.grainger.com/.../19YH59_AS01

    Thank you for your help!

    Regards

    Revanth M

  • Suggested answer
    Andrey Baludin Profile Picture
    3,941 on at
    RE: NAVHttp Client Request Failed

    Hi Revanth,

    there is no httpStatus 0. This is default value and this means that server do not responds to you at all. This could be timeout issue, incorrect URL or some missed header in request - a lot of reasons.

    Please share the full URL. I see that it looks just like picture download with anonymous auth and I think this is not a big secret?

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 4,132

#2
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 3,615

#3
Sumit Singh Profile Picture

Sumit Singh 2,912

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans