Finding Data Changes

Let’s assume we have the last sync time in a variable called lastSyncTime.

Using the Content List Endpoint

POST /api/content/{projectId}/entity/{entityName}/search

Parameters

Name

Type

Default

Description

Name

Type

Default

Description

firstResult

Int

Not default must be provided

Offset

maxResults

Int

true

Size

sortParamList

String[]

[_amid]

Sort fields

Body

OptionalContent Where Condition .

Example Request

POST /api/content/kurs/entity/arkiv/search

The following condition can be used for finding contents created/updated after the lastSyncTime

{ "type": "binary", "value1": { "type": "column", "columnName": "updated" }, "operator": "GREATER_THAN", "value2": { "type": "direct", "value": "2024-01-01T00:00:00Z", "castAs": "timestamp" } }

Example Response

[ { "_amid": "21124e96-66cb-4cf3-88e5-1b3591e02ef3", "identifikator": "A-1011", "innhold": "VĂ„r stĂžrste styrke er evnen til Ă„ tiltrekke oss og beholde noen av de beste utviklerne i Dhaka - et enormt spennende arbeidsmarked. Vi kan derfor skaffe erfarne seniorutviklere med kompetanse det nesten er umulig Ă„ finne i Norge - og det til en kostnad langt lavere enn lokale ansettelser eller innleide konsulenter.", "navn": "Oslo ferieleir", "created": "2023-06-21T08:48:46.500+00:00", "created_by": "sys_admin", "updated": "2024-09-12T07:46:11.442+00:00", "updated_by": "sys_admin", "kasskode": null, "arkivid": "319f07ba-e894-4a31-a731-62bc3cd18072", "merknad": null, "sluttdato": "1993.05.01", "startdato": "1975", "presisjon": "E", "omfang": null, "omfangenhet": null, "ordningsgrad": "C", "ordnetav": null, "ordnetdato": null, "katalogisering": null, "katalogmedium": null, "katalogreferanse": null, "asta5urn": "no-KURS_arkiv_000000000109", "depotstatus": "AV", "bevarinsgstid": 0, "kassasjonsar": null, "ispublishenabled": true, "fargebilde": false, "bunnmateriale": "0", "teknikk": "0", "fysisktilstand": "0", "beskrivelse": null, "planlagtkonservering": null, "bredde": null, "hoyde": null, "malestokk": null, "teknikkmerknad": null, "lokasjon": "SAO", "arkivlast": false, "date": null } ]

In case there are more results the X-Can-Paginate response header will be present

Limitations

Using this endpoint it is not possible to find out the deleted contents.

Either we need to iterate over all the contents and check batch by batch if they exists in Asta7 or not. Better alternative would be to use the v=event log endpoint to find the deleted contents.

As updated field is optional, it is possible that the value might be missing for some rows.

Using the Event Log Endpoint

Parameters

Name

Type

Default

Description

Name

Type

Default

Description

timestampFrom

Timestamp

 

Filter logs by timestamp field using >= operator

timestampTo

Timestamp

 

Filter logs by timestamp field using <= operator

eventTypes

String[]

 

Filter log by eventType field, available types

  • CREATE

  • UPDATE

  • DELETE

orderBy

String

timestamp

Sort field name

direction

String

DESC

Sort order

pageSize

Int

10

Batch size, >= 1

pageIndex

Int

0

Batch index, >= 0

getCount

Boolean

false

Should return total count as X-Total-Count response header

Request Headers

Name

Type

Default

Description

Name

Type

Default

Description

time-zone

String

Europe/Oslo

Time zone to convert the timestamps into

Example Request

Example Response

archiveObjec in response is the content affected by this event

Note

Make sure event logs are enabled for all the entities that you want to find changes for.

image-20241105-041013.png

Â