C# client library doesn't support saving drafts?

I have…

  • [X] Checked the logs and have provided the logs if I found something suspicious there

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [X] Bug report
  • [ ] Performance issue
  • [X] Documentation issue or request

Current behavior

Currently the latest version of the client library supports the UpdateAsync method on the ContentClient object. One of the parameters to this is a bool asDraft. However at no point does this parameter make any difference to the result, which is a published save.

Expected behavior

A previous version of Squidex supported automatically creating a draft if one was not already created through the method above. i.e. you didn’t have to explicitly create a draft version and then update it.

Minimal reproduction of the problem

await this.MyClient.UpdateAsync(id, data, true); <-- the “true” is ignored

My current solution is to use the rest api to retrieve the content first (with the X-Unpublished header set to “true”) and check the “newStatus” property (which also isnt part of the client library) to see if it is “Draft”. If the content doesn’t have a draft, I then create one using the rest api.

Am I missing something in the client library that handles this ?

Environment

  • [ ] Self hosted with docker
  • [ ] Self hosted with IIS
  • [X] Self hosted with other version
  • [ ] Cloud version

Version: [VERSION]
4.3

Others:

When checking the Status property of the object retrieved through the client library, it always states “Published” even when you have retrieved the draft - the newStatus property is set to “Draft”. Is this intended behaviour ?

When creating a draft for a single content schema, it fails - even the Squidex UI, which calls the same rest api as I am, fails (although no error is reported) - no draft is ever created. Is this intended behaviour ?

The problem with the singleton should be resolved but the other things are just not updated after a major change to the workflow system. PR is welcome.

Thanks, will take a look

Sebastian, I pulled down the source from github and made some changes to the content.cs and contentclient.cs files on a local branch. How can I get them to you for review ?

You have to fork the repository. Then make the changes, push to your fork and then create a pull request.