Open APIs

 View Only
  • 1.  How to model who last changed some data item?

    TM Forum Member
    Posted Mar 30, 2023 05:58

    We need to store and convey in an API information on "who" did the last change on some entity.

    "Who" in quotation marks because it does not have to be a person, but might also be another IT Application, so that RelatedParty is not the solution.

    Is there a solution for this?



    ------------------------------
    Lutz Bettge
    Deutsche Telekom AG
    ------------------------------


  • 2.  RE: How to model who last changed some data item?

    TM Forum Member
    Posted Mar 30, 2023 14:48

    There is a history pattern that's reaching finalization in the v5 API set. Perhaps @Florin Tene can provide more information. The question arises whether we want to extend the modifiedBy to be either a Party/PartyRole or a Resource. Worth a discussion in the Thursday architecture call, I think.



    ------------------------------
    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: How to model who last changed some data item?

    TM Forum Member
    Posted Mar 31, 2023 03:34

    Thank you, I will join the call on Thursday then.
    @Florin Tene : It would also be interesting to know how the History concept works, as we are also working on something. Is there already something to read?



    ------------------------------
    Lutz Bettge
    Deutsche Telekom AG
    ------------------------------



  • 4.  RE: How to model who last changed some data item?

    TM Forum Member
    Posted Mar 31, 2023 13:20

    Thank you for bringing this up.
    I'm also interested in the solution. Would be good to know when it is finalized.



    ------------------------------
    Igor Dubrovin
    Bell Canada
    ------------------------------



  • 5.  RE: How to model who last changed some data item?

    Posted Apr 03, 2023 04:44

    To model who last changed a data item, you can add a "last modified by" field to your data model. This field would capture the user ID or username of the person who made the most recent change to the data item.

    Here's an example:

    Let's say you have a database table for customer information, with columns for name, email address, and phone number. To track who last modified a customer's record, you could add a "last modified by" column to the table, with the data type set to the user ID or username:

    CREATE TABLE customer (
      id INT PRIMARY KEY,
      name VARCHAR(50),
      email VARCHAR(50),
      phone VARCHAR(20),
      last_modified_by VARCHAR(50)
    );

    When a user updates a customer record, you would capture their user ID or username and store it in the "last_modified_by" field:

    sql
    UPDATE customer SET name = 'John Smith', email = 'john.smith@example.com', phone = '555-1234', last_modified_by = 'user123' WHERE id = 1;

    This way, you can keep track of who made the most recent changes to the customer record.
    URL





    ------------------------------
    Sajjad khan
    TO BE VERIFIED
    ------------------------------



  • 6.  RE: How to model who last changed some data item?

    Posted Apr 03, 2023 04:46

    Yes, there are several solutions to store and convey information about who last changed an entity in an API, even if it's not a person but another IT application.

    One approach is to use a token-based authentication system that generates a unique token for each application that accesses your API. When an application makes a change to an entity, it sends the token along with the API request. Your API can then use the token to identify which application made the change and store that information in a "last modified by" field, as I described in my previous answer.

    Here's an example of how you could implement this approach:

    1. Generate a unique token for each application that accesses your API.
    2. When an application makes a change to an entity, include the token in the API request headers.
    3. Your API checks the token to verify that it's valid and matches an application that has access to modify the entity.
    4. If the token is valid, your API stores the token in a "last modified by" field for the entity.

    Another approach is to use an audit trail or change log to record all changes made to entities, including information about who made the change and when. This approach can be more complex to implement, but it provides a detailed record of all changes made to your data.

    Here's an example of how you could implement this approach:

    1. Create a separate table or database to store the audit trail or change log.
    2. When an application makes a change to an entity, store a record in the audit trail or change log that includes information about the entity, the change that was made, and the application that made the change.
    3. Your API can then retrieve the audit trail or change log to display information about who made the most recent change to an entity.

    Both of these approaches have their advantages and disadvantages, depending on your specific use case. Ultimately, the best solution will depend on your specific requirements and constraints.
    URL



    ------------------------------
    easy movers
    TO BE VERIFIED
    ------------------------------



  • 7.  RE: How to model who last changed some data item?

    TM Forum Member
    Posted Apr 03, 2023 05:35

    Thank you for this explanation. We are doing exactly what you describe, using an access-token that contains - amongst others - the client-information; so this is not the problkem, and storing that somewhere internal to the provider application/service is straight forward of course.
    But the question is: When returning the entity (e.g. Product, ProductOrder or any other) as response to e.g. a GET, we need to return the "LastChangedBy" information as part of the resource, and for this there is nothing in the API defined so far; using a RelatedParty might do if it were Individuals who triggered the change, but an application/system is no party, so this does do.
    Maybe we might add a reference to a "DigitalIdentity" from TMF720, which could be a Party(Role) or Resource (representing the Application)?



    ------------------------------
    Lutz Bettge
    Deutsche Telekom AG
    ------------------------------