Hi everyone,
I'm completely new to Dynamics 365 and specifically to Business Central. I was trying to make an Http call in sandbox container local, but what I got is httpclient.get() returned false.
when i try to installed and published to the sandbox online, it works. I don't know why not working on sandbox container local, can somebody help me?
here's my PowerShell script to create container
$accept_eula = $true
$containername = 'testing-bc2'
$navdockerimage = 'xxx.com/businesscentral/sandbox:XXXXX-au'
$appbacpacuri = ''
$tenantbacpacuri = ''
$additionalParameters = @()
if ($appbacpacuri -ne '' -and $tenantbacpacuri -ne '') {
$additionalParameters = @("--env appbacpac=""$appbacpacuri""","--env tenantBacpac=""$tenantbacpacuri""")
}
$credential = get-credential -UserName $env:USERNAME -Message "Using Windows Authentication. Please enter your Windows credentials."
New-NavContainer -accept_eula:$accept_eula `
-memoryLimit 4G `
-containername $containername `
-auth NavUserPassword `
-Credential $credential `
-alwaysPull `
-doNotExportObjectsToText `
-usessl:$false `
-updateHosts `
-assignPremiumPlan `
-shortcuts Desktop `
-imageName $navdockerimage `
-additionalParameters $additionalParameters
Setup-NavContainerTestUsers -containerName $containername -password $credential.Password
here's my code
procedure FetchRandomUser()
var
Client: HttpClient;
Response: HttpResponseMessage;
Request: HttpRequestMessage;
Header: HttpHeaders;
Url: Text;
ResponseText: Text;
ResContent: HttpContent;
begin
Url := 'https://randomuser.me/api/';
if Client.Get(Url, Response) then begin
Message('SUCCESS');
Response.Content.ReadAs(ResponseText);
Message(ResponseText);
end;
if Response.HttpStatusCode() = 200 then begin
ResContent := Response.Content();
ResContent.ReadAs(ResponseText);
Message(ResponseText);
end;
Message('httpstatusCode %1, reason%2', Response.HttpStatusCode, Response.ReasonPhrase);
end;
I got HttpStatusCode = 200 but its throw an error
