Open APIs

 View Only
  • 1.  Null/Empty Filtering Values

    TM Forum Member
    Posted Mar 20, 2023 13:15

    Hey there, we are implementing TMF620 and 633. What is the accepted way to handle null or empty filtering values?

    e.g. 

    "?name= "

    "?name=null"

    It seems reasonable that a string value could be null or empty? Or should these type of queries be rejected with an appropriate error?



    ------------------------------
    Ross Oliver
    Hansen Technologies
    ------------------------------


  • 2.  RE: Null/Empty Filtering Values

    TM Forum Member
    Posted Mar 21, 2023 08:21

    Hi Ross

    Interesting to hear @Florin Tene view on this, as the owner of the design guidelines.

    Need to consider the following aspects:

    • I don't think that it's possible to write null (as in the JSON elementary value) in a simple filter on the HTTP GET query string, since its formal interpretation would be a string with value "null" (i.e. the four letters n u l and l)
    • Assuming your target column/document/element is of type string, how can you represent an empty string value in the HTTP GET query string
    • I don't know enough about JSON Path syntax to be sure, but I would guess that it does allow you to represent null correctly

    If we've solved the query string representation, now consider the results. Basically, why would you reject such a query? It is legitimate, as you say, for a queryable field to be empty. And even for a field that is notionally mandatory (such as name in the catalog entities) it might happen that actual data items violate the constraint and you want your query to find such items.

    Still you need to consider the semantic difference between null and empty string, if such a difference exists in your persistence layer.

    Hope it helps



    ------------------------------
    Jonathan Goldberg
    Amdocs Management Limited
    Any opinions and statements made by me on this forum are purely personal, and do not necessarily reflect the position of the TM Forum or my employer.
    ------------------------------



  • 3.  RE: Null/Empty Filtering Values

    TM Forum Member
    Posted Mar 22, 2023 07:47
    Edited by Matthieu Hattab Mar 22, 2023 07:48

    that how we use TMF620 to get prices with endDateTime is > today or endDateTime is empty

    /tmf-api/{{tenantId}}/productCatalogManagement/v4/productOffering?name={{productOfferingName}}&productOfferingPrice.validFor.endDateTime%3E{{today}}&productOfferingPrice.validFor.endDateTime=


    ------------------------------
    Kind regards,

    Matthieu Hattab
    Lyse Platform
    ------------------------------