Contentful logo

Contentful Community

CMA Java - Fetch Snapshots

Hi there,

I am trying to implement a kind of history for the Entries using the CMA API on Java.

When I fetch snapshots for a particular entry, I can list those snapshots, but there is no way to get the actual fields of the entry for those relevant Snapshots. The snapshot.getSnapshot() return the CMAResource instance, which has no “fields” properties (declared in CMAEntry).
During the debug session I found that deserialization of snapshot simply ignores the “fields” block in incoming JSON.

If that is a bug in API, what are the estimates to get it fixed?

Are there any other ways to get the CMAEntry state (fields values) at particular version using the Java API?

Thanks in advance,
Yuriy

3 Likes

Hello,

indeed this is a downside of the current implementation: We are not returning a complete entry/content type but just a resource, completely stripping the fields and others.

Right now I cannot give you an answer on a timeline or priorities.

I could see quick hack on it happening sooner then later: You could replace the use of the CMAResouce with a Map<Object, Object> in the library code and roll your own library for now.

I will clarify scope and priorities, but again, cannot warrant a swift resolution just now.

Greetings,
Mario

Hey, @mario, thank you for a quick reply.

So, in general, your suggestion works.
The code to traverse that snapshot Map in my class is now extremely ugly :slight_smile: but now I can at least access the fields from querying the snapshots.

I hope for some clean solution from Contentful thoughts.

Thanks,
Yuriy

Hey,

quick update: We could squeeze in a bug fix for this issue: https://github.com/contentful/contentful-management.java/pull/114

Please feel free to take a look and let me know what you think…

Mario