7 Replies Latest reply on Sep 28, 2016 12:39 AM by asorokina

    PI Web API not working

    Kaushal

      Hi,

      As per video tutorial, I have installed and setup PI Web API using custom authentication (domain\username) but still when I am hitting same API URL to PI Server locally, it is not working.

      Error I'm getting:

       


      { "Message": "Authorization has been denied for this request." }

      1. Installed PI WEB API with "Administrator" user.
      2. Configured setup with "Domain\Perfmon" user. This user has all admin right in domain.
      3. In PI SE > System Configuration database > changed Authentication method as "Basic" but no luck.
      4. Also tried with "NT Service\piwebapi" account by setting up "Kerberos" and "Authentication method as "Kerberos" in PI SE but no luck.

      Also I tried to resolved certificate issue as per video described but there also no luck.

       

      Regards

        • Re: PI Web API not working
          Paurav Joshi

          Hi Kaushal,

           

          One quick suggestion would be:

           

          1. Installed PI WEB API with "Administrator" user.
          2. Configured setup with "Domain\Perfmon" user. This user has all admin right in domain.
          3. In PI SE > System Configuration database > changed Authentication method as "Basic" but no luck.

          Did you keep only Basic protocol available when applying this scenario? If not, then in Authentication method just leave only "Basic" protocol, checkin the changes, and restart Web API Service.

           

          Request you to provide WebAPI version that you are using.

           

          Thanks,

          Paurav Joshi

            • Re: PI Web API not working
              Kaushal

              Hi Paurav,Thanks for your reply. I already did as BASIC once but still it shows same error.

              Regards

                • Re: PI Web API not working
                  Paurav Joshi

                  Hey Kaushal,

                  which version of PI WebAPI you are using?

                    • Re: PI Web API not working
                      Kaushal

                      Hi Paurav,I am using PI-Web-API-2016_1.7.0.176_

                      Regards

                        • Re: PI Web API not working
                          Paurav Joshi

                          Hey Kaushal,

                           

                          Have you checked event viewer logs?

                          Why I am asking these is that WebAPI has not worked ever is my assumption here, and better to have details of event viewer errors and you can mail to techsupport@osisoft.com also.

                           

                          P.S. : I found certificate problem while installing on PI WebAPI 2015 R3. Techsupport suggested and then we uninstalled R3, and freshly installed WebAPI 2015 R2, which created certificate for the server which has 15 years lifetime. After that we upgraded to R3 form R2.

                           

                          First suggestion would be check event logs which generally shows error, and if unable to then try to uninstall 2016, install 2015 R2, and then upgrade it to 2016, but OSIsoft guys can best advise on this.

                            • Re: PI Web API not working
                              Kaushal

                              Hi,

                              Below is the error I am getting from log.

                               

                              [PIWebAPI] {f436dfe5-4d61-4476-bd48-885f5cc1eec2}: Request executing as anonymous (no valid identity associated with the request)..

                              GET /piwebapi/

                              Upgrade-Insecure-Requests: 1

                              Cache-Control: max-age=0

                              Connection: keep-alive

                              Accept: text/html, application/xhtml+xml, application/xml; q=0.9, */*; q=0.8

                              Accept-Encoding: gzip, deflate, br

                              Accept-Language: en-US, en; q=0.5

                              Host: win-54u4fvuleeq.domain1:8010

                              User-Agent: Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0

                               

                              Regards

                                • Re: PI Web API not working
                                  asorokina

                                  Hi Kaushal,

                                  This looks like a Kerberos misconfiguration.

                                  Make sure you have SPNs created for the PI Web API service account. From the "Kerberos delegation" section of the PI Web API documentation, Commonly encountered problems:

                                  If running PI Web API as a custom account:

                                  • Ensure that the account is trusted for delegation in Active Directory.
                                  • Ensure that the account has Service Principal Names registered for:
                                    • HTTP/hostname
                                    • HTTP/fully.qualified.hostname
                                  • Ensure that the account is not marked “sensitive and cannot be delegated” in Active Directory.

                                  You can check if SPNs exist by running the following from the command line:

                                       Setspn –L domain\serviceAccount

                                   

                                   

                                  And here is an example of how to add SPNs for a PI Web API service account:

                                       setspn -s http/hostname domain\serviceAccount

                                       setspn -s http/fully.qualified.domainName domain\serviceAccount

                                  If this doesn't help, I recommend that you contact our Technical Support team and request a remote session to resolve this quickly.