Open APIs

Expand all | Collapse all

404 or 204 or 200 with empty response

  • 1.  404 or 204 or 200 with empty response

    TM Forum Member
    Posted 2 days ago
    Hi all,

    When an URI does not have any results satisfying the specified filters, what should be the response? For example what should be the response of the below URIs

    1. prepayBalanceManagement/v4/adjustBalance/invalidID
    2. prepayBalanceManagement/v4/adjustBalance?id=invalidID
    3. prepayBalanceManagement/v4/adjustBalance?id=valid&partyAccount.id=invalidID
    4. prepayBalanceManagement/v4/adjustBalance?partyAccount.id=invalidID (For ex, no adjustBalance created on the account given)

    For the first case, spec clearly mentions that 404 would be the appropriate response.
    However, I wanted to confirm for other cases as well since I did not  find any explicit mention of the expectation and this would impact all our implementations.

    Thanks in advance,
    Sravya

    ------------------------------
    Sravya A
    Oracle Corporation
    ------------------------------


  • 2.  RE: 404 or 204 or 200 with empty response

    TM Forum Member
    Posted 2 days ago
    According to the design guidelines (TMF630 Part 1 section 4), also GET with filter should return 404 if no matching entities are found.
    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: 404 or 204 or 200 with empty response

    TM Forum Member
    Posted yesterday
    On Apr 08, 2021 06:32 @Sravya A wrote:​​
    > When an URI does not have any results satisfying the specified filters, what should be the response?

    Yes, the first case is a retrieval of an item, identified by id, in the adjustBalance Collection, if it doesn't exist 404 is the correct response.

    The rest of the examples are queries on the adjustBalance Collection. If the client provided a query with incorrect syntax expect a 400 response.  If the server experiences an internal error expect a 500 response. Otherwise the query is "successful" and the success result body is an array of items in the Collection matching the query filters.  If no items match expect an empty array ("[]") in the body with a 200 OK response.


    ------------------------------
    Vance Shipley
    SigScale
    ------------------------------