Use Activity Log

Note

Your account needs access to the Data Hub Add-on Services.

  1. Create a new space with the activity-log listener and enableUUID set to true:

     POST /spaces
    

    Try in Swagger

     {
       "title": "Activity-Log Test",
       "enableUUID": true,
       "listeners": [
         {
           "id": "activity-log",
           "eventTypes": [
             "ModifySpaceEvent.request",
             "..."
           ]
         }
       ]
     }
    
  2. Check spaces. You will find one, as well as a new one, that has a title like: Activity log for space \

     GET /spaces
    

    Try in Swagger

     [
       {
         "id": "<newSpaceId>",
         "title": "Activity-Log-Test",
         "description": null,
         "enableUUID": true,
         "createdAt": 1575271893917,
         "updatedAt": 1575271897152
       },
       {
         "id": "<activityLogSpaceId>",
         "title": "activity-log for space <newSpaceId>",
         "description": "This is an automatically created space for the history of space __<newSpaceId>__.  \nCreated on 2019-12-02 at 07:31  \n***\nModified features will be stored in this space by their original _uuid_.  \nThe original namespace properties of Data Hub will be stored within the value 'original' of the namespace '@ns:com:here:xyz:log'.  \nIMPORTANT Deleting this space while activity-log is enabled, causes the absence of history.  \n***",
         "createdAt": 1575271894028,
         "updatedAt": 1575271894028,
         "searchableProperties": {
           "@ns:com:here:xyz:log.id": true,
           "@ns:com:here:xyz:log.invalidatedAt": true,
           "@ns:com:here:xyz:log.original.updatedAt": true
         }
       }
     ]
    
  3. Post something into your newly created space:

     PUT /spaces/<newSpaceId>/features
    

    Try in Swagger

     {
      "type":"FeatureCollection",
      "features":[
        {
          "id": "newFeatureId",
          "type": "Feature",
          "geometry": {
            "type": "Point",
            "coordinates": [1,0]
          }
        }
      ]
     }
    
  4. Check your activity log space:

     GET /spaces/<activityLogSpaceId>/iterate
    

    Try in Swagger

    This results in something similar to:

     {
      "type": "FeatureCollection",
      "features": [
        {
          "id": "<uuidOfFeature>",
          "type": "Feature",
          "properties": {
            "@ns:com:here:xyz": {
              "tags": [],
              "space": "<activityLogSpaceId>",
              "createdAt": 1575275435631,
              "updatedAt": 1575275435631
            },
            "@ns:com:here:xyz:log": {
              "id": "newFeatureId",
              "action": "SAVE",
              "original": {
                "space": "<newSpaceId>",
                "createdAt": 1575275435508,
                "updatedAt": 1575275435508
              },
              "invalidatedAt": 9223372036854776000
            }
          },
          "geometry": {
            "type": "Point",
            "coordinates": [
              1,
              0
            ]
          }
        }
      ]
     }
    

Search for specific feature

You can search the Activity Log for a specific feature using its original id. The id of a feature is a String, so ensure that it is quoted for the property search. This request returns an unsorted list of all revisions of the object.

GET /spaces/<activityLogSpaceId>/search?p.@ns:com:here:xyz:log.id="newFeatureId"

Try in Swagger

Response

{
  "type": "Feature",
  "id": "<uuidOfFeature>",
  "properties": {
    "@ns:com:here:xyz": {
      "tags": [],
      "space": "<activityLogSpaceId>",
      "createdAt": 1575275435631,
      "updatedAt": 1575275435631
    },
    "@ns:com:here:xyz:log": {
      "id": "newFeatureId",
      "action": "SAVE",
      "original": {
        "space": "<newSpaceId>",
        "createdAt": 1575275435508,
        "updatedAt": 1575275435508
      },
      "invalidatedAt": 9223372036854776000
    }
  },
  "geometry": {
    "type": "Point",
    "coordinates": [
      1,
      0
    ]
  }
}

Look up a specific revision of a feature

You can search for a specific revision of a feature using the uuid of the feature:

GET /spaces/<activityLogSpaceId>/features/<uuidOfFeature>

Try in Swagger

Response:

{
  "type": "Feature",
  "id": "<uuidOfFeature>",
  "geometry": {
    "type": "Point",
    "bbox": null,
    "coordinates": [
      1,
      0
    ]
  },
  "properties": {
    "@ns:com:here:xyz": {
      "space": "<activityLogSpaceId>",
      "createdAt": 1575275435631,
      "updatedAt": 1575275435631,
      "uuid": null,
      "puuid": null,
      "muuid": null,
      "tags": [],
      "_inputPosition": null
    },
    "@ns:com:here:xyz:log": {
      "id": "newFeatureId",
      "action": "SAVE",
      "original": {
        "space": "<newSpaceId>",
        "createdAt": 1575275435508,
        "updatedAt": 1575275435508
      },
      "invalidatedAt": 9223372036854776000
    }
  }
}

Activity Log for a certain point in time

You can search for a specific point in time by looking at the createdAt and invalidatedAt timestamps:

GET /spaces/<activityLogSpaceId>/search?p.@ns:com:here:xyz:log.original.updatedAt=lte=1575275435508&p.@ns:com:here:xyz:log.invalidatedAt=gt=1575275435508

Try in Swagger

Response body:

{
  "type": "FeatureCollection",
  "features": [
    {
      "id": "<uuidOfFeature>",
      "type": "Feature",
      "properties": {
        "@ns:com:here:xyz": {
          "tags": [],
          "space": "<activityLogSpaceId>",
          "createdAt": 1575275435631,
          "updatedAt": 1575275435631
        },
        "@ns:com:here:xyz:log": {
          "id": "newFeatureId",
          "action": "SAVE",
          "original": {
            "space": "<newSpaceId>",
            "createdAt": 1575275435508,
            "updatedAt": 1575275435508
          },
          "invalidatedAt": 9223372036854776000
        }
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          1,
          0
        ]
      }
    }
  ]
}

For further information head over to the developer guide on Activity-Log.

results matching ""

    No results matching ""