Open APIs

 View Only
  • 1.  Regarding Parent and Child Resource in Single API POST

    TM Forum Member
    Posted 11 days ago
    Hi Team,

    Wanted to understand if there is any specific recommendation from TM-Forum regarding having Parent and Child Resource created as part of Single POST / Create request structure.  This is need from the target application perspective such that both parent and Child agreement are created and associated to each other.

    I am aware we could do multiple API calls and patch but we wanted to avoid that approach due to certain number of API request limitation at the target application.

    Thanks,
    Ramachandran

    General



  • 2.  RE: Regarding Parent and Child Resource in Single API POST

    TM Forum Member
    Posted 11 days ago

    Hi Ramachandran

    A child resource is embedded within a parent managed resource, and so can be created as part of the parent resource creation (and if mandatory it must be created).

    So let's rephrase your query to deal with managed resources where one resource has a perceived dependency on the other resource. For example, Billing Account is a managed resource with its own API (TMF666). But it is presumably dependent on Customer (TMF629) assuming that it doesn't make sense to create a billing account without a customer.

    So your question is, for this example, as part of the request body for POST <apiroot>/account can I supply a full Customer resource with no ID, instead of a related party ref.

    The answer is that TMF Open APIs deal with resources in an atomic fashion, so no you cannot do this.

    You can of course create a wrapper API (task resource) that would create both entities. The implementation of this API POST endpoint would invoke the POSTs of Customer and then Billing Account, and of course would have to deal with the situation that POST Customer fails, or that POST Customer succeeds and then POST Billing Account fails. Your implementation might, if working against say a SQL database, open a SQL transaction before creating both entities. Possibly more tricky to achieve against a document database, depends of course on capabilities.

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