[IMPLEMENTED] Query Content previous version by API

I went through the discussion on Squidex Content versioning. How to query content history data via API. We want to show user the changes between old and new on our web site, but not want to expose Squidex to the users.

In general you can make the same API calls as the Squidex frontend.

So you can use the history endpoint to retrieve a history of all changes, e.g.

GET https://cloud.squidex.io/api/apps/<APP_NAME>/history?channel=schemas.<SCHEMA_NAME>.contents.<CONTENT_ID>

and then use the content id and the version you want to get the content:

https://cloud.squidex.io/api/content/<APP_NAME>/<SCHEMA_NAME>/<CONTENT_ID>/<CONTENT_VERSION>

Thanks very much for your quick response. I will test them.

1 Like

I am still not successful yet to use your syntax in ClientLibrary. Can you recommend a way on how to hook this up in C#, or do you have any sample? I don’t see a version option in ClientOptions. Thanks

You are right. It is missing there. Going to add it.

I have added it to Squidex.ClientLibrary 7.6.0, it is not tested yet, because I have to add it to the API tests now.

Sebastian, Thanks very much. This is great and very responsive. Just confirm the spec for enhancement: a new ClientOption property call Version is to be added. The value is int.

  1. if this option is empty, then the latest version is returned
  2. if this option is value version, then that version’s content is returned
  3. if the version value is not existing, then nothing will be return.

It is just a new method:

I have seen a problem there because the endpoint only returns the data of the content. I will update the client library.

Is it version param optional? Is my understanding correct if the version param is not set, then the latest version of content is returned?

No, it is not optional. But you get the version from the normal content endpoint.

For example I just added a test: https://github.com/Squidex/squidex/pull/807/files#diff-54e5fe47060062c76fd2d03f6a0718f6f7b8fa3465b7ef4e0822489ae881cde4

Good design. Looking forward to the release date of 7.6.0

It is released since a while :wink:

Hi Sebastian, I got version 7.7.0 and works exactly as I expected per your code sample
You are super. Many thanks for your lightning speed release!!

Jay

1 Like

This topic was automatically closed after 2 days. New replies are no longer allowed.