AnsweredAssumed Answered

PI WebAPI misconfiguration - Can access Points but no AF elements/attributes?

Question asked by Jouni on Aug 13, 2018
Latest reply on Aug 17, 2018 by Jouni

Hi all,

 

As a developer I started to test on how we could visualise some metrics from PI/AF on our web based dashboards by pulling the data directly from PI WebAPI.

WebAPI was configured by a 3rd party and I can access the WebAPI landing page https://<WebAPIServer>/webapi fine.

However, I found out that I can't get any element or attribute data out through Elements-controller but reading PI Points works just fine.

 

Working controllers

Search : Searching PI Points and AF Elements & Attributes works fine
Point:  GetByPath and Get work as expected

 

Not working

Elements?Path=<PATH> : All queries to result "The specified path was not found. If more details are needed, please contact your PI Web API administrator for help in enabling debug mode."

Elements/<WEBID> : All queries result "An exception has occurred. Please contact your PI Web API administrator for help in enabling debug mode."

Attribute : Same errors as with Element-controller

 

Troubleshooting done so far

Problem is not caused by incorrect URL.
I did search which resulted both AF elements and PI Points with "Self" link.

 

"ItemType": "afelement",

"Links": {

"Self": "https://<WEBAPISERVER>/piwebapi/elements/F1EmMgfWBv0GMUyvfXrkrTO19QYgpfg9R06BGWaESFAK13FgTVJQLVBJQVBQLVAwMVxERVZFTE9QTUVOVCBNRVJDVVJZIEFTU0VUU1xLQVdFUkFV" - FAILS

},

"ItemType": "pipoint",

"Links": {

            "Self": "https://<WEBAPISERVER>/piwebapi/points/F1DPWHN4jVUdw0GVEdzXExuKgwtUwAAASEFNLVBJLU5cS0FXLUxBQi1IMlMx" - WORKS

        }

Other findings:

 

 

 

I checked the output of AssetServers and DataServers controllers and one thing caught my eye;

https://<WEBAPISERVER>/piwebapi/dataservers outputs

{   
     "Links": {},  
     "Items": [    
      {      
           "WebId": "F1DSWHN4jVUdw0GVEdzXExuKgwSEFNLVBJ",
       "Id": "8d787358-1d55-41c3-9511-dcd7131b8a83",
       "IsConnected": true,
      "ServerVersion": "3.4.415.1188",
       "Links": {
         "Self": "
https://<WEBAPISERVER>/piwebapi/dataservers/F1DSWHN4jVUdw0GVEdzXExuKgwSEFNLVBJ",
         "Points": "
https://<WEBAPISERVER>/piwebapi/dataservers/F1DSWHN4jVUdw0GVEdzXExuKgwSEFNLVBJ/points",
         "EnumerationSets": "
https://<WEBAPISERVER>/piwebapi/dataservers/F1DSWHN4jVUdw0GVEdzXExuKgwSEFNLVBJ/enumerationsets"
       }
     }
   ]
}

https://<WEBAPISERVER>/piwebapi/assetservers outputs

{
   "Links": {},
   "Items": [
     {
       "WebId": "F1RSMgfWBv0GMUyvfXrkrTO19QTVJQLVBJQVBQLVAwMQ",
       "Id": "06d60732-06fd-4c31-af7d-7ae4ad33b5f5",
       "Name": "<af_server_name>",
       "Description": "",
       "Path": "\\\\<af_server_name>",
       "IsConnected": false,
      "ServerVersion": "",
       "ExtendedProperties": {},
       "Links": {
         "Self": "
https://<WEBAPISERVER>/piwebapi/assetservers/F1RSMgfWBv0GMUyvfXrkrTO19QTVJQLVBJQVBQLVAwMQ",
         "Databases": "
https://<WEBAPISERVER>/piwebapi/assetservers/F1RSMgfWBv0GMUyvfXrkrTO19QTVJQLVBJQVBQLVAwMQ/assetdatabases",
         "SecurityIdentities": "
https://<WEBAPISERVER>/piwebapi/assetservers/F1RSMgfWBv0GMUyvfXrkrTO19QTVJQLVBJQVBQLVAwMQ/securityidentities",
         "SecurityMappings": "
https://<WEBAPISERVER>/piwebapi/assetservers/F1RSMgfWBv0GMUyvfXrkrTO19QTVJQLVBJQVBQLVAwMQ/securitymappings",
         "UnitClasses": "
https://<WEBAPISERVER>/piwebapi/assetservers/F1RSMgfWBv0GMUyvfXrkrTO19QTVJQLVBJQVBQLVAwMQ/unitclasses",
         "AnalysisRulePlugIns": "
https://<WEBAPISERVER>/piwebapi/assetservers/F1RSMgfWBv0GMUyvfXrkrTO19QTVJQLVBJQVBQLVAwMQ/analysisruleplugins",
         "TimeRulePlugIns": "
https://<WEBAPISERVER>/piwebapi/assetservers/F1RSMgfWBv0GMUyvfXrkrTO19QTVJQLVBJQVBQLVAwMQ/timeruleplugins",
         "Security": "
https://<WEBAPISERVER>/piwebapi/assetservers/F1RSMgfWBv0GMUyvfXrkrTO19QTVJQLVBJQVBQLVAwMQ/security",
         "SecurityEntries": "
https://<WEBAPISERVER>/piwebapi/assetservers/F1RSMgfWBv0GMUyvfXrkrTO19QTVJQLVBJQVBQLVAwMQ/securityentries"
      }
     }
   ]
}

None of the links in JSON response above work and result "An exception has occurred. Please contact your PI Web API administrator for help in enabling debug mode"

 

EDIT:
I can get service to respond if I log on to webapi server through RDP and call the service one using localhost binding.

Steps I've done to reproduce the behaviour

  1. On my local machine I navigate to https://<WEBAPISERVER/piwebapi/elements/<WebId> --> FAIL
  2. RDP to WEBAPISERVER
  3. Open browser on WEBAPISERVER and navigate to https://<WEBAPISERVER/piwebapi/elements/<WebId> --> FAIL
  4. Change URL on WEBAPISERVER to https://localhost/piwebapi/elements/<WebId> --> WORK
  5. Now repeating step 1 will work fine too.

 

Also JSON reply from https://<WEBAPISERVER/piwebapi/assetservers now has "IsConnected" : true.

 

Any ideas where administrator should look to get the AF side of WebAPI to work too?

Outcomes