1 Reply Latest reply on May 15, 2018 9:42 PM by tramachandran

    PI Web API Create Tags

    halla

      Hello,

       

      I'm trying to create PI tags based off of another PI Server using the PI Web API 2017 R2.

      The basic syntax from the help documentation seems to work fine:

      HTTP POST: https://{server}/piwebapi/dataservers/{PiServerWebId}/points

      BODY:

      {
        "Name": "TEST_TAG",
        "Descriptor": "12 Hour Sine Wave",
        "PointClass": "classic",
        "PointType": "Float32",
        "EngineeringUnits": "",
        "Step": false,
        "Future": false
      }
      
      

       

      Response: Success!

       

      However, I need to update many of the PI Tag's attributes (as to properly configure interface parameters).

      So I try something like this:

      HTTP POST: https://{server}/piwebapi/dataservers/{PiServerWebId}/points

      BODY:

       {
              "Name": "TEST_TAG2",
              "exdesc": "info",
              "future": "0",
              "pointsource": "INT1",
              "PointType": "Float64",
              "PointClass": "classic",
              "sourcetag": "",
              "archiving": "1",
              "compressing": "0",
              "compdevpercent": "0",
              "excdevpercent": "0",
              "scan": "1",
              "shutdown": "1",
              "span": "100",
              "step": "1",
              "typicalvalue": "50",
              "zero": "0",
              "datasecurity": "piadmin: A(r,w) | piadmins: A(r,w)",
              "ptsecurity": "piadmin: A(r,w) | piadmins: A(r,w)",
              "convers": "1",
              "filtercode": "0",
              "instrumenttag": "R.Data Engine 1.Injector Press",
              "location1": "501",
              "location2": "0",
              "location3": "7",
              "location4": "1",
              "location5": "4"
          }
      
      
      
      
      

      Response: (attributes 'not allowed')

      {
          "Errors": [
              "Properties [exdesc, future, pointsource, sourcetag, archiving, compressing, compdevpercent, excdevpercent, scan, shutdown, span, step, typicalvalue, zero, datasecurity, ptsecurity, convers, filtercode, instrumenttag, location1, location2, location3, location4, location5] are not allowed."
          ]
      }
      
      

       

      Something else I noticed is that the syntax is different from when you get attributes from a PI Tag (with a GET request) VS attribute naming for creating a PI Tag. (Case seems to matter!)

       

      For instance:

      GET PI Tag Attribute Name | POST Create PI Tag Attribute Name

      ptclassname | PointClass

      pointtype | PointType

      future | Future

      step | Step

       

       

      Is there a table of allowable attributes and their syntax somewhere?

      I've looked around and can't seem to find one.

      Also, is it possible to create Tags with the PI Web API while defining all attributes?

       

       

      Thanks

        • Re: PI Web API Create Tags
          tramachandran

          There is a deficiency in the  DataServer CreatePoint example provided with the documentation. A work item already exists to address this issue.

          I cannot find any public documentation on allowable attributes. Unfortunately, it is not possible to include all the attributes while creating a PI Point.

           

          As you have indicated, you can go with the help documentation syntax to create a PI Point.  You can then use the UpdateAttributeValue or the Update controllers to modify the attributes.

           

          If you would like this feature to be implemented or have other feedback on this controller, let us know through User Voice.

          2 of 2 people found this helpful