Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

PI Web API Reference

Element CreateSearchByAttribute

Element CreateSearchByAttribute

Create a link for a "Search Elements By Attribute Value" operation, whose queries are specified in the request content. The SearchRoot is specified by the Web Id of the root Element. If the SearchRoot is not specified, then the search starts at the Asset Database. ElementTemplate must be provided as the Web ID of the ElementTemplate, which are used to create the Elements. All the attributes in the queries must be defined as AttributeTemplates on the ElementTemplate. An array of attribute value queries are ANDed together to find the desired Element objects. At least one value query must be specified. There are limitations on SearchOperators. See Search Operator for more information.

Request

POST elements/searchbyattribute

URL Parameters

  • noResults

    If false, the response content will contain the first page of the search results. If true, the response content will be empty. The default is false.

  • webIdType

    Optional parameter. Used to specify the type of WebID. Useful for URL brevity and other special cases. Default is the value of the configuration item "WebIDType". See WebID Type for more information.

  • associations

    Associated values to return in the response, separated by semicolons (;). This call supports Paths to return all paths to the element. If this parameter is not specified, paths are not returned. See Associations for more information.

Body Parameter

The query of search by attribute.

Status Codes

201: The link is stored in the response's "Location" header. The response content is the first page of the search result by the default parameters.

400: Empty or invalid request content.

413: Request content is too large.

Sample Request Body


            {
                "SearchRoot":"I1EmDqD5loBNH0erqeqJodtALAYIKyyz2F5BGAxQAVXYRDBA",
                "ElementTemplate":"I1ETDqD5loBNH0erqeqJodtALAkpSYp6uykE2Ku0yChDU91g",
                "ValueQueries":
                [
                    {
                        "AttributeName":"City",
                        "AttributeValue":"Philadelphia",
                        "SearchOperator":"Equal"
                    },
                    {
                        "AttributeName":"Model",
                        "AttributeValue":["ModelA", "ModelB", "ModelC"],
                        "SearchOperator":"In"
                    },
                    {
                        "AttributeName":"Pressure",
                        "AttributeUOM":"pound-force per square inch",
                        "AttributeValue":40.0,
                        "SearchOperator":"LessThan"
                    }
                ]
            }
            
In This Topic
TitleResults for “How to create a CRG?”Also Available in