Hi,
In cloud edition, when creating a content from the client I get the following error :
SquidexException: Squidex Request failed: {“message”:“Failed to create content.”,“details”:[“Date: Not a valid value.”,“body: Not a known field.”,“date: Not a known field.”,“phone: Not a known field.”,“email: Not a known field.”,“identity: Not a known field.”],“statusCode”:400}
Squidex.ClientLibrary.SquidexClientBase.EnsureResponseIsValidAsync(HttpResponseMessage response, string token)
Here is my method :
var message = new MessageData { Date = DateTime.Now, Body = Lorem.Words(350), Email = Lorem.Email(), Identity = Lorem.Words(2), Phone = “0607358880” };
var response = await apiClient.SaveMessage(message);
return new JsonResult(response);
Here is my apiClient call implementation :
public ApiClient(IOptions appOptions)
{
var options = appOptions.Value;
var clientManager = new SquidexClientManager(
options.Url,
options.AppName,
options.ClientId,
options.ClientSecret);
messages = clientManager.GetClient<Message, MessageData>("message");
}
public async Task SaveMessage(MessageData message)
{
return await messages.CreateAsync(message, true);
}
Here is my MessageData class :
public sealed class MessageData
{
[JsonConverter(typeof(InvariantConverter))]
public string Identity { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public string Email { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public string Phone { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public DateTime Date { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public string Body { get; set; }
}
The Schema in cloud :
{
“fields”: [
{
“name”: “Date”,
“properties”: {
“editor”: “DateTime”,
“isListField”: true,
“fieldType”: “DateTime”
},
“partitioning”: “invariant”
},
{
“name”: “Identity”,
“properties”: {
“editor”: “Input”,
“isRequired”: true,
“isListField”: true,
“fieldType”: “String”
},
“partitioning”: “invariant”
},
{
“name”: “Phone”,
“properties”: {
“editor”: “Input”,
“isListField”: true,
“fieldType”: “String”
},
“partitioning”: “invariant”
},
{
“name”: “Email”,
“properties”: {
“editor”: “Input”,
“isRequired”: true,
“isListField”: true,
“fieldType”: “String”,
“pattern”: “^[a-zA-Z0-9.!#$%&’+\/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)$”
},
“partitioning”: “invariant”
},
{
“name”: “Body”,
“properties”: {
“editor”: “TextArea”,
“isRequired”: true,
“fieldType”: “String”
},
“partitioning”: “invariant”
}
],
“properties”: {}
Am I doing something wrong in my implementation ?
Regards