I have…
- [X] Read the following guideline: https://docs.squidex.io/01-getting-started/installation/troubleshooting-and-support. I understand that my support request might get deleted if I do not follow the guideline.
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