Search code examples
httpbcdynamics-business-centraldynamics-al

Can't resolve domain name


I'm learning AL programming in BC and I'm experimenting with the HttpClient class to make http requests. I try to make a request to the jsonplaceholder api but I get a "The remote name could not be resolved: https://jsonplaceholder.typicode.com/posts". The API is working properly, since I can make a request to it via Postman. I'm working with BC16, in a docker container supposed to represent a SaaS environment. Any ideas why I might get this error? The request code is the following:

local procedure SendHTTPRequest()
    var
        client: HttpClient;
        responseMessage: HttpResponseMessage;
    begin
        client.Get('https://jsonplaceholder.typicode.com/posts');
        Message(Format(responseMessage.HttpStatusCode));
    end;


Solution

  • You should make sure that HttpClient requests have been enabled for your extension.

    To do that you must do the following:

    1. Go to the Extension Management page
    2. Locate your extension
    3. Click the three little dots and choose Configure
    4. Make sure that Allow HttpClient Requests is turned on