Start a new topic

Search Forms needs to be exposed via API

Hi Team,

We have created a search form to search on "Name" attribute and below is the SemQL Condition for the same:

(:SEARCH_PARAM_NAME is null OR UPPER(Name) LIKE '%' || UPPER(:SEARCH_PARAM_NAME) || '%')


We need to expose this search form  via REST Client API or Named Queries. Can you let us know how to achieve the same.

1 Comment

The details in this article were called from this doc where a variety of ways to query your data via the REST API are spelled out in some detail. In addition, there is a new, very good, tutorial on the same subject located here.


 You would need to replace the IP address, data location and entity name with your own. This query is looking for Golden Company records like ‘HARLEY’.  I recommend the upper as it will remove the case sensitivity of your search. 

http://13.56.77.82/semarchy/api/rest/query/DLOC2/Company/GD/?$f=Upper(CompanyName)%20LIKE%20%27HARLEY%25%27


To add additional parameters, it would look like this:

http://13.56.77.82/semarchy/api/rest/query/DLOC2/Company/GD/?$f=Upper(CompanyName)%20%20like%20%27%25GENERAL%25%27%20and%20Upper(RawAddress.StateProvince)%20%20like%20%27%25MI%25%27


This query is looking for Golden Companies with a name like ‘General’ and a state like ‘MI’ The fastest way to determine how your query should look is to go to the application and apply a filter to a Browse Business View action. If you're looking at a Browse Business View action in the app you'll see an filter icon in the upper right corner, it looks like this:

Click that and for search type select SemQL, in the filter condition, create your wildcard query, or any query for that matter. Here I filtered on company name like 'General' and state like 'MI'. 

When you apply this filter, you will see how it needs to be rendered to include the control characters so it can be sent to the rest API. In the resulting URL you will see something like this:

Everything inside the double quotes after "semqlCondition" is what you'll need to send to the API using the ?$f= syntax that I show above. Alternatively, you can google each control character you need and build your query using them directly. For example, we can infer that:

  • %20 is a space
  • %27 is a single quote
  • %25 is a % sign (somewhat ironically, I might add)

and so on..

Login to post a comment