Open APIs

  • 1.  REST API guidelines - Filtering

    TM Forum Member
    Posted Nov 20, 2018 04:39

    After reading the REST design guidelines 3.0 R17.5.1, specifically the filtering part, with the objective of understanding how can I filter while using AND and OR logic, I was unable to understand how this is done, following the guidelines.
    In section "Query Resources with attribute filtering" two examples of ANDED and ORING behavior are displayed. According to the text right above these examples, in order to use ORING one can repeat the same attribute name multiple times while having different values. One can also specify one attribute name and use both "," or ";" to split the multiple attribute values.
    If we look closely to the ANDED and ORING examples provided in the REST design guidelines:
    • Using ANDED to describe "017-04-20 >dateTime>2013-04-20" :GET /troubleTicket?dateTime%3E2013-04-20&dateTime%3C2017-04-20
    • Using ORING to describe dateTime<2013-04-20 or dateTime<2017-04-20 :GET /troubleTicket?dateTime%3C2013-04-20;dateTime%3E2017-04-20

    The query used to express an ANDED behavior follows the same rules of the ORING, where we can have the same attribute name repeated multiple times with different attribute values. Or am I missing something while interpreting these examples?
    Or when in the document is stated that the attribute name can be repeated, it actually means attribute name plus the operator, and only in that case we are dealing with a ORING behavior. When we have duplicated attribute names but different operators this is considered to be an AND behavior. Is that the case?

    If someone could point me in the right direction, or indicate any documentation that I should read that I might have missed, I would be greatly appreciated.

    Thank you in advance.

    Pedro Sanches

  • 2.  RE: REST API guidelines - Filtering

    Posted Oct 03, 2021 06:29
    Edited by Ebrahim Mirzazadeh Oct 03, 2021 06:53

    I would appreciate if someone please clarify this :

    We have 3 ORING syntax, listed below for attribute value ORING.
    TMF630v4.2.0 -> Page 30

    1 - [{attributeName}={attributeValue}&*]
    2- [{attributeName}={attributeValue},\{ attributeValue}*]
    3- [{attributeName}={attributeValue};{attributeValue}*]

    TMF630v4.2.0 -> Page 31

    Using ANDED to describe "017-04-20 >dateTime>2013-04-20" :
    • GET /api/troubleTicket?dateTime%3E2013-04-20&dateTime%3C2017-04-20
    Using ORING to describe dateTime<2013-04-20 or dateTime<2017-04-20 :
    • GET /api/troubleTicket?dateTime%3C2013-04-20;dateTime%3C2017-04-20

    Is this a correct sample ? 

    According to syntax #1, first GET must be interpreted as OR where dateTime is repeated separating with & delimiter.

    According to syntaxt #2 and #3 , this ORING is wrong and supposed to be sent as below :

    Syntaxt 3: GET /api/troubleTicket?dateTime%3C2013-04-20;2017-04-20


    ​​Syntax 2: GET /api/troubleTicket?dateTime%3C2013-04-20,2017-04-20

    Thank you

    Ebrahim Mirzazadeh