Open APIs

 View Only
Expand all | Collapse all

TMF639: API reaction if there is an error in user's input (wrong attribute name)

  • 1.  TMF639: API reaction if there is an error in user's input (wrong attribute name)

    TM Forum Member
    Posted Oct 23, 2020 10:12
    Hello,
    The following case: external system sends REST API request GET to a server.
    There are 2 filters in a query.
    External system expects - several returned objects considering filters.
    But - there is a misprint in filter attribute name.

    For example request: GET /api/troubleTicket/?statTTus=acknowledged & creationDate=2017-04-20
    There is an error in attributer name - "statTTus" instead of "status".
    Database contains the following data:
    - 10 results corresponding to creationDate=2017-04-20
    - 5 results corresponding both filters status=acknowledged & creationDate=2017-04-20

    What should server return?
    1) error 400 Bad request ? (so ther should be a validation on server side?)
    2) 10 results ignoring wrong filter attribute ?
    3) something else?

    I did not found any recomendations about this in TMF639_Resource_Inventory_Management_API_User_Guide_v4.0.1 or TMF630_REST_API_Design_Guidelines_Part_1_v4.0.1.

    ------------------------------
    Thank you in advance
    Viacheslav
    ------------------------------


  • 2.  RE: TMF639: API reaction if there is an error in user's input (wrong attribute name)

    TM Forum Member
    Posted Oct 24, 2020 13:32
    Hi Viacheslav

    In my opinion, if there is an error in the name of a filter attribute (e.g. status in your example) this should return error 400, and you should of course populate the response body with the Error object giving more details of the error.
    On the other hand if there is an error in the value of a filter attribute (e.g. you asked for status acknoledged, a misprint in the value (missing w)), you should return error 404 not found (assuming that the filter is ANDed with other filters, so that indeed there will be no match).
    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.
    ------------------------------