Problem with RestAPI


#1

Hi,

I wrote an angular client application (using port 4200) which call NSCLient via RestAPI in order to get info for various checks (CPU, check drive etc.). Both my angular application and NSCLient are running on the same PC (LocalHost). When I sent the request I got the following response: "request doesn’t pass access control check: No ‘Access –Control-Allow-Origin’ header is present on the requested source. Origin ‘http://localhost:4200’ is therefore not allowed access. The response had HTTP status code: 4040()

I tried to use PostMan to send the request and here are my findings:

  1. If I use the desktop application of PostMan using: https://localhost:8443/api/v1/queries/checkcpu/commands/execute (With headers for password key)

I got the following error: Could not get any response There was an error connecting to https://localhost:8443/api/v1/queries/checkcpu/commands/execute.

  1. I then tried to use PostMan with chrome plugin. In this setup I got the following results: Before sending the request with PostMan, I tried to login to the WebServer (localhost:8443) via Chrom. When loading the Chrom I got alert message in the browser: “Your connection is not private”

a. If I proceed via “Advanced”  Proceed to localhost (unsafe) then I got the Login screen. In addition in this scenario when I use PostMan with chrome plugin with the same request as above (with the PostMan application) I got a correct response from NSClient b. If I do not use the Advance option and do not allow Chrom to go to unsafe when I sent the request from chrome plugin I got the same error as with the PostMan application (“Could not get any response”)

Any help will be appreciated