Search

The $search system query option restricts the result to include only those entities matching the specified search expression using NFA Odata APIs. You can also search using the combination of other operations like select, filter.
The $search system query option restricts the result to include only those entities matching the specified search expression using NFA Odata APIs. You can also search using the combination of other operations like select, filter.
The guidelines for the search expression are as follows:
  • search expression can be any text, number, or combination of text or number.
  • search expression must be provided in double quotes (" ").
  • While $search operation, the entities are evaluated against the
    search expression
    on
    all the fields
    , the matching records are returned as query response.
  • Use the "$select" operation along with the "$search" to restrict the evaluation against selective fields. Search operation is performed on the fields that are provided in the select operation.
Resource URL
http://<nfa odata host>:<nfa odata port>/odata/api/<EntityType Name>?$search=<"search expression">
Method
GET
Sample Request
This example searches for the search expression "10.0.9" on all the fields of Interfaces entity and displays the matching records
.
http://127.0.0.1:8981/odata/api/interfaces?$search="10.0.9"
Sample Response
{ "InSpeed": 0, "IfType": "WAN", "Description": "", "Enabled": "Enabled", "PersistentIfIndex": 1, "RouterName": "10.0.9.12", "RouterId": 1500001, "TrafficStatus": "Critical", "RouterAddress": "10.0.9.12", "Name": "Interface 1", "AgentType": "Physical", "DomainId": 1, "LastData": 1613735131, "OutSpeed": 0, "DomainName": "Default Domain", "IfIndex": 1, "UpdatedOn": 1611850522, "ID": 65, "HarvesterAddress": "10.74.58.90", "ComponentAgentIds": "", "Subnet": "" }, { "InSpeed": 0, "IfType": "WAN", "Description": "", "Enabled": "Enabled", "PersistentIfIndex": 2, "RouterName": "10.0.9.18", "RouterId": 1500003, "TrafficStatus": "Critical", "RouterAddress": "10.0.9.18", "Name": "Interface 2", "AgentType": "Physical", "DomainId": 1, "LastData": 1613735131, "OutSpeed": 0, "DomainName": "Default Domain", "IfIndex": 2, "UpdatedOn": 1611850522, "ID": 40, "HarvesterAddress": "10.74.58.90", "ComponentAgentIds": "", "Subnet": "" }
Search with Select
Resource URL
http://<nfa odata host>:<nfa odata port>/odata/api/<EntityType Name>?$select=<Property Name>&$search=<"search expression">
Method
GET
Sample Request
This example searches for the search expression "16" in the fields "RouterName" and "Name" for the Interfaces entity and displays the matching records
.
http://127.0.0.1:8981/odata/api/interfaces?$select=RouterName,Name&$search="16"
Sample Response
{ "@odata.id": "interfaces(519)", "RouterName": "10.255.3.160", "Name": "Interface 473", "ID": 519 }, { "@odata.id": "interfaces(819)", "RouterName": "10.255.0.123", "Name": "Interface 16", "ID": 819 }, { "@odata.id": "interfaces(588)", "RouterName": "10.255.0.167", "Name": "Interface 16", "ID": 588 }