8 Replies Latest reply on Oct 12, 2018 11:03 AM by SayyadAsif

    Unable to access the PI Web API Using Ajax Call

    SayyadAsif

      Hello ,

      Developed web application where making ajax call to PI Web API as below. PI Web API configuration is set to basic authentication, hence I am passing credentials as required.

      api.pngEugene Lee

      Here I tried by adding headers also like:

       

      'Content-Type':'application/json',

      'Access-Control-Allow-Origin':'https://XXXXXXXXX',

      'Access-Control-Expose-Headers':'authorization,content-type',

      'Access-Control-Allow-Methods':'GET, POST, PATCH, PUT, DELETE, OPTIONS'

       

      But I got the this kind of response :

      res.png

       

      Here is my Pi configuration :

      WEB.png

       

      Please suggest for same.

       

       

      Now I Made the changes and this is a new server machine still the same error occured... please Help.

      "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 401."

       

      Programming in PI Web APILearn PIPI Developers Club