Tonight I ran into a strange error. I’m trying to read data from Github into Microsoft Dynamics 365 Business Central through the excellent HttpClient data type in AL But Github kept returning error 403 to Business Central. I tried from 5 different browser, including WGET from Linux, but only Business Central failed.

I started inspecting http headers, and discovered that calls from Business are missing a User-Agent header, adding that got everything to work again.

So, if you have trouble with websites that does not like requests from Business Central, check if you need to supply a User-Agent.

To add a User-Agent you must use the HttpRequestMessage structure and use the HttpClient.Send method instead of GET or POST.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.