Open APIs

 View Only
  • 1.  TMF641 question about 400 error code and business validation

    Posted Sep 09, 2020 09:41
    Hi,
    I have some questions:
    1. Could the 400 error code be used for business validation of received attributes in request body (SO creation)?
     Or it is used only for basic validation of received message (like well-formed json and so on)?

    And as result the second question:
    2. When should the business validation start?
    - Right after receiving SO in POST request? (if fails-400 error code, if successful - 201 Created)
    OR
    -  After successful basic message validation and answering with 201 Created and saving SO?

    Thank you in Advance


    ------------------------------
    Ekaterina Afanaseva
    T-Systems International Services GmbH
    ------------------------------


  • 2.  RE: TMF641 question about 400 error code and business validation

    TM Forum Member
    Posted Sep 10, 2020 01:32
    Hi Ekaterina

    The 400 code can be used to signify any error. In the swagger for all APIs, including TMF641, an Error object is generated as the response payload for all HTTP non-success codes. The expectation is that you will populate significant fields in the Error structure to give the consumer detailed information as to what went wrong.

    All this is for validations that you can do in your implementation synchronously and respond to POST with code 400.

    If there are validations that cannot be done synchronously, then you would return 201 on POST (create successful), and when those validations fail raise an event.

    The API spec itself does not prescribe which validations can be synchronous, it's up to the implementation.

    We are in the process of updating TMF641 so that Service Order and Service Order Item will contain an error resource, so that errors during handling of the order can be recorded on the order structure itself and returned by GET. @Kamal Maghsoudlou could perhaps give more information on this enhancement.​​

    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.
    ------------------------------