How to avoid duplicating bookmark with API request



1 comment

  • Avatar

    Hi Miguel Câmara

    I am afraid you might be misunderstanding the meaning of Id. 
    There are several different id you might need to consider.

    1)Bookmark Id - Yes, this is a unique one. It is a standard GUID. 
    This bookmark ID would be generated automatically, users who use this API does NOT involve this Id at all.

    2) Device Id - Each bookmark should be associated with a specific device. This is how the bookmark work in Nx Witness. So while you create a bookmark, the API requires to have deviceId essentially, you are able to see the API format. i.e. /rest/v2/devices/{deviceId}/bookmarks

    3) Server Id - This is to decide this specific bookmark should be stored on which server. As you may know(also your user should know), the bookmark is stored in mediaserver local database (server.sqlite). So you are able to choose which server to stored, however, this is not a mandatory step. That being said you are able to leave it by default, the bookmark would be stored in the server which the device located.

    As a result, there is no any duplication, however, the duplication is due to you "ask the server to create duplicated bookmark for you". This means the system is just doing correctly as you send the requests twice.

    Secondly, the mediaserver "can't" know if the request is duplicated. Only you and your user can know after you read the bookmark detail. This means the bookmark content that your user is using for their POS inspection might not properly be designed for a system or a person to recognize if that is different or not.


    The suggestion we can provide is that you should include some identifiers in any of the column, ex: in caption or description. Ex: You can include the inspection time, then every time you create a bookmark, you may grab the bookmark list and check if the bookmark on the same "startTimeMs" is an "existed" one or just a difference one.


    1)Grab the bookmark list, filtered out all bookmark for same "startTimeMs".
    2)Check the caption or description, if there is any detail for POS system inspection evidence already.
    3) If yes, ignore creation request from your middleware.
    4) If no, create the bookmark as the POS system inspection evidence.


    Nx Witness can't judge or recognize if this is a duplicated bookmark from a source as every bookmark could be different even though they have same content. That being said, there is no significantly "100% guarantee" approach to filter out any bookmarks from mediaserver(the receiver), but this should be done from the source(the sender) that sending the requests instead.





    Comment actions Permalink

Please sign in to leave a comment.