Documentation for Client Library

I have…

I’m submitting a…

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

Current behavior

It’s a bit unclear about how to use UpsertAsync / CreateAsync etc

Expected behavior

It would be nice to have some official documents

Before we have an official document, I would love to share what I found so people in the future can save some time to figure this out.

Usage

UpsertAsync / CreateAsync

This is for anything to write into Squidex.

Let’s say the Schema has 1 field called test (localizable)

The Objects should be

   public class Test : Content<TestData>
   {
   }

   public sealed class TestData
   {
      public CmsEnString Test { get; set; }
   }

   public class CmsEnString
   {
      public string En { get; set; }
   }

GetAsync

For reading data, there are 2 solutions.

Either to use the above Objects or assign a context like

QueryContext Context = QueryContext.Default.WithLanguages("en").Flatten()

With this context, data object will be like

   public sealed class TestData
   {
      public string Test { get; set; }
   }

The above information can be discovered from https://docs.squidex.io/02-documentation/developer-guides/api-overview/api#json-queries

Hope this can help others to save some time

I guess you mean documentation, not document.

There is a little bit, but it can be improved of course: https://docs.squidex.io/02-documentation/software-development-kits/.net-standard#how-to-work-with-contents

1 Like

Cool, somehow I miss this part. I guess I used the wrong key word. (I used UpsertAsync/CreateAsync …, bad choice lol)