Read Records with Filter Options¶
To demonstrate how to send a GET
request with the filter option enabled and obtain the corresponding response, the BusinessLeadHandling
projection is used here.
Here, we call an endpoint that lists the entities from business leads based on a given condition.
Note - If you are here to try this out right after trying out the Simple GET Request, skip to the Get Request with Filter Option section below.
Before you Begin
- Obtain the access token by following the steps given in the Authentication page.
- Make sure the user you used while obtaining the access token, has the permission set granted to access the
BusinessLeadHandling
projection used in the quick start. To do this, first, let's create a permission set.- Navigate to Solution Manager > Users and Permissions > Permission Sets.
- Click on the + icon and create a new permission set as shown below.
- Tick the checkbox corresponding to the newly created permission set and click Details.
- Select Projections from the left navigation.
- In the Granted Projections panel, click Add/Revoke and select Add from the dropdown that appears.
- Filter by the projection name,
BusinessLeadHandling
. - Tick the checkbox and click OK.
- Select Users Granted from the left navigation.
- In the Users Granted panel, click Add Users.
- Filter using the same user name you used while you created the client for the authentication process
- Click OK.
In IFS Cloud¶
-
Navigate to Solution Manager > Integration > API Explorer. Alternatively, search for
API Explorer
in the search bar. -
Filter by API Name,
BusinessLeadHandling
. -
Navigate to the API Documentation as shown below.
-
In the API documentation, select
BusinessLeads
on the left navigation and click onGet entities from BusinessLeads
. -
Copy the URL provided in the right panel.
In Postman¶
Read Records with Filter Options¶
Let us assume that only leads with a turnover greater than 100 should be obtained in the response.
-
Open a new GET request and paste the URL you copied from the API Doc in the previous step as the Request URL.
-
Modify the above URL by adding
?$filter=Turnover gt 100
-
Make sure that the header tab has an Authorization key with the value in the format of
Bearer <access token>
as shown below. This is the access token you obtained while authenticating the request. -
Click Send
You will now see only the leads with a turnover greater than hundred.
Filter Option on an Enumeration¶
Let us assume that only records whose state is Converted are required in the response. The object state (Objstate
) is of enum type enabling it to contain a set of predefined values including Converted that we require.
In order to get the expected output, the query option should be in the following format: ?$filter= variable-name eq IfsApp.Projection-name.Enum-name'value-required'
Note - The enumeration name and its values can be found in the API Doc for the
LeadBusinessHandling
projection.
The request will be as follows:
The response will be as follows:
Filter Option on Date¶
Suppose we only need the leads that were created on a certain date. The date is generally represented in the YYYY-MM-DD
format.
In the example given below, we are only filtering the lead/s that was created on the 20th of March 2015.
The response will be as follows: