Help using WebHTTPRequest

I have a URL that works in my browser and in the RESTDebugger. However, I am not able to get it to work in my WebCore-Project. All I get is an error message at the bottom containing "FJSError::Error: HTTP request error". The URL should return some JSON.

This is what I want to do

procedure TForm1.TMSFNCButton1Click(Sender: TObject);
begin
WebHttpRequest1.URL := '....';

  WebHttpRequest1.Execute(

      procedure(AResponse: string; AReq: TJSXMLHttpRequest)
      begin
         // parsing JSON
      end  
  );
end;

The given URL above requires authentication via a parameter of type header. I added this in the headers property, but in vain. What am I missing?

tx for support.

Ok, seems to be a CORS problem. However, Access-Control-Allow-Origin - where do I specify this in my WebHTPRequest?
The REST-Debugger as well as the browser can access the RESt service. What am I missing in to WebHTTPRequest?

REST Debugger, Browser and single EXE with a HTTPRequest can all access the REST Api. But not the WebHTTPRequest when run on my machine, this fails witch CORS. Why?

Please learn about what CORS is, why it exists, where it is used, ... there are plenty of resources for this common subject among web developers using REST APIs:

CORS needs to solved server-side. It is a server side config.

I see. RTFM. I thought, CORS might be a common pitfall when it comes to TMS-WebCore, so I asked.

In the meanwhile I learned a bit. The TMS-WebCore-pages need the TMS-WebCore Server when run locally. This server tries to contact the REST-API and this causes the CORS problems, because this is cross server scripting which is considered harmful. Neither my local EXE nor my local browser do cross server scripting when accesing the API so no poblem there. As you said, CORS needs to be solved on server side, where my API resides. Solvable problem, I think. Tx.

The TMS WEB Core web client app performs the HTTP requests to the REST API directly from the browser. It's not going via the (local debug) webserver the app is started from. You give no information about your REST server and what technology is used for the REST server. But it is in your REST server you'll need to enable CORS.
Also, when encountering problems, open a browser console (F12 shortcut) as there will be more detail about possible errors there.