Reputation: 31
When I call this REST service endpoint:
[HttpPost]
[Route("call-history")]
public async Task<IActionResult> CallHistory([FromBody] InputHistory body)
{
if (body == null)
{
return BadRequest("Invalid JSON Data");
}
var token = await _keycloakService.GetBearerTokenAsync();
var result = await _apiService.CallHistoryRestServiceAsync(token, body);
return Ok(result);
}
public class InputHistory
{
public string MessageID { get; set; }
public string User { get; set; }
public DateTime TimeStamp { get; set; }
public string CarrierSerialNumber { get; set; }
}
from Swagger, I get this error:
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"traceId": "00-5814943806d8d6a58972cb020cc34fcf-5f2d0e3c07954b30-00",
"errors": {
"$": [
"The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. Path: $ | LineNumber: 0 | BytePositionInLine: 0."
],
"body": [
"The body field is required."
]
}
}
request :
{ "messageID": "string", "user": "string", "timestamp": "2025-02-28T08:49:19.129Z", "carrierSerialNumber": "string" }
I cannot find solution :(
Upvotes: 0
Views: 47