Skip to Content
Technical Articles
Author's profile photo Yogananda Muthaiah

SAP Commissions – RestAPI filtering Parameter

API design is becoming a core pillar of API product strategy regardless if the API is public or used internally. Good API design improves the overall Developer Experience. It provides the filter the parameter to fetch your content with endless possibilities!

Filtering

  1. Used to filter result set and narrow down result set or drill down into the results
  2. Controlled via special input parameter called “filters” containing JSON structure inside the value
  3. Multiple filters can be chained together inside the same JSON structure, simply add another filter field definition after the first one
  4. Multiple value formats for each key are supported inside JSON structure including simple string/scalar, array, or associative array ( key => value )


Refer API Documentation

A practical examples of a filter:

The filter query parameter is used to filter items in a resource collection to return a subset of resources in response. The subset includes only those resources that satisfy the parameter value specified in the query

Example 1: To return results for 1 transaction record from Sales Transactions

Example 2: To return results from a field name in the following request :

Example 3: In this scenario, more than one field is passed in the filtering parameter

Example 4: In this scenario, more than one field is passed in the filtering parameter but operator sign checks for greater than (gt) field value

Example 5: In this scenario, the filtering parameter is a little complex expression but operator sign checks for greater than (gt) field value with subfields.

Example 6: In this, the complex expression is passed in the filtering parameter with grouping open & close () and OR condition to check if not equal null

Example 7: In this scenario, using expand – will retrieve PayeeId , Position Name and Period with
filtering parameter becomes a little complex expression but will filter payment results only for single PayeeId

 

 


Please feel free to reach out in case of any clarifications/API development work for your Project

Kindly share this blog with your friends below the icons.

Assigned tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Kameshwar Nukala
      Kameshwar Nukala

      API_FILTER_Different_approach

      API_FILTER_Different_approach

      Author's profile photo Yogananda Muthaiah
      Yogananda Muthaiah
      Blog Post Author

      Thanks Kamesh!!! your scenario is really good!

      your contribution is needed to explore few more examples like this to think different

      Author's profile photo Minjie Lao
      Minjie Lao

      Is that possible to retrieve multiple entities(position or payee) in single api call by using list of entity id (ex: payeeid, positionname etc)

       

      For ex: https://url/payee in ('id1','id2','id3')

       

       

      Author's profile photo Yogananda Muthaiah
      Yogananda Muthaiah
      Blog Post Author

      yes Minjie.. In next article you will see sorting and query which you will combine multiple fields

      Author's profile photo Krishnan Ramany
      Krishnan Ramany

      This is a very good and informative article. Thanks for Sharing Yoga.