2 Replies Latest reply on Oct 30, 2016 11:57 PM by sweaver

    Javascript in a Custom HTML Resource and the API

    sweaver

      Hi, I am often asked to create dashboards that include visual options that are not presently available within Orion's native resources.  I am currently exploring the possibility of retrieving the data from the API and creating the required graphs with one of the many existing Javascript visualisation packages that are currently available.

       

      Is this actually feasible or will CORS restrictions within the browser and/or the web service prevent this from working?  Secondly, is it going to be necessary to embed credentials in the javascript or is there a way either pass forward the authentication from the existing orion session OR a magic user that has read only access to the SDK available that we could use for this?

        • Re: Javascript in a Custom HTML Resource and the API
          tdanner

          Calling from javascript directly to SWIS on port 17778 is not going to work. SWIS uses a self-signed certificate, so the browser will not like it. SWIS uses HTTP Basic authentication, so you would need the user's password. There's a web service endpoint within the Orion website that you could use instead. It's not documented, but if you use the browser developer tools or Fiddler while browsing the Orion website, you can see the requests to /Orion/Services/Information.asmx and figure out the JSON formats. They are a little different than the direct SWIS JSON, but not complicated. Since this service is part of the same ASP.NET website, it uses the same authentication as the rest of the website (cookies or NTLM depending on configuration) and will be transparent for your users.

          1 of 1 people found this helpful