What is the expiry of syncToken?

fun buildSyncQuery(nextSyncUrl: String): String {
val cdaClient = CMSCDAClient.getCDAClient()
val synchronizedSpace = when {
nextSyncUrl.isEmpty() -> cdaClient.sync(nextSyncUrl).fetch()
else -> cdaClient.sync(SyncType.onlyEntriesOfType("<content_type>")).fetch()
}

    return synchronizedSpace.nextSyncUrl()
}

We get the nextSyncUrl as return. I want to know is there any expiry associated with Sync token? If yes, what is it? And how to make a request after the token has expired?
Also, what is the best approach to fetch the changed content? Should it be based on last updated timestamp? Or based on synctoken?

Hi @eswar.malla, sync token doesn’t expire; it represents a point in time from which to calculate the delta.

1 Like

Thank you for clarifying @Alma . :slightly_smiling_face:
I have one more question. When I am fetching my data, i am using the below query:

val cdaClient = CMSCDAClient.getCDAClient()
val query = cdaClient.fetch(CDAEntry::class.java)
.withContentType(“my_content_type”)
.include(5)
.where(CMSConstants.LOCALE, cmsLocale)
.orderBy(CMSConstants.SYS_CREATED_AT)
if (lastUpdated.isNotEmpty()) {
query.apply {
query.where(CMSConstants.SYS_UPDATED_AT, QueryOperation.IsLaterOrAt, lastUpdated)
}
}

When it fetches for the first time, it fetches all the referenced items as well. But for subsequent fetches, if there is a change in the reference level, that is not returned. Am I missing something in the query?

Hi @eswar.malla, what do you mena for ‘a change in the reference level’? Could you elaborate more on this?