I am trying to pass the current client local date time to API by using the GET method, getting the error,
UI:
const localDateTime = new Date().toLocaleString();
await fetchDocument(`${process.env.REACT_APP_API_URL}/api/projects/${projectNumber}/${localDateTime}/${currentProjectPhase}`,
setIsBodDownloading,
instance,
history
);
API:
[HttpGet("{projectNumber}/{localDateTime}/{projectPhase?}")]
public async Task<ActionResult> BasisOfDesign(
[FromServices] IDbContextFactory<APIDbContext> serviceScopeFactory,
[FromServices] ICrmProjects crmProjects,
[FromServices] IConfiguration configuration,
[FromServices] IEmployeeContext employeeContext,
string projectNumber,
string localDateTime,
string projectPhase = null,
CancellationToken cancellationToken = default)
{
.....
....
}
I am getting the below error.
{"errors":[{"message":"Either the parameter query or the parameter id has to be set.","extensions":{"code":"HC0013"}}]}
I cannot use the server time, and I need to use only the client date and time for processing the results. I am looking into this type of string "12-19-2012, 7:00:00 PM"
Could anyone please let me know, Where I am doing wrong with the above code?